#include <sys/queue.h>
#include <fcntl.h>
+#ifdef HAVE_XTIO_H
#include <xtio.h>
+#endif
#include <sysio.h>
#include <fs.h>
#include <mount.h>
#include <inode.h>
+#ifdef HAVE_FILE_H
#include <file.h>
+#endif
#undef LIST_HEAD
data->mod_time = CURRENT_TIME;
}
+static void llu_inode2mdc_data(struct mdc_op_data *op_data,
+ struct inode *inode,
+ obd_valid valid)
+{
+ struct llu_inode_info *lli = llu_i2info(inode);
+ obd_valid newvalid = 0;
+
+ LASSERT(op_data != NULL);
+ LASSERT(inode != NULL);
+
+ /* put object id there all the time. */
+ if (valid & OBD_MD_FLID) {
+ ll_inode2id(&op_data->id1, inode);
+ newvalid |= OBD_MD_FLID;
+ }
+
+ if (valid & OBD_MD_FLSIZE) {
+ op_data->size = lli->lli_st_size;
+ newvalid |= OBD_MD_MEA;
+ }
+ if (valid & OBD_MD_FLBLOCKS) {
+ op_data->blocks = lli->lli_st_blocks;
+ newvalid |= OBD_MD_FLBLOCKS;
+ }
+ if (valid & OBD_MD_FLFLAGS) {
+ op_data->flags = lli->lli_st_flags;
+ newvalid |= OBD_MD_FLFLAGS;
+ }
+ if (valid & OBD_MD_FLATIME) {
+ op_data->atime = LTIME_S(lli->lli_st_atime);
+ newvalid |= OBD_MD_FLATIME;
+ }
+ if (valid & OBD_MD_FLMTIME) {
+ op_data->mtime = LTIME_S(lli->lli_st_mtime);
+ newvalid |= OBD_MD_FLMTIME;
+ }
+ if (valid & OBD_MD_FLCTIME) {
+ op_data->ctime = LTIME_S(lli->lli_st_ctime);
+ newvalid |= OBD_MD_FLCTIME;
+ }
+
+ if (valid & OBD_MD_FLTYPE) {
+ op_data->mode = (op_data->mode & S_IALLUGO) |
+ (lli->lli_st_mode & S_IFMT);
+ newvalid |= OBD_MD_FLTYPE;
+ }
+
+ if (valid & OBD_MD_FLMODE) {
+ op_data->mode = (op_data->mode & S_IFMT) |
+ (lli->lli_st_mode & S_IALLUGO);
+ newvalid |= OBD_MD_FLMODE;
+ }
+
+ op_data->valid |= newvalid;
+}
+
void obdo_refresh_inode(struct inode *dst,
struct obdo *src,
obd_valid valid)
static int llu_local_open(struct llu_inode_info *lli, struct lookup_intent *it)
{
- struct ptlrpc_request *req = it->d.lustre.it_data;
+ struct ptlrpc_request *req = LUSTRE_IT(it)->it_data;
struct ll_file_data *fd;
struct mds_body *body;
ENTRY;
OBD_ALLOC(fd, sizeof(*fd));
/* We can't handle this well without reorganizing ll_file_open and
- * ll_mdc_close, so don't even try right now. */
+ * ll_md_close(), so don't even try right now. */
LASSERT(fd != NULL);
memcpy(&fd->fd_mds_och.och_fh, &body->handle, sizeof(body->handle));
fd->fd_mds_och.och_magic = OBD_CLIENT_HANDLE_MAGIC;
lli->lli_file_data = fd;
- mdc_set_open_replay_data(NULL, &fd->fd_mds_och, it->d.lustre.it_data);
+ mdc_set_open_replay_data(NULL, &fd->fd_mds_och, LUSTRE_IT(it)->it_data);
RETURN(0);
}
CDEBUG(D_VFSTRACE, "VFS Op:inode=%lu\n", lli->lli_st_ino);
LL_GET_INTENT(inode, it);
- if (!it->d.lustre.it_disposition) {
+ if (!LUSTRE_IT(it)->it_disposition)
LBUG();
- }
rc = it_open_error(DISP_OPEN_OPEN, it);
if (rc)
lli->lli_open_flags = flags & ~(O_CREAT | O_EXCL | O_TRUNC);
out_release:
- request = it->d.lustre.it_data;
+ request = LUSTRE_IT(it)->it_data;
ptlrpc_req_finished(request);
it->it_op_release(it);
GOTO(out, rc = -EPROTO);
}
- rc = obd_unpackmd(llu_i2obdexp(dir), &lsm, eadata, body->eadatasize);
+ rc = obd_unpackmd(llu_i2dtexp(dir), &lsm, eadata, body->eadatasize);
if (rc < 0) {
CERROR("obd_unpackmd: %d\n", rc);
GOTO(out, rc);
}
}
- rc = obd_destroy(llu_i2obdexp(dir), oa, lsm, &oti);
+ rc = obd_destroy(llu_i2dtexp(dir), oa, lsm, &oti);
obdo_free(oa);
if (rc)
CERROR("obd destroy objid 0x"LPX64" error %d\n",
lsm->lsm_object_id, rc);
out_free_memmd:
- obd_free_memmd(llu_i2obdexp(dir), &lsm);
+ obd_free_memmd(llu_i2dtexp(dir), &lsm);
out:
return rc;
}
struct ll_file_data *fd = lli->lli_file_data;
struct ptlrpc_request *req = NULL;
struct obd_client_handle *och = &fd->fd_mds_och;
- struct obdo obdo;
+ struct mdc_op_data op_data;
int rc, valid;
ENTRY;
&fd->fd_cwlockh);
}
- obdo.o_id = lli->lli_st_ino;
- obdo.o_valid = OBD_MD_FLID;
+ memset(&op_data, 0, sizeof(op_data));
+ id_ino(&op_data.id1) = lli->lli_st_ino;
+ op_data.valid = OBD_MD_FLID;
valid = OBD_MD_FLTYPE | OBD_MD_FLMODE | OBD_MD_FLSIZE |OBD_MD_FLBLOCKS |
OBD_MD_FLATIME | OBD_MD_FLMTIME | OBD_MD_FLCTIME;
if (test_bit(LLI_F_HAVE_OST_SIZE_LOCK, &lli->lli_flags))
valid |= OBD_MD_FLSIZE | OBD_MD_FLBLOCKS;
- obdo_from_inode(&obdo, inode, valid);
+ llu_inode2mdc_data(&op_data, inode, valid);
if (0 /* ll_is_inode_dirty(inode) */) {
- obdo.o_flags = MDS_BFLAG_UNCOMMITTED_WRITES;
- obdo.o_valid |= OBD_MD_FLFLAGS;
+ op_data.flags = MDS_BFLAG_UNCOMMITTED_WRITES;
+ op_data.valid |= OBD_MD_FLFLAGS;
}
- rc = mdc_close(mdc_exp, &obdo, och, &req);
+ rc = mdc_close(mdc_exp, &op_data, och, &req);
if (rc == EAGAIN) {
/* We are the last writer, so the MDS has instructed us to get
* the file size and any write cookies, then close again. */
if (!fd) /* no process opened the file after an mcreate */
RETURN(0);
- rc2 = llu_mdc_close(sbi->ll_lmv_exp, inode);
+ rc2 = llu_mdc_close(sbi->ll_md_exp, inode);
if (rc2 && !rc)
rc = rc2;
oa.o_id, lli->lli_st_size);
/* truncate == punch from new size to absolute end of file */
- err = obd_punch(llu_i2obdexp(inode), &oa, lsm, lli->lli_st_size,
- OBD_OBJECT_EOF, NULL);
+ /* XXX: capa is NULL here, is it correct? */
+ err = obd_punch(llu_i2dtexp(inode), &oa, lsm, lli->lli_st_size,
+ OBD_OBJECT_EOF, NULL, NULL);
if (err)
CERROR("obd_truncate fails (%d) ino %lu\n", err, lli->lli_st_ino);
else