__u64 f_seq; /* holds fid sequence. Lustre should support 2 ^ 64
* objects, thus even if one sequence has one object we
* reach this value. */
- __u64 f_num; /* firt 32 bits holds fid number and another 32 bits holds
- * version of object. */
+ __u32 f_oid; /* fid number within its sequence. */
+ __u32 f_ver; /* holds fid version. */
};
+/* maximal objects in sequence */
+#define LUSTRE_FID_SEQ_WIDTH 10000
+
+/* shift of version component */
+#define LUSTRE_FID_VER_SHIFT (sizeof(((struct lu_fid *)0)->f_ver) * 8)
+
/* get object sequence */
static inline __u64 fid_seq(const struct lu_fid *fid)
{
return fid->f_seq;
}
-/* get complex object number (id + version) */
-static inline __u64 fid_num(const struct lu_fid *fid)
-{
- return fid->f_num;
-}
-
-/* maximal objects in sequence */
-#define LUSTRE_FID_SEQ_WIDTH 10000
-
-/* object id is stored in rightmost 32 bits and version in leftmost 32 bits. So
- * that if object has no version component ->f_num shows object id and no need
- * to mask anything out. */
-#define LUSTRE_FID_OID_MASK 0x00000000ffffffffull
-#define LUSTRE_FID_VER_MASK (~LUSTRE_FID_OID_MASK)
-
-/* shifts of both components */
-#define LUSTRE_FID_OID_SHIFT 0
-#define LUSTRE_FID_VER_SHIFT (sizeof(((struct lu_fid *)0)->f_num) / 2 * 8)
-
/* get object id */
static inline __u32 fid_oid(const struct lu_fid *fid)
{
- return (__u32)((fid->f_num & LUSTRE_FID_OID_MASK) >> LUSTRE_FID_OID_SHIFT);
+ return fid->f_oid;
}
/* get object version */
static inline __u32 fid_ver(const struct lu_fid *fid)
{
- return (__u32)((fid->f_num & LUSTRE_FID_VER_MASK) >> LUSTRE_FID_VER_SHIFT);
+ return fid->f_ver;
+}
+
+/* get complex object number (oid + version) */
+static inline __u64 fid_num(const struct lu_fid *fid)
+{
+ __u64 f_ver = fid_ver(fid);
+ f_ver = f_ver << LUSTRE_FID_VER_SHIFT;
+ return f_ver | fid_oid(fid);
}
/* show sequence, object id and version */
-#define DFID3 LPU64"/%lu:%lu"
+#define DFID3 LPU64"/%u:%u"
#define PFID3(fid) \
fid_seq(fid), \
- fid_num(fid), \
- fid_num(fid)
+ fid_oid(fid), \
+ fid_ver(fid)
/* temporary stuff for compatibility */
struct ll_fid {
{
/* check that there is no alignment padding */
CLASSERT(sizeof *f0 ==
- sizeof f0->f_seq + sizeof f0->f_num);
+ sizeof f0->f_seq + sizeof f0->f_oid + sizeof f0->f_ver);
return memcmp(f0, f1, sizeof *f0) == 0;
}
__u32 sa_padding; /* also fix lustre_swab_mds_rec_setattr */
};
+extern void lustre_swab_mds_rec_setattr (struct mds_rec_setattr *sa);
+
+struct mdt_rec_setattr {
+ __u32 sa_opcode;
+ __u32 sa_fsuid;
+ __u32 sa_fsgid;
+ __u32 sa_cap;
+ __u32 sa_suppgid;
+ __u32 sa_mode;
+ struct lu_fid sa_fid;
+ __u64 sa_valid;
+ __u64 sa_size;
+ __u64 sa_mtime;
+ __u64 sa_atime;
+ __u64 sa_ctime;
+ __u32 sa_uid;
+ __u32 sa_gid;
+ __u32 sa_attr_flags;
+ __u32 sa_padding; /* also fix lustre_swab_mds_rec_setattr */
+};
+
+extern void lustre_swab_mdt_rec_setattr (struct mdt_rec_setattr *sa);
+
/* Remove this once we declare it in include/linux/fs.h (v21 kernel patch?) */
#ifndef ATTR_CTIME_SET
#define ATTR_CTIME_SET 0x2000
#endif
-extern void lustre_swab_mds_rec_setattr (struct mds_rec_setattr *sa);
-
#ifndef FMODE_READ
#define FMODE_READ 00000001
#define FMODE_WRITE 00000002
#define MDS_OPEN_HAS_EA 010000000000 /* specify object create pattern */
#define MDS_OPEN_HAS_OBJS 020000000000 /* Just set the EA the obj exist */
+struct mds_rec_join {
+ struct ll_fid jr_fid;
+ __u64 jr_headsize;
+};
+
+extern void lustre_swab_mds_rec_join (struct mds_rec_join *jr);
+
+struct mdt_rec_join {
+ struct lu_fid jr_fid;
+ __u64 jr_headsize;
+};
+
+extern void lustre_swab_mdt_rec_join (struct mdt_rec_join *jr);
+
struct mds_rec_create {
__u32 cr_opcode;
__u32 cr_fsuid;
extern void lustre_swab_mds_rec_create (struct mds_rec_create *cr);
-struct mds_rec_join {
- struct ll_fid jr_fid;
- __u64 jr_headsize;
+struct mdt_rec_create {
+ __u32 cr_opcode;
+ __u32 cr_fsuid;
+ __u32 cr_fsgid;
+ __u32 cr_cap;
+ __u32 cr_flags; /* for use with open */
+ __u32 cr_mode;
+ struct lu_fid cr_fid;
+ struct lu_fid cr_replayfid;
+ __u64 cr_time;
+ __u64 cr_rdev;
+ __u32 cr_suppgid;
+ __u32 cr_padding_1; /* also fix lustre_swab_mds_rec_create */
+ __u32 cr_padding_2; /* also fix lustre_swab_mds_rec_create */
+ __u32 cr_padding_3; /* also fix lustre_swab_mds_rec_create */
+ __u32 cr_padding_4; /* also fix lustre_swab_mds_rec_create */
+ __u32 cr_padding_5; /* also fix lustre_swab_mds_rec_create */
};
-extern void lustre_swab_mds_rec_join (struct mds_rec_join *jr);
+extern void lustre_swab_mdt_rec_create (struct mdt_rec_create *cr);
struct mds_rec_link {
__u32 lk_opcode;
extern void lustre_swab_mds_rec_link (struct mds_rec_link *lk);
+struct mdt_rec_link {
+ __u32 lk_opcode;
+ __u32 lk_fsuid;
+ __u32 lk_fsgid;
+ __u32 lk_cap;
+ __u32 lk_suppgid1;
+ __u32 lk_suppgid2;
+ struct lu_fid lk_fid1;
+ struct lu_fid lk_fid2;
+ __u64 lk_time;
+ __u32 lk_padding_1; /* also fix lustre_swab_mds_rec_link */
+ __u32 lk_padding_2; /* also fix lustre_swab_mds_rec_link */
+ __u32 lk_padding_3; /* also fix lustre_swab_mds_rec_link */
+ __u32 lk_padding_4; /* also fix lustre_swab_mds_rec_link */
+};
+
+extern void lustre_swab_mdt_rec_link (struct mdt_rec_link *lk);
+
struct mds_rec_unlink {
__u32 ul_opcode;
__u32 ul_fsuid;
extern void lustre_swab_mds_rec_unlink (struct mds_rec_unlink *ul);
+struct mdt_rec_unlink {
+ __u32 ul_opcode;
+ __u32 ul_fsuid;
+ __u32 ul_fsgid;
+ __u32 ul_cap;
+ __u32 ul_suppgid;
+ __u32 ul_mode;
+ struct lu_fid ul_fid1;
+ struct lu_fid ul_fid2;
+ __u64 ul_time;
+ __u32 ul_padding_1; /* also fix lustre_swab_mds_rec_unlink */
+ __u32 ul_padding_2; /* also fix lustre_swab_mds_rec_unlink */
+ __u32 ul_padding_3; /* also fix lustre_swab_mds_rec_unlink */
+ __u32 ul_padding_4; /* also fix lustre_swab_mds_rec_unlink */
+};
+
+extern void lustre_swab_mdt_rec_unlink (struct mdt_rec_unlink *ul);
+
struct mds_rec_rename {
__u32 rn_opcode;
__u32 rn_fsuid;
extern void lustre_swab_mds_rec_rename (struct mds_rec_rename *rn);
+struct mdt_rec_rename {
+ __u32 rn_opcode;
+ __u32 rn_fsuid;
+ __u32 rn_fsgid;
+ __u32 rn_cap;
+ __u32 rn_suppgid1;
+ __u32 rn_suppgid2;
+ struct lu_fid rn_fid1;
+ struct lu_fid rn_fid2;
+ __u64 rn_time;
+ __u32 rn_padding_1; /* also fix lustre_swab_mds_rec_rename */
+ __u32 rn_padding_2; /* also fix lustre_swab_mds_rec_rename */
+ __u32 rn_padding_3; /* also fix lustre_swab_mds_rec_rename */
+ __u32 rn_padding_4; /* also fix lustre_swab_mds_rec_rename */
+};
+
+extern void lustre_swab_mdt_rec_rename (struct mdt_rec_rename *rn);
+
/*
* LOV data structures
*/
struct obd_device;
struct lustre_md {
- struct mds_body *body;
+ struct mdt_body *body;
struct lov_stripe_md *lsm;
#ifdef CONFIG_FS_POSIX_ACL
struct posix_acl *posix_acl;
};
struct mdc_op_data {
- struct ll_fid fid1;
- struct ll_fid fid2;
+ struct lu_fid fid1;
+ struct lu_fid fid2;
__u64 mod_time;
const char *name;
int namelen;
__u32 create_mode;
__u32 suppgids[2];
+
+ obd_valid valid;
+ obd_size size;
+ obd_blocks blocks;
+ obd_flag flags;
+ obd_time mtime;
+ obd_time atime;
+ obd_time ctime;
};
/* mdc/mdc_locks.c */
void it_set_disposition(struct lookup_intent *it, int flag);
int it_open_error(int phase, struct lookup_intent *it);
void mdc_set_lock_data(__u64 *lockh, void *data);
-int mdc_change_cbdata(struct obd_export *exp, struct ll_fid *fid,
+int mdc_change_cbdata(struct obd_export *exp, struct lu_fid *fid,
ldlm_iterator_t it, void *data);
int mdc_intent_lock(struct obd_export *exp,
struct mdc_op_data *,
struct obd_export *exp, struct lustre_md *md);
void mdc_free_lustre_md(struct obd_export *exp, struct lustre_md *md);
-int mdc_getstatus(struct obd_export *exp, struct ll_fid *rootfid);
-int mdc_getattr(struct obd_export *exp, struct ll_fid *fid,
+int mdc_getstatus(struct obd_export *exp, struct lu_fid *rootfid);
+int mdc_getattr(struct obd_export *exp, struct lu_fid *fid,
obd_valid valid, unsigned int ea_size,
struct ptlrpc_request **request);
-int mdc_getattr_name(struct obd_export *exp, struct ll_fid *fid,
+int mdc_getattr_name(struct obd_export *exp, struct lu_fid *fid,
const char *filename, int namelen, unsigned long valid,
unsigned int ea_size, struct ptlrpc_request **request);
int mdc_setattr(struct obd_export *exp, struct mdc_op_data *data,
struct iattr *iattr, void *ea, int ealen, void *ea2, int ea2len,
struct ptlrpc_request **request);
-int mdc_setxattr(struct obd_export *exp, struct ll_fid *fid,
+int mdc_setxattr(struct obd_export *exp, struct lu_fid *fid,
obd_valid valid, const char *xattr_name,
const char *input, int input_size,
int output_size, int flags,
struct ptlrpc_request **request);
-int mdc_getxattr(struct obd_export *exp, struct ll_fid *fid,
+int mdc_getxattr(struct obd_export *exp, struct lu_fid *fid,
obd_valid valid, const char *xattr_name,
const char *input, int input_size,
int output_size, struct ptlrpc_request **request);
void mdc_set_open_replay_data(struct obd_client_handle *och,
struct ptlrpc_request *open_req);
void mdc_clear_open_replay_data(struct obd_client_handle *och);
-int mdc_close(struct obd_export *, struct obdo *, struct obd_client_handle *,
+int mdc_close(struct obd_export *, struct mdc_op_data *, struct obd_client_handle *,
struct ptlrpc_request **);
-int mdc_readpage(struct obd_export *exp, struct ll_fid *mdc_fid, __u64 offset,
+int mdc_readpage(struct obd_export *exp, struct lu_fid *mdc_fid, __u64 offset,
struct page *, struct ptlrpc_request **);
int mdc_create(struct obd_export *exp, struct mdc_op_data *op_data,
const void *data, int datalen, int mode, __u32 uid, __u32 gid,
int mdc_rename(struct obd_export *exp, struct mdc_op_data *data,
const char *old, int oldlen, const char *new, int newlen,
struct ptlrpc_request **request);
-int mdc_sync(struct obd_export *exp, struct ll_fid *fid,
+int mdc_sync(struct obd_export *exp, struct lu_fid *fid,
struct ptlrpc_request **);
int mdc_create_client(struct obd_uuid uuid, struct ptlrpc_client *cl);
-/* Store the generation of a newly-created inode in |req| for replay. */
-void mdc_store_inode_generation(struct ptlrpc_request *req, int reqoff,
- int repoff);
int mdc_llog_process(struct obd_export *, char *logname, llog_cb_t, void *data);
-int mdc_done_writing(struct obd_export *exp, struct obdo *);
-
-static inline void mdc_pack_fid(struct ll_fid *fid, obd_id ino, __u32 gen,
- int type)
-{
- fid->id = ino;
- fid->generation = gen;
- fid->f_type = type;
-}
+int mdc_done_writing(struct obd_export *exp, struct mdc_op_data *data);
#endif
int (*o_llog_finish)(struct obd_device *obd, int count);
/* metadata-only methods */
- int (*o_pin)(struct obd_export *, obd_id ino, __u32 gen, int type,
+ int (*o_pin)(struct obd_export *, struct lu_fid *fid,
struct obd_client_handle *, int flag);
int (*o_unpin)(struct obd_export *, struct obd_client_handle *, int);
return(rc);
}
-static inline int obd_pin(struct obd_export *exp, obd_id ino, __u32 gen,
- int type, struct obd_client_handle *handle, int flag)
+static inline int obd_pin(struct obd_export *exp, struct lu_fid *fid,
+ struct obd_client_handle *handle, int flag)
{
int rc;
EXP_CHECK_OP(exp, pin);
OBD_COUNTER_INCREMENT(exp->exp_obd, pin);
- rc = OBP(exp->exp_obd, pin)(exp, ino, gen, type, handle, flag);
+ rc = OBP(exp->exp_obd, pin)(exp, fid, handle, flag);
return(rc);
}
struct llu_inode_info *lli = llu_i2info(inode);
struct intnl_stat *st = llu_i2stat(inode);
struct llu_sb_info *sbi = llu_i2sbi(inode);
- struct ll_fid mdc_fid;
__u64 offset;
int rc = 0;
struct ptlrpc_request *request;
struct lustre_handle lockh;
- struct mds_body *body;
+ struct mdt_body *body;
struct lookup_intent it = { .it_op = IT_READDIR };
struct mdc_op_data data;
struct obd_device *obddev = class_exp2obd(sbi->ll_mdc_exp);
}
ldlm_lock_dump_handle(D_OTHER, &lockh);
- mdc_pack_fid(&mdc_fid, st->st_ino, lli->lli_st_generation, S_IFDIR);
-
offset = page->index << PAGE_SHIFT;
- rc = mdc_readpage(sbi->ll_mdc_exp, &mdc_fid,
+ rc = mdc_readpage(sbi->ll_mdc_exp, &lli->lli_fid,
offset, page, &request);
if (!rc) {
body = lustre_msg_buf(request->rq_repmsg, 0, sizeof (*body));
{
struct ptlrpc_request *req = it->d.lustre.it_data;
struct ll_file_data *fd;
- struct mds_body *body;
+ struct mdt_body *body;
ENTRY;
body = lustre_msg_buf (req->rq_repmsg, 1, sizeof (*body));
int llu_objects_destroy(struct ptlrpc_request *request, struct inode *dir)
{
- struct mds_body *body;
+ struct mdt_body *body;
struct lov_mds_md *eadata;
struct lov_stripe_md *lsm = NULL;
struct obd_trans_info oti = { 0 };
int llu_mdc_close(struct obd_export *mdc_exp, struct inode *inode)
{
struct llu_inode_info *lli = llu_i2info(inode);
- struct intnl_stat *st = llu_i2stat(inode);
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;
- int rc, valid;
+ struct intnl_stat *st = llu_i2stat(inode);
+ struct mdc_op_data op_data;
+ int rc;
ENTRY;
/* clear group lock, if present */
&fd->fd_cwlockh);
}
- obdo.o_id = st->st_ino;
- obdo.o_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;
+ memset(&op_data, 0, sizeof(op_data));
+ op_data.fid1 = lli->lli_fid;
+ op_data.valid = OBD_MD_FLTYPE | OBD_MD_FLMODE |
+ OBD_MD_FLSIZE | OBD_MD_FLBLOCKS |
+ OBD_MD_FLATIME | OBD_MD_FLMTIME |
+ OBD_MD_FLCTIME;
+
+ op_data.atime = LTIME_S(st->st_atime);
+ op_data.mtime = LTIME_S(st->st_mtime);
+ op_data.ctime = LTIME_S(st->st_ctime);
+ op_data.size = st->st_size;
+ op_data.blocks = st->st_blocks;
+ op_data.flags = lli->lli_st_flags;
- obdo_from_inode(&obdo, inode, valid);
+ if (test_bit(LLI_F_HAVE_OST_SIZE_LOCK, &lli->lli_flags))
+ op_data.valid |= OBD_MD_FLSIZE | OBD_MD_FLBLOCKS;
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. */
struct obd_uuid ll_sb_uuid;
struct obd_export *ll_mdc_exp;
struct obd_export *ll_osc_exp;
- struct ll_fid ll_root_fid;
+ struct lu_fid ll_root_fid;
int ll_flags;
struct lustre_client_ocd ll_lco;
struct list_head ll_conn_chain;
struct llu_inode_info {
struct llu_sb_info *lli_sbi;
- struct ll_fid lli_fid;
+ struct lu_fid lli_fid;
struct lov_stripe_md *lli_smd;
char *lli_symlink_name;
static inline int llu_is_root_inode(struct inode *inode)
{
- return (llu_i2info(inode)->lli_fid.id ==
- llu_i2info(inode)->lli_sbi->ll_root_fid.id);
+ return (fid_seq(&llu_i2info(inode)->lli_fid) ==
+ fid_seq(&llu_i2info(inode)->lli_sbi->ll_root_fid) &&
+ fid_num(&llu_i2info(inode)->lli_fid) ==
+ fid_num(&llu_i2info(inode)->lli_sbi->ll_root_fid));
}
#define LL_SAVE_INTENT(inode, it) \
#define LL_LOOKUP_POSITIVE 1
#define LL_LOOKUP_NEGATIVE 2
-static inline void ll_inode2fid(struct ll_fid *fid, struct inode *inode)
+static inline void ll_inode2fid(struct lu_fid *fid, struct inode *inode)
{
+ LASSERT(fid != NULL);
+ LASSERT(fid != NULL);
*fid = llu_i2info(inode)->lli_fid;
}
extern struct mount_option_s mount_option;
/* super.c */
-void llu_update_inode(struct inode *inode, struct mds_body *body,
+void llu_update_inode(struct inode *inode, struct mdt_body *body,
struct lov_stripe_md *lmm);
void obdo_to_inode(struct inode *dst, struct obdo *src, obd_flag valid);
void obdo_from_inode(struct obdo *dst, struct inode *src, obd_flag valid);
static struct inode_ops llu_inode_ops;
-void llu_update_inode(struct inode *inode, struct mds_body *body,
+void llu_update_inode(struct inode *inode, struct mdt_body *body,
struct lov_stripe_md *lsm)
{
struct llu_inode_info *lli = llu_i2info(inode);
if (body->valid & OBD_MD_FLGENER)
lli->lli_st_generation = body->generation;
+#if 0
/* fillin fid */
if (body->valid & OBD_MD_FLID)
lli->lli_fid.id = body->ino;
lli->lli_fid.generation = body->generation;
if (body->valid & OBD_MD_FLTYPE)
lli->lli_fid.f_type = body->mode & S_IFMT;
+#endif
}
void obdo_to_inode(struct inode *dst, struct obdo *src, obd_flag valid)
}
static struct inode* llu_new_inode(struct filesys *fs,
- struct ll_fid *fid)
+ struct lu_fid *fid)
{
struct inode *inode;
struct llu_inode_info *lli;
struct intnl_stat st = {
.st_dev = 0,
+#if 0
#ifndef AUTOMOUNT_FILE_NAME
.st_mode = fid->f_type & S_IFMT,
#else
.st_mode = fid->f_type /* all of the bits! */
#endif
+#endif
+ /* FIXME: fix this later */
+ .st_mode = 0,
+
.st_uid = geteuid(),
.st_gid = getegid(),
};
struct lustre_md md;
struct ptlrpc_request *req = NULL;
struct llu_sb_info *sbi = llu_i2sbi(inode);
- struct ll_fid fid;
+ struct lu_fid fid;
unsigned long valid = OBD_MD_FLGETATTR;
int rc, ealen = 0;
void llu_clear_inode(struct inode *inode)
{
- struct ll_fid fid;
+ struct lu_fid fid;
struct llu_inode_info *lli = llu_i2info(inode);
struct llu_sb_info *sbi = llu_i2sbi(inode);
ENTRY;
{
struct llu_inode_info *lli = llu_i2info(inode);
struct llu_sb_info *sbi = llu_i2sbi(inode);
- struct ll_fid fid;
- struct mds_body *body;
+ struct lu_fid fid;
+ struct mdt_body *body;
struct intnl_stat *st = llu_i2stat(inode);
int rc, symlen = st->st_size + 1;
ENTRY;
struct inode *llu_iget(struct filesys *fs, struct lustre_md *md)
{
struct inode *inode;
- struct ll_fid fid;
+ struct lu_fid fid;
struct file_identifier fileid = {&fid, sizeof(fid)};
if ((md->body->valid &
}
/* try to find existing inode */
- fid.id = md->body->ino;
- fid.generation = md->body->generation;
- fid.f_type = md->body->mode & S_IFMT;
+ fid = md->body->fid1;
inode = _sysio_i_find(fs, &fileid);
if (inode) {
struct inode *root;
struct pnode_base *rootpb;
struct obd_device *obd;
- struct ll_fid rootfid;
+ struct lu_fid rootfid;
struct llu_sb_info *sbi;
struct obd_statfs osfs;
static struct qstr noname = { NULL, 0, 0 };
CERROR("cannot mds_connect: rc = %d\n", err);
GOTO(out_osc, err);
}
- CDEBUG(D_SUPER, "rootfid "LPU64"\n", rootfid.id);
+ CDEBUG(D_SUPER, "rootfid "DFID3"\n", PFID3(&rootfid));
sbi->ll_root_fid = rootfid;
/* fetch attr of root inode */
GOTO(out_request, err);
}
- LASSERT(sbi->ll_root_fid.id != 0);
+ LASSERT(fid_num(&sbi->ll_root_fid) != 0);
root = llu_iget(fs, &md);
if (!root || IS_ERR(root)) {
unlock_kernel();
handle = (flag) ? &ldd->lld_mnt_och : &ldd->lld_cwd_och;
- rc = obd_pin(sbi->ll_mdc_exp, inode->i_ino, inode->i_generation,
- inode->i_mode & S_IFMT, handle, flag);
+ rc = obd_pin(sbi->ll_mdc_exp, &ll_i2info(inode)->lli_fid,
+ handle, flag);
if (rc) {
lock_kernel();
static int ll_dir_readpage(struct file *file, struct page *page)
{
struct inode *inode = page->mapping->host;
- struct ll_fid mdc_fid;
+ struct lu_fid fid;
__u64 offset;
struct ptlrpc_request *request;
struct mds_body *body;
CDEBUG(D_VFSTRACE, "VFS Op:inode=%lu/%u(%p) off "LPU64"\n",
inode->i_ino, inode->i_generation, inode, offset);
- mdc_pack_fid(&mdc_fid, inode->i_ino, inode->i_generation, S_IFDIR);
+ ll_inode2fid(&fid, inode);
- rc = mdc_readpage(ll_i2sbi(inode)->ll_mdc_exp, &mdc_fid,
+ rc = mdc_readpage(ll_i2sbi(inode)->ll_mdc_exp, &fid,
offset, page, &request);
if (!rc) {
body = lustre_msg_buf(request->rq_repmsg, 0, sizeof (*body));
*/
case IOC_MDC_LOOKUP: {
struct ptlrpc_request *request = NULL;
- struct ll_fid fid;
+ struct lu_fid fid;
char *buf = NULL;
char *filename;
int namelen, rc, len = 0;
struct ptlrpc_request *request = NULL;
struct lov_user_md *lump = (struct lov_user_md *)arg;
struct lov_mds_md *lmm;
- struct ll_fid fid;
+ struct lu_fid fid;
struct mds_body *body;
int rc, lmmsize;
case IOC_MDC_GETFILEINFO:
case IOC_MDC_GETSTRIPE: {
struct ptlrpc_request *request = NULL;
- struct ll_fid fid;
+ struct lu_fid fid;
struct mds_body *body;
struct lov_user_md *lump;
struct lov_mds_md *lmm;
struct ll_file_data *fd = LUSTRE_FPRIVATE(file);
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;
ENTRY;
&fd->fd_cwlockh);
}
- obdo.o_id = inode->i_ino;
- obdo.o_valid = OBD_MD_FLID;
- obdo_from_inode(&obdo, inode, OBD_MD_FLTYPE | OBD_MD_FLMODE |
- OBD_MD_FLSIZE | OBD_MD_FLBLOCKS |
- OBD_MD_FLATIME | OBD_MD_FLMTIME |
- OBD_MD_FLCTIME);
+ memset(&op_data, 0, sizeof(op_data));
+ op_data.fid1 = ll_i2info(inode)->lli_fid;
+ op_data.valid = OBD_MD_FLTYPE | OBD_MD_FLMODE |
+ OBD_MD_FLSIZE | OBD_MD_FLBLOCKS |
+ OBD_MD_FLATIME | OBD_MD_FLMTIME |
+ OBD_MD_FLCTIME;
+
+ op_data.atime = LTIME_S(inode->i_atime);
+ op_data.mtime = LTIME_S(inode->i_mtime);
+ op_data.ctime = LTIME_S(inode->i_ctime);
+ op_data.size = inode->i_size;
+ op_data.blocks = inode->i_blocks;
+ op_data.flags = inode->i_flags;
+
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. */
struct inode *inode = dentry->d_inode;
struct ll_inode_info *lli = ll_i2info(inode);
struct lov_stripe_md *lsm = lli->lli_smd;
- struct ll_fid fid;
+ struct lu_fid fid;
struct ptlrpc_request *req;
int rc, err;
ENTRY;
if (!ll_have_md_lock(dentry)) {
struct ptlrpc_request *req = NULL;
struct ll_sb_info *sbi = ll_i2sbi(dentry->d_inode);
- struct ll_fid fid;
+ struct lu_fid fid;
obd_valid valid = OBD_MD_FLGETATTR;
int ealen = 0;
struct ll_inode_info *lli = ll_i2info(inode);
ldlm_policy_data_t policy = { .l_extent = {0, OBD_OBJECT_EOF } };
struct lustre_handle lockh = { 0 };
+ struct mdc_op_data op_data;
struct obdo obdo;
obd_flag valid;
int rc, ast_flags = 0;
CERROR("unlock failed (%d)? proceeding anyways...\n", rc);
rpc:
- obdo.o_id = inode->i_ino;
- obdo.o_size = inode->i_size;
- obdo.o_blocks = inode->i_blocks;
- obdo.o_valid = OBD_MD_FLID | OBD_MD_FLSIZE | OBD_MD_FLBLOCKS;
+ op_data.fid1 = lli->lli_fid;
+ op_data.size = inode->i_size;
+ op_data.blocks = inode->i_blocks;
+ op_data.valid = OBD_MD_FLID | OBD_MD_FLSIZE | OBD_MD_FLBLOCKS;
- rc = mdc_done_writing(ll_i2sbi(inode)->ll_mdc_exp, &obdo);
+ rc = mdc_done_writing(ll_i2sbi(inode)->ll_mdc_exp, &op_data);
out:
}
#endif
/* allocates passed fid, that is assigns f_num and f_seq to the @fid */
int ll_fid_alloc(struct ll_sb_info *sbi, struct lu_fid *fid)
{
- ENTRY;
- RETURN(0);
+ ENTRY;
+ RETURN(0);
}
+/* build inode number on passed @fid */
+unsigned long ll_fid2ino(struct ll_sb_info *sbi, struct lu_fid *fid)
+{
+ ENTRY;
+ RETURN(0);
+}
struct obd_export *ll_mdc_exp;
struct obd_export *ll_osc_exp;
struct proc_dir_entry* ll_proc_root;
- struct ll_fid ll_root_fid; /* root object fid */
+ struct lu_fid ll_root_fid; /* root object fid */
int ll_flags;
struct list_head ll_conn_chain; /* per-conn chain of SBs */
return ll_s2mdcexp(inode->i_sb);
}
-static inline void ll_inode2fid(struct ll_fid *fid, struct inode *inode)
+static inline void ll_inode2fid(struct lu_fid *fid, struct inode *inode)
{
- mdc_pack_fid(fid, inode->i_ino, inode->i_generation,
- inode->i_mode & S_IFMT);
+ LASSERT(fid != NULL);
+ LASSERT(inode != NULL);
+ *fid = ll_i2info(inode)->lli_fid;
}
static inline int ll_mds_max_easize(struct super_block *sb)
/* llite/llite_fid.c*/
int ll_fid_alloc(struct ll_sb_info *sbi, struct lu_fid *fid);
+unsigned long ll_fid2ino(struct ll_sb_info *sbi, struct lu_fid *fid);
#endif /* LLITE_INTERNAL_H */
#include <linux/random.h>
#include <linux/version.h>
+#include <linux/lustre_idl.h>
#include <linux/lustre_lite.h>
#include <linux/lustre_ha.h>
#include <linux/lustre_ver.h>
struct inode *root = 0;
struct ll_sb_info *sbi = ll_s2sbi(sb);
struct obd_device *obd;
- struct ll_fid rootfid;
+ struct lu_fid rootfid;
struct obd_statfs osfs;
struct ptlrpc_request *request = NULL;
struct lustre_handle osc_conn = {0, };
CERROR("cannot mds_connect: rc = %d\n", err);
GOTO(out_osc, err);
}
- CDEBUG(D_SUPER, "rootfid "LPU64"\n", rootfid.id);
+ CDEBUG(D_SUPER, "rootfid "DFID3"\n", PFID3(&rootfid));
sbi->ll_root_fid = rootfid;
sb->s_op = &lustre_super_operations;
err = mdc_req2lustre_md(request, 0, sbi->ll_osc_exp, &md);
if (err) {
- CERROR("failed to understand root inode md: rc = %d\n",err);
+ CERROR("failed to understand root inode md: rc = %d\n", err);
ptlrpc_req_finished (request);
GOTO(out_osc, err);
}
- LASSERT(sbi->ll_root_fid.id != 0);
- root = ll_iget(sb, sbi->ll_root_fid.id, &md);
-
+ LASSERT(fid_oid(&sbi->ll_root_fid) != 0);
+ root = ll_iget(sb, ll_fid2ino(sbi, &sbi->ll_root_fid), &md);
+ ll_i2info(root)->lli_fid = sbi->ll_root_fid;
ptlrpc_req_finished(request);
if (root == NULL || is_bad_inode(root)) {
void ll_clear_inode(struct inode *inode)
{
- struct ll_fid fid;
+ struct lu_fid fid;
struct ll_inode_info *lli = ll_i2info(inode);
struct ll_sb_info *sbi = ll_i2sbi(inode);
ENTRY;
switch(cmd) {
case EXT3_IOC_GETFLAGS: {
- struct ll_fid fid;
+ struct lu_fid fid;
struct mds_body *body;
ll_inode2fid(&fid, inode);
struct ptlrpc_request *req, int offset,
struct super_block *sb)
{
- struct lustre_md md;
struct ll_sb_info *sbi = NULL;
+ struct lustre_md md;
int rc = 0;
ENTRY;
if (*inode) {
ll_update_inode(*inode, &md);
} else {
- LASSERT(sb);
- *inode = ll_iget(sb, md.body->ino, &md);
+ struct lu_fid fid;
+
+ LASSERT(sb != NULL);
+
+ rc = ll_fid_alloc(sbi, &fid);
+ if (rc) {
+ CERROR("cannot allocate new fid, rc %d\n",
+ rc);
+ mdc_free_lustre_md(exp, &md);
+ GOTO(out, rc);
+ }
+
+ *inode = ll_iget(sb, ll_fid2ino(sbi, &fid), &md);
if (*inode == NULL || is_bad_inode(*inode)) {
mdc_free_lustre_md(exp, &md);
rc = -ENOMEM;
CERROR("new_inode -fatal: rc %d\n", rc);
GOTO(out, rc);
}
-#if 0
- {
- struct ll_inode_info *lli;
-
- lli = ll_i2info(*inode);
- rc = ll_fid_alloc(sbi, lli->lli_fid);
- if (rc) {
- CERROR("cannot allocate new fid, rc %d\n",
- rc);
- mdc_free_lustre_md(exp, &md);
- GOTO(out, rc);
- }
- }
-#endif
+ ll_i2info(*inode)->lli_fid = fid;
}
rc = obd_checkmd(exp, ll_i2mdcexp(*inode),
return (key0 << 1);
}
+struct ll_ino {
+ unsigned long ino;
+ unsigned long gen;
+};
+
+#if 0
+
#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0))
static int ll_nfs_test_inode(struct inode *inode, unsigned long ino, void *opaque)
#else
static int ll_nfs_test_inode(struct inode *inode, void *opaque)
#endif
{
- struct ll_fid *iid = opaque;
+ struct ll_ino *iid = opaque;
- if (inode->i_ino == iid->id && inode->i_generation == iid->generation)
+ if (inode->i_ino == iid->ino && inode->i_generation == iid->gen)
return 1;
return 0;
}
+#endif
-static struct inode * search_inode_for_lustre(struct super_block *sb,
- unsigned long ino,
- unsigned long generation,
- int mode)
+static struct inode *search_inode_for_lustre(struct super_block *sb,
+ unsigned long ino,
+ unsigned long gen,
+ int mode)
{
- struct ptlrpc_request *req = NULL;
+#if 0
+ struct ll_ino iid = { .ino = ino, .gen = gen };
struct ll_sb_info *sbi = ll_s2sbi(sb);
- struct ll_fid fid;
+ struct ptlrpc_request *req = NULL;
+ struct inode *inode = NULL;
unsigned long valid = 0;
int eadatalen = 0, rc;
- struct inode *inode = NULL;
- struct ll_fid iid = { .id = ino, .generation = generation };
inode = ILOOKUP(sb, ino, ll_nfs_test_inode, &iid);
return ERR_PTR(rc);
valid |= OBD_MD_FLEASIZE;
}
- fid.id = (__u64)ino;
- fid.generation = generation;
- fid.f_type = mode;
- rc = mdc_getattr(sbi->ll_mdc_exp, &fid, valid, eadatalen, &req);
+ rc = mdc_getattr(sbi->ll_mdc_exp, iid,
+ valid, eadatalen, &req);
if (rc) {
- CERROR("failure %d inode %lu\n", rc, ino);
+ CERROR("failure %d fid "DFID3"\n", rc, PFID3(iid));
return ERR_PTR(rc);
}
ptlrpc_req_finished(req);
return inode;
+#endif
+ /* FIXME: this should be worked out later */
+ return NULL;
}
extern struct dentry_operations ll_d_ops;
return ERR_PTR(-ESTALE);
inode = search_inode_for_lustre(sb, ino, generation, mode);
- if (IS_ERR(inode)) {
+ if (IS_ERR(inode))
return ERR_PTR(PTR_ERR(inode));
- }
+
if (is_bad_inode(inode) ||
(generation && inode->i_generation != generation)){
/* we didn't find the right inode.. */
if (rc)
RETURN(rc);
- mdc_store_inode_generation(request, MDS_REQ_INTENT_REC_OFF, 1);
inode = ll_create_node(dir, dentry->d_name.name, dentry->d_name.len,
NULL, 0, mode, 0, it);
if (IS_ERR(inode)) {
{
struct ll_inode_info *lli = ll_i2info(inode);
struct ll_sb_info *sbi = ll_i2sbi(inode);
- struct ll_fid fid;
+ struct lu_fid fid;
struct mds_body *body;
int rc, symlen = inode->i_size + 1;
ENTRY;
{
struct ll_sb_info *sbi = ll_i2sbi(inode);
struct ptlrpc_request *req;
- struct ll_fid fid;
+ struct lu_fid fid;
int xattr_type, rc;
ENTRY;
struct ll_sb_info *sbi = ll_i2sbi(inode);
struct ptlrpc_request *req = NULL;
struct mds_body *body;
- struct ll_fid fid;
+ struct lu_fid fid;
void *xdata;
int xattr_type, rc;
ENTRY;
#include <linux/lustre_mdc.h>
void mdc_pack_req_body(struct ptlrpc_request *req, int offset,
- __u64 valid, struct ll_fid *fid, int ea_size);
+ __u64 valid, struct lu_fid *fid, int ea_size);
void mdc_pack_rep_body(struct ptlrpc_request *);
void mdc_readdir_pack(struct ptlrpc_request *req, int pos, __u64 offset,
- __u32 size, struct ll_fid *mdc_fid);
+ __u32 size, struct lu_fid *fid);
void mdc_getattr_pack(struct ptlrpc_request *req, int valid, int offset,
int flags, struct mdc_op_data *data);
void mdc_setattr_pack(struct ptlrpc_request *req, int offset,
void mdc_rename_pack(struct ptlrpc_request *req, int offset,
struct mdc_op_data *data,
const char *old, int oldlen, const char *new, int newlen);
-void mdc_close_pack(struct ptlrpc_request *req, int offset, struct obdo *oa,
+void mdc_close_pack(struct ptlrpc_request *req, int offset, struct mdc_op_data *op_data,
int valid, struct obd_client_handle *och);
struct mdc_open_data {
#endif
void mdc_readdir_pack(struct ptlrpc_request *req, int pos, __u64 offset,
- __u32 size, struct ll_fid *mdc_fid)
+ __u32 size, struct lu_fid *fid)
{
- struct mds_body *b;
+ struct mdt_body *b;
b = lustre_msg_buf(req->rq_reqmsg, pos, sizeof (*b));
b->fsuid = current->fsuid;
b->fsgid = current->fsgid;
b->capability = current->cap_effective;
- b->fid1 = *mdc_fid;
+ b->fid1 = *fid;
b->size = offset; /* !! */
b->suppgid = -1;
b->nlink = size; /* !! */
}
-static void mdc_pack_body(struct mds_body *b)
+static void mdc_pack_body(struct mdt_body *b)
{
LASSERT (b != NULL);
}
void mdc_pack_req_body(struct ptlrpc_request *req, int offset,
- __u64 valid, struct ll_fid *fid, int ea_size)
+ __u64 valid, struct lu_fid *fid, int ea_size)
{
- struct mds_body *b = lustre_msg_buf(req->rq_reqmsg, offset, sizeof(*b));
+ struct mdt_body *b = lustre_msg_buf(req->rq_reqmsg, offset, sizeof(*b));
if (fid)
b->fid1 = *fid;
__u32 mode, __u32 uid, __u32 gid, __u32 cap_effective,
__u64 rdev)
{
- struct mds_rec_create *rec;
+ struct mdt_rec_create *rec;
char *tmp;
rec = lustre_msg_buf(req->rq_reqmsg, offset, sizeof (*rec));
void mdc_join_pack(struct ptlrpc_request *req, int offset,
struct mdc_op_data *op_data, __u64 head_size)
{
- struct mds_rec_join *rec;
+ struct mdt_rec_join *rec;
rec = lustre_msg_buf(req->rq_reqmsg, offset, sizeof(*rec));
LASSERT(rec != NULL);
struct mdc_op_data *op_data, __u32 mode, __u64 rdev,
__u32 flags, const void *lmm, int lmmlen)
{
- struct mds_rec_create *rec;
+ struct mdt_rec_create *rec;
char *tmp;
rec = lustre_msg_buf(req->rq_reqmsg, offset, sizeof (*rec));
struct mdc_op_data *data, struct iattr *iattr,
void *ea, int ealen, void *ea2, int ea2len)
{
- struct mds_rec_setattr *rec = lustre_msg_buf(req->rq_reqmsg, offset,
+ struct mdt_rec_setattr *rec = lustre_msg_buf(req->rq_reqmsg, offset,
sizeof (*rec));
rec->sa_opcode = REINT_SETATTR;
rec->sa_fsuid = current->fsuid;
void mdc_unlink_pack(struct ptlrpc_request *req, int offset,
struct mdc_op_data *data)
{
- struct mds_rec_unlink *rec;
+ struct mdt_rec_unlink *rec;
char *tmp;
rec = lustre_msg_buf(req->rq_reqmsg, offset, sizeof (*rec));
void mdc_link_pack(struct ptlrpc_request *req, int offset,
struct mdc_op_data *data)
{
- struct mds_rec_link *rec;
+ struct mdt_rec_link *rec;
char *tmp;
rec = lustre_msg_buf(req->rq_reqmsg, offset, sizeof (*rec));
struct mdc_op_data *data,
const char *old, int oldlen, const char *new, int newlen)
{
- struct mds_rec_rename *rec;
+ struct mdt_rec_rename *rec;
char *tmp;
rec = lustre_msg_buf(req->rq_reqmsg, offset, sizeof (*rec));
void mdc_getattr_pack(struct ptlrpc_request *req, int offset, int valid,
int flags, struct mdc_op_data *data)
{
- struct mds_body *b;
+ struct mdt_body *b;
b = lustre_msg_buf(req->rq_reqmsg, offset, sizeof (*b));
b->fsuid = current->fsuid;
}
}
-void mdc_close_pack(struct ptlrpc_request *req, int offset, struct obdo *oa,
- int valid, struct obd_client_handle *och)
+void mdc_close_pack(struct ptlrpc_request *req, int offset,
+ struct mdc_op_data *op_data, int valid,
+ struct obd_client_handle *och)
{
- struct mds_body *body;
+ struct mdt_body *body;
body = lustre_msg_buf(req->rq_reqmsg, 0, sizeof(*body));
- mdc_pack_fid(&body->fid1, oa->o_id, 0, oa->o_mode);
+ body->fid1 = op_data->fid1;
memcpy(&body->handle, &och->och_fh, sizeof(body->handle));
- if (oa->o_valid & OBD_MD_FLATIME) {
- body->atime = oa->o_atime;
+ if (op_data->valid & OBD_MD_FLATIME) {
+ body->atime = op_data->atime;
body->valid |= OBD_MD_FLATIME;
}
- if (oa->o_valid & OBD_MD_FLMTIME) {
- body->mtime = oa->o_mtime;
+ if (op_data->valid & OBD_MD_FLMTIME) {
+ body->mtime = op_data->mtime;
body->valid |= OBD_MD_FLMTIME;
}
- if (oa->o_valid & OBD_MD_FLCTIME) {
- body->ctime = oa->o_ctime;
+ if (op_data->valid & OBD_MD_FLCTIME) {
+ body->ctime = op_data->ctime;
body->valid |= OBD_MD_FLCTIME;
}
- if (oa->o_valid & OBD_MD_FLSIZE) {
- body->size = oa->o_size;
+ if (op_data->valid & OBD_MD_FLSIZE) {
+ body->size = op_data->size;
body->valid |= OBD_MD_FLSIZE;
}
- if (oa->o_valid & OBD_MD_FLBLOCKS) {
- body->blocks = oa->o_blocks;
+ if (op_data->valid & OBD_MD_FLBLOCKS) {
+ body->blocks = op_data->blocks;
body->valid |= OBD_MD_FLBLOCKS;
}
- if (oa->o_valid & OBD_MD_FLFLAGS) {
- body->flags = oa->o_flags;
+ if (op_data->valid & OBD_MD_FLFLAGS) {
+ body->flags = op_data->flags;
body->valid |= OBD_MD_FLFLAGS;
}
}
}
EXPORT_SYMBOL(mdc_set_lock_data);
-int mdc_change_cbdata(struct obd_export *exp, struct ll_fid *fid,
+int mdc_change_cbdata(struct obd_export *exp, struct lu_fid *fid,
ldlm_iterator_t it, void *data)
{
struct ldlm_res_id res_id = { .name = {0} };
ENTRY;
- res_id.name[0] = fid->id;
- res_id.name[1] = fid->generation;
+ res_id.name[0] = fid_seq(fid);
+ res_id.name[1] = fid_num(fid);
- ldlm_change_cbdata(class_exp2obd(exp)->obd_namespace, &res_id, it,
- data);
+ ldlm_change_cbdata(class_exp2obd(exp)->obd_namespace,
+ &res_id, it, data);
EXIT;
return 0;
* but this is incredibly unlikely, and questionable whether the client
* could do MDS recovery under OOM anyways... */
static void mdc_realloc_openmsg(struct ptlrpc_request *req,
- struct mds_body *body, int size[5])
+ struct mdt_body *body, int size[5])
{
int new_size, old_size;
struct lustre_msg *new_msg;
struct ptlrpc_request *req;
struct obd_device *obddev = class_exp2obd(exp);
struct ldlm_res_id res_id =
- { .name = {data->fid1.id, data->fid1.generation} };
+ { .name = {fid_seq(&data->fid1), fid_num(&data->fid1)} };
ldlm_policy_data_t policy = { .l_inodebits = { MDS_INODELOCK_LOOKUP } };
struct ldlm_request *lockreq;
struct ldlm_intent *lit;
[MDS_REQ_INTENT_IT_OFF] = sizeof(*lit) };
struct ldlm_reply *dlm_rep;
int repsize[4] = {sizeof(*dlm_rep),
- sizeof(struct mds_body),
+ sizeof(struct mdt_body),
obddev->u.cli.cl_max_mds_easize};
void *eadata;
unsigned long irqflags;
if (it->it_op & IT_OPEN) {
it->it_create_mode |= S_IFREG;
- size[req_buffers++] = sizeof(struct mds_rec_create);
+ size[req_buffers++] = sizeof(struct mdt_rec_create);
size[req_buffers++] = data->namelen + 1;
/* As an optimization, we allocate an RPC request buffer for
* at least a default-sized LOV EA even if we aren't sending
/* join is like an unlink of the tail */
policy.l_inodebits.bits = MDS_INODELOCK_UPDATE;
- size[req_buffers++] = sizeof(struct mds_rec_join);
+ size[req_buffers++] = sizeof(struct mdt_rec_join);
req = ptlrpc_prep_req(class_exp2cliimp(exp),
LUSTRE_DLM_VERSION, LDLM_ENQUEUE,
req_buffers, size, NULL);
repsize[repbufcnt++] = LUSTRE_POSIX_ACL_MAX_SIZE;
} else if (it->it_op & IT_UNLINK) {
- size[req_buffers++] = sizeof(struct mds_rec_unlink);
+ size[req_buffers++] = sizeof(struct mdt_rec_unlink);
size[req_buffers++] = data->namelen + 1;
policy.l_inodebits.bits = MDS_INODELOCK_UPDATE;
req = ptlrpc_prep_req(class_exp2cliimp(exp), LUSTRE_DLM_VERSION,
} else if (it->it_op & (IT_GETATTR | IT_LOOKUP)) {
obd_valid valid = OBD_MD_FLGETATTR | OBD_MD_FLEASIZE |
OBD_MD_FLACL | OBD_MD_FLMODEASIZE;
- size[req_buffers++] = sizeof(struct mds_body);
+ size[req_buffers++] = sizeof(struct mdt_body);
size[req_buffers++] = data->namelen + 1;
if (it->it_op & IT_GETATTR)
/* We know what to expect, so we do any byte flipping required here */
LASSERT(repbufcnt == 4 || repbufcnt == 1);
if (repbufcnt == 4) {
- struct mds_body *body;
+ struct mdt_body *body;
body = lustre_swab_repbuf(req, 1, sizeof (*body),
- lustre_swab_mds_body);
+ lustre_swab_mdt_body);
if (body == NULL) {
- CERROR ("Can't swab mds_body\n");
+ CERROR ("Can't swab mdt_body\n");
RETURN (-EPROTO);
}
struct lustre_handle lockh;
struct ptlrpc_request *request;
int rc = 0;
- struct mds_body *mds_body;
+ struct mdt_body *mdt_body;
struct lustre_handle old_lock;
struct ldlm_lock *lock;
ENTRY;
LASSERT(it);
- CDEBUG(D_DLMTRACE,"name: %.*s in inode "LPU64", intent: %s flags %#o\n",
- op_data->namelen, op_data->name, op_data->fid1.id,
+ CDEBUG(D_DLMTRACE,"name: %.*s in obj "DFID3", intent: %s flags %#o\n",
+ op_data->namelen, op_data->name, PFID3(&op_data->fid1),
ldlm_it2str(it->it_op), it->it_flags);
- if (op_data->fid2.id &&
+ if (fid_num(&op_data->fid2) &&
(it->it_op == IT_LOOKUP || it->it_op == IT_GETATTR)) {
/* We could just return 1 immediately, but since we should only
* be called in revalidate_it if we already have a lock, let's
* verify that. */
- struct ldlm_res_id res_id = {.name ={op_data->fid2.id,
- op_data->fid2.generation}};
+ struct ldlm_res_id res_id = { .name = { fid_seq(&op_data->fid2),
+ fid_num(&op_data->fid2) } };
struct lustre_handle lockh;
ldlm_policy_data_t policy;
int mode = LCK_CR;
if (rc < 0)
RETURN(rc);
memcpy(&it->d.lustre.it_lock_handle, &lockh, sizeof(lockh));
- } else if (!op_data->fid2.id) {
+ } else if (!fid_num(&op_data->fid2)) {
/* DISP_ENQ_COMPLETE set means there is extra reference on
* request referenced from this intent, saved for subsequent
* lookup. This path is executed when we proceed to this
if (rc)
RETURN(rc);
- mds_body = lustre_msg_buf(request->rq_repmsg, 1, sizeof(*mds_body));
- LASSERT(mds_body != NULL); /* mdc_enqueue checked */
+ mdt_body = lustre_msg_buf(request->rq_repmsg, 1, sizeof(*mdt_body));
+ LASSERT(mdt_body != NULL); /* mdc_enqueue checked */
LASSERT_REPSWABBED(request, 1); /* mdc_enqueue swabbed */
/* If we were revalidating a fid/name pair, mark the intent in
* case we fail and get called again from lookup */
- if (op_data->fid2.id) {
+ if (fid_num(&op_data->fid2)) {
it_set_disposition(it, DISP_ENQ_COMPLETE);
/* Also: did we find the same inode? */
- if (memcmp(&op_data->fid2, &mds_body->fid1, sizeof(op_data->fid2)))
+ if (memcmp(&op_data->fid2, &mdt_body->fid1, sizeof(op_data->fid2)))
RETURN(-ESTALE);
}
mdc_put_rpc_lock(rpc_lock, NULL);
if (rc)
CDEBUG(D_INFO, "error in handling %d\n", rc);
- else if (!lustre_swab_repbuf(request, 0, sizeof(struct mds_body),
- lustre_swab_mds_body)) {
- CERROR ("Can't unpack mds_body\n");
+ else if (!lustre_swab_repbuf(request, 0, sizeof(struct mdt_body),
+ lustre_swab_mdt_body)) {
+ CERROR ("Can't unpack mdt_body\n");
rc = -EPROTO;
}
return rc;
struct ptlrpc_request **request)
{
struct ptlrpc_request *req;
- struct mds_rec_setattr *rec;
+ struct mdt_rec_setattr *rec;
struct mdc_rpc_lock *rpc_lock;
struct obd_device *obd = exp->exp_obd;
int size[] = { sizeof(*rec), ealen, ea2len};
LTIME_S(iattr->ia_mtime), LTIME_S(iattr->ia_ctime));
mdc_setattr_pack(req, MDS_REQ_REC_OFF, data, iattr, ea, ealen, ea2, ea2len);
- size[0] = sizeof(struct mds_body);
+ size[0] = sizeof(struct mdt_body);
req->rq_replen = lustre_msg_size(1, size);
rc = mdc_reint(req, rpc_lock, LUSTRE_IMP_FULL);
{
struct obd_device *obd = exp->exp_obd;
struct ptlrpc_request *req;
- int size[] = { sizeof(struct mds_rec_create), op_data->namelen + 1, 0};
+ int size[] = { sizeof(struct mdt_rec_create), op_data->namelen + 1, 0};
int rc, level, bufcount = 2;
ENTRY;
mdc_create_pack(req, MDS_REQ_REC_OFF, op_data, data, datalen, mode,
uid, gid, cap_effective, rdev);
- size[0] = sizeof(struct mds_body);
+ size[0] = sizeof(struct mdt_body);
req->rq_replen = lustre_msg_size(1, size);
level = LUSTRE_IMP_FULL;
goto resend;
}
- if (!rc)
- mdc_store_inode_generation(req, 0, 0);
-
*request = req;
RETURN(rc);
}
{
struct obd_device *obd = class_exp2obd(exp);
struct ptlrpc_request *req = *request;
- int rc, size[] = { sizeof(struct mds_rec_unlink), data->namelen + 1};
+ int rc, size[] = { sizeof(struct mdt_rec_unlink), data->namelen + 1};
ENTRY;
LASSERT(req == NULL);
RETURN(-ENOMEM);
*request = req;
- size[0] = sizeof(struct mds_body);
+ size[0] = sizeof(struct mdt_body);
size[1] = obd->u.cli.cl_max_mds_easize;
size[2] = obd->u.cli.cl_max_mds_cookiesize;
req->rq_replen = lustre_msg_size(3, size);
{
struct obd_device *obd = exp->exp_obd;
struct ptlrpc_request *req;
- int rc, size[] = { sizeof(struct mds_rec_link), data->namelen + 1};
+ int rc, size[] = { sizeof(struct mdt_rec_link), data->namelen + 1};
ENTRY;
req = ptlrpc_prep_req(class_exp2cliimp(exp), LUSTRE_MDS_VERSION,
mdc_link_pack(req, MDS_REQ_REC_OFF, data);
- size[0] = sizeof(struct mds_body);
+ size[0] = sizeof(struct mdt_body);
req->rq_replen = lustre_msg_size(1, size);
rc = mdc_reint(req, obd->u.cli.cl_rpc_lock, LUSTRE_IMP_FULL);
{
struct obd_device *obd = exp->exp_obd;
struct ptlrpc_request *req;
- int rc, size[] = { sizeof(struct mds_rec_rename), oldlen +1, newlen +1};
+ int rc, size[] = { sizeof(struct mdt_rec_rename), oldlen +1, newlen +1};
ENTRY;
req = ptlrpc_prep_req(class_exp2cliimp(exp), LUSTRE_MDS_VERSION,
mdc_rename_pack(req, MDS_REQ_REC_OFF, data, old, oldlen, new, newlen);
- size[0] = sizeof(struct mds_body);
+ size[0] = sizeof(struct mdt_body);
size[1] = obd->u.cli.cl_max_mds_easize;
size[2] = obd->u.cli.cl_max_mds_cookiesize;
req->rq_replen = lustre_msg_size(3, size);
extern int mds_queue_req(struct ptlrpc_request *);
/* Helper that implements most of mdc_getstatus and signal_completed_replay. */
/* XXX this should become mdc_get_info("key"), sending MDS_GET_INFO RPC */
-static int send_getstatus(struct obd_import *imp, struct ll_fid *rootfid,
+static int send_getstatus(struct obd_import *imp, struct lu_fid *rootfid,
int level, int msg_flags)
{
struct ptlrpc_request *req;
- int rc, size[] = { [MDS_REQ_REC_OFF] = sizeof(struct mds_body) };
+ int rc, size[] = { [MDS_REQ_REC_OFF] = sizeof(struct mdt_body) };
ENTRY;
req = ptlrpc_prep_req(imp, LUSTRE_MDS_VERSION, MDS_GETSTATUS,
rc = ptlrpc_queue_wait(req);
if (!rc) {
- struct mds_body *body;
+ struct mdt_body *body;
body = lustre_swab_repbuf(req, 0, sizeof(*body),
- lustre_swab_mds_body);
+ lustre_swab_mdt_body);
if (body == NULL) {
- CERROR ("Can't extract mds_body\n");
+ CERROR ("Can't extract mdt_body\n");
GOTO (out, rc = -EPROTO);
}
memcpy(rootfid, &body->fid1, sizeof(*rootfid));
- CDEBUG(D_NET, "root ino="LPU64", last_committed="LPU64
+ CDEBUG(D_NET, "root fid="DFID3", last_committed="LPU64
", last_xid="LPU64"\n",
- rootfid->id, req->rq_repmsg->last_committed,
+ PFID3(rootfid), req->rq_repmsg->last_committed,
req->rq_repmsg->last_xid);
}
}
/* This should be mdc_get_info("rootfid") */
-int mdc_getstatus(struct obd_export *exp, struct ll_fid *rootfid)
+int mdc_getstatus(struct obd_export *exp, struct lu_fid *rootfid)
{
return send_getstatus(class_exp2cliimp(exp), rootfid, LUSTRE_IMP_FULL,
0);
int mdc_getattr_common(struct obd_export *exp, unsigned int ea_size,
unsigned int acl_size, struct ptlrpc_request *req)
{
- struct mds_body *body;
+ struct mdt_body *body;
void *eadata;
int rc;
int size[3] = {sizeof(*body)};
RETURN (rc);
body = lustre_swab_repbuf (req, 0, sizeof (*body),
- lustre_swab_mds_body);
+ lustre_swab_mdt_body);
if (body == NULL) {
- CERROR ("Can't unpack mds_body\n");
+ CERROR ("Can't unpack mdt_body\n");
RETURN (-EPROTO);
}
RETURN (0);
}
-int mdc_getattr(struct obd_export *exp, struct ll_fid *fid,
+int mdc_getattr(struct obd_export *exp, struct lu_fid *fid,
obd_valid valid, unsigned int ea_size,
struct ptlrpc_request **request)
{
struct ptlrpc_request *req;
- struct mds_body *body;
+ struct mdt_body *body;
int size = sizeof(*body);
int acl_size = 0, rc;
ENTRY;
RETURN (rc);
}
-int mdc_getattr_name(struct obd_export *exp, struct ll_fid *fid,
+int mdc_getattr_name(struct obd_export *exp, struct lu_fid *fid,
const char *filename, int namelen, unsigned long valid,
unsigned int ea_len, struct ptlrpc_request **request)
{
struct ptlrpc_request *req;
- int rc, size[] = { sizeof(struct mds_body), namelen };
+ int rc, size[] = { sizeof(struct mdt_body), namelen };
ENTRY;
req = ptlrpc_prep_req(class_exp2cliimp(exp), LUSTRE_MDS_VERSION,
}
static
-int mdc_xattr_common(struct obd_export *exp, struct ll_fid *fid,
+int mdc_xattr_common(struct obd_export *exp, struct lu_fid *fid,
int opcode, obd_valid valid, const char *xattr_name,
const char *input, int input_size, int output_size,
int flags, struct ptlrpc_request **request)
{
struct ptlrpc_request *req;
- struct mds_body *body;
+ struct mdt_body *body;
int size[3] = {sizeof(*body)}, bufcnt = 1;
int xattr_namelen = 0, rc;
void *tmp;
if (opcode == MDS_GETXATTR) {
body = lustre_swab_repbuf(req, 0, sizeof(*body),
- lustre_swab_mds_body);
+ lustre_swab_mdt_body);
if (body == NULL) {
- CERROR ("Can't unpack mds_body\n");
+ CERROR ("Can't unpack mdt_body\n");
GOTO(err_out, rc = -EPROTO);
}
}
goto out;
}
-int mdc_setxattr(struct obd_export *exp, struct ll_fid *fid,
+int mdc_setxattr(struct obd_export *exp, struct lu_fid *fid,
obd_valid valid, const char *xattr_name,
const char *input, int input_size,
int output_size, int flags,
input, input_size, output_size, flags, request);
}
-int mdc_getxattr(struct obd_export *exp, struct ll_fid *fid,
+int mdc_getxattr(struct obd_export *exp, struct lu_fid *fid,
obd_valid valid, const char *xattr_name,
const char *input, int input_size,
int output_size, struct ptlrpc_request **request)
input, input_size, output_size, 0, request);
}
-/* This should be called with both the request and the reply still packed. */
-void mdc_store_inode_generation(struct ptlrpc_request *req, int reqoff,
- int repoff)
-{
- struct mds_rec_create *rec = lustre_msg_buf(req->rq_reqmsg, reqoff,
- sizeof(*rec));
- struct mds_body *body = lustre_msg_buf(req->rq_repmsg, repoff,
- sizeof(*body));
-
- LASSERT (rec != NULL);
- LASSERT (body != NULL);
-
- memcpy(&rec->cr_replayfid, &body->fid1, sizeof rec->cr_replayfid);
- if (body->fid1.id == 0) {
- DEBUG_REQ(D_ERROR, req, "saving replay request with id = 0 "
- "gen = %u", body->fid1.generation);
- LBUG();
- }
-
- DEBUG_REQ(D_HA, req, "storing generation %u for ino "LPU64,
- rec->cr_replayfid.generation, rec->cr_replayfid.id);
-}
-
#ifdef CONFIG_FS_POSIX_ACL
static
int mdc_unpack_acl(struct obd_export *exp, struct ptlrpc_request *req,
struct lustre_md *md, unsigned int offset)
{
- struct mds_body *body = md->body;
+ struct mdt_body *body = md->body;
struct posix_acl *acl;
void *buf;
int rc;
struct obd_client_handle *och;
struct ptlrpc_request *close_req;
struct lustre_handle old;
- struct mds_body *body;
+ struct mdt_body *body;
ENTRY;
- body = lustre_swab_repbuf(req, 1, sizeof(*body), lustre_swab_mds_body);
+ body = lustre_swab_repbuf(req, 1, sizeof(*body), lustre_swab_mdt_body);
LASSERT (body != NULL);
if (mod == NULL) {
close_req = mod->mod_close_req;
if (close_req != NULL) {
- struct mds_body *close_body;
+ struct mdt_body *close_body;
LASSERT(close_req->rq_reqmsg->opc == MDS_CLOSE);
close_body = lustre_msg_buf(close_req->rq_reqmsg,
MDS_REQ_REC_OFF,
struct ptlrpc_request *open_req)
{
struct mdc_open_data *mod;
- struct mds_rec_create *rec = lustre_msg_buf(open_req->rq_reqmsg,
+ struct mdt_rec_create *rec = lustre_msg_buf(open_req->rq_reqmsg,
MDS_REQ_INTENT_REC_OFF,
sizeof(*rec));
- struct mds_body *body = lustre_msg_buf(open_req->rq_repmsg, 1,
+ struct mdt_body *body = lustre_msg_buf(open_req->rq_repmsg, 1,
sizeof(*body));
LASSERT(body != NULL);
open_req->rq_replay_cb = mdc_replay_open;
open_req->rq_commit_cb = mdc_commit_open;
open_req->rq_cb_data = mod;
- if (body->fid1.id == 0) {
- DEBUG_REQ(D_ERROR, open_req, "saving replay request with "
- "id = 0 gen = %u", body->fid1.generation);
- LBUG();
- }
DEBUG_REQ(D_HA, open_req, "set up replay data");
}
spin_unlock(&open_req->rq_lock);
}
-int mdc_close(struct obd_export *exp, struct obdo *oa,
+int mdc_close(struct obd_export *exp, struct mdc_op_data *op_data,
struct obd_client_handle *och, struct ptlrpc_request **request)
{
struct obd_device *obd = class_exp2obd(exp);
- int size[] = { sizeof(struct mds_body) };
- int rc, repsize[] = { sizeof(struct mds_body),
+ int size[] = { sizeof(struct mdt_body) };
+ int rc, repsize[] = { sizeof(struct mdt_body),
obd->u.cli.cl_max_mds_easize,
obd->u.cli.cl_max_mds_cookiesize};
struct ptlrpc_request *req;
CDEBUG(D_HA, "couldn't find open req; expecting close error\n");
}
- mdc_close_pack(req, MDS_REQ_REC_OFF, oa, oa->o_valid, och);
+ mdc_close_pack(req, MDS_REQ_REC_OFF, op_data, op_data->valid, och);
req->rq_replen = lustre_msg_size(3, repsize);
req->rq_commit_cb = mdc_commit_close;
CERROR("Unexpected: can't find mdc_open_data, but the "
"close succeeded. Please tell CFS.\n");
}
- if (!lustre_swab_repbuf(req, 0, sizeof(struct mds_body),
- lustre_swab_mds_body)) {
- CERROR("Error unpacking mds_body\n");
+ if (!lustre_swab_repbuf(req, 0, sizeof(struct mdt_body),
+ lustre_swab_mdt_body)) {
+ CERROR("Error unpacking mdt_body\n");
rc = -EPROTO;
}
}
return rc;
}
-int mdc_done_writing(struct obd_export *exp, struct obdo *obdo)
+int mdc_done_writing(struct obd_export *exp, struct mdc_op_data *op_data)
{
struct ptlrpc_request *req;
- struct mds_body *body;
+ struct mdt_body *body;
int rc, size[] = { [MDS_REQ_REC_OFF] = sizeof(*body) };
ENTRY;
RETURN(-ENOMEM);
body = lustre_msg_buf(req->rq_reqmsg, MDS_REQ_REC_OFF, sizeof(*body));
- mdc_pack_fid(&body->fid1, obdo->o_id, 0, obdo->o_mode);
- body->size = obdo->o_size;
- body->blocks = obdo->o_blocks;
- body->flags = obdo->o_flags;
- body->valid = obdo->o_valid;
-// memcpy(&body->handle, &och->och_fh, sizeof(body->handle));
+ body->fid1 = op_data->fid1;
+ body->size = op_data->size;
+ body->blocks = op_data->blocks;
+ body->flags = op_data->flags;
+ body->valid = op_data->valid;
req->rq_replen = lustre_msg_size(1, size);
RETURN(rc);
}
-int mdc_readpage(struct obd_export *exp, struct ll_fid *fid, __u64 offset,
+int mdc_readpage(struct obd_export *exp, struct lu_fid *fid, __u64 offset,
struct page *page, struct ptlrpc_request **request)
{
struct obd_import *imp = class_exp2cliimp(exp);
struct ptlrpc_request *req = NULL;
struct ptlrpc_bulk_desc *desc = NULL;
- struct mds_body *body;
+ struct mdt_body *body;
int rc, size[] = { sizeof(*body) };
ENTRY;
- CDEBUG(D_INODE, "inode: "LPU64"\n", fid->id);
+ CDEBUG(D_INODE, "object: "DFID3"\n", PFID3(fid));
req = ptlrpc_prep_req(imp, LUSTRE_MDS_VERSION, MDS_READPAGE,
1, size, NULL);
if (rc == 0) {
body = lustre_swab_repbuf(req, 0, sizeof (*body),
- lustre_swab_mds_body);
+ lustre_swab_mdt_body);
if (body == NULL) {
- CERROR("Can't unpack mds_body\n");
+ CERROR("Can't unpack mdt_body\n");
GOTO(out, rc = -EPROTO);
}
return rc;
}
-static int mdc_pin(struct obd_export *exp, obd_id ino, __u32 gen, int type,
+static int mdc_pin(struct obd_export *exp, struct lu_fid *fid,
struct obd_client_handle *handle, int flag)
{
struct ptlrpc_request *req;
- struct mds_body *body;
- int rc, size[] = { [MDS_REQ_REC_OFF] = sizeof(struct mds_body) };
+ struct mdt_body *body;
+ int rc, size[] = { [MDS_REQ_REC_OFF] = sizeof(struct mdt_body) };
ENTRY;
req = ptlrpc_prep_req(class_exp2cliimp(exp), LUSTRE_MDS_VERSION,
RETURN(-ENOMEM);
body = lustre_msg_buf(req->rq_reqmsg, MDS_REQ_REC_OFF, sizeof (*body));
- mdc_pack_fid(&body->fid1, ino, gen, type);
+ body->fid1 = *fid;
body->flags = flag;
req->rq_replen = lustre_msg_size(1, size);
RETURN(rc);
}
- body = lustre_swab_repbuf(req, 0, sizeof(*body), lustre_swab_mds_body);
+ body = lustre_swab_repbuf(req, 0, sizeof(*body), lustre_swab_mdt_body);
if (body == NULL) {
ptlrpc_req_finished(req);
RETURN(rc);
struct obd_client_handle *handle, int flag)
{
struct ptlrpc_request *req;
- struct mds_body *body;
- int rc, size[] = { [MDS_REQ_REC_OFF] = sizeof(struct mds_body) };
+ struct mdt_body *body;
+ int rc, size[] = { [MDS_REQ_REC_OFF] = sizeof(struct mdt_body) };
ENTRY;
if (handle->och_magic != OBD_CLIENT_HANDLE_MAGIC)
RETURN(rc);
}
-int mdc_sync(struct obd_export *exp, struct ll_fid *fid,
+int mdc_sync(struct obd_export *exp, struct lu_fid *fid,
struct ptlrpc_request **request)
{
struct ptlrpc_request *req;
- int rc, size[] = { [MDS_REQ_REC_OFF] = sizeof(struct mds_body) };
+ int rc, size[] = { [MDS_REQ_REC_OFF] = sizeof(struct mdt_body) };
ENTRY;
req = ptlrpc_prep_req(class_exp2cliimp(exp), LUSTRE_MDS_VERSION,
EXPORT_SYMBOL(mdc_sync);
EXPORT_SYMBOL(mdc_set_open_replay_data);
EXPORT_SYMBOL(mdc_clear_open_replay_data);
-EXPORT_SYMBOL(mdc_store_inode_generation);
EXPORT_SYMBOL(mdc_init_ea_size);
EXPORT_SYMBOL(mdc_getxattr);
EXPORT_SYMBOL(mdc_setxattr);
mds_pack_inode2body(body, inode);
}
+static inline void mds_pack_fid(struct ll_fid *fid, obd_id ino, __u32 gen, int type)
+{
+ fid->id = ino;
+ fid->generation = gen;
+ fid->f_type = type;
+}
+
static int mds_join_unlink_tail_inode(struct mds_update_record *rec,
struct ptlrpc_request *req,
struct mds_rec_join *join_rec,
ldlm_lock_decref(lockh, LCK_EX);
head_inode = dchild->d_inode;
- mdc_pack_fid(&head_fid, head_inode->i_ino, head_inode->i_generation,
- head_inode->i_mode & S_IFMT);
+ mds_pack_fid(&head_fid, head_inode->i_ino, head_inode->i_generation,
+ head_inode->i_mode & S_IFMT);
rc = mds_get_parents_children_locked(obd, mds, &join_rec->jr_fid,
&de_tailparent, &head_fid,
void lustre_swab_lu_fid(struct lu_fid *fid)
{
__swab64s (&fid->f_seq);
- __swab64s (&fid->f_num);
+ __swab32s (&fid->f_oid);
+ __swab32s (&fid->f_ver);
}
EXPORT_SYMBOL(lustre_swab_lu_fid);
CLASSERT(offsetof(typeof(*sa), sa_padding) != 0);
}
+void lustre_swab_mdt_rec_setattr (struct mdt_rec_setattr *sa)
+{
+ __swab32s (&sa->sa_opcode);
+ __swab32s (&sa->sa_fsuid);
+ __swab32s (&sa->sa_fsgid);
+ __swab32s (&sa->sa_cap);
+ __swab32s (&sa->sa_suppgid);
+ __swab32s (&sa->sa_mode);
+ lustre_swab_lu_fid (&sa->sa_fid);
+ __swab64s (&sa->sa_valid);
+ __swab64s (&sa->sa_size);
+ __swab64s (&sa->sa_mtime);
+ __swab64s (&sa->sa_atime);
+ __swab64s (&sa->sa_ctime);
+ __swab32s (&sa->sa_uid);
+ __swab32s (&sa->sa_gid);
+ __swab32s (&sa->sa_attr_flags);
+ CLASSERT(offsetof(typeof(*sa), sa_padding) != 0);
+}
+
void lustre_swab_mds_rec_join (struct mds_rec_join *jr)
{
__swab64s(&jr->jr_headsize);
lustre_swab_ll_fid(&jr->jr_fid);
}
+void lustre_swab_mdt_rec_join (struct mdt_rec_join *jr)
+{
+ __swab64s(&jr->jr_headsize);
+ lustre_swab_lu_fid(&jr->jr_fid);
+}
+
void lustre_swab_mds_rec_create (struct mds_rec_create *cr)
{
__swab32s (&cr->cr_opcode);
CLASSERT(offsetof(typeof(*cr), cr_padding_5) != 0);
}
+void lustre_swab_mdt_rec_create (struct mdt_rec_create *cr)
+{
+ __swab32s (&cr->cr_opcode);
+ __swab32s (&cr->cr_fsuid);
+ __swab32s (&cr->cr_fsgid);
+ __swab32s (&cr->cr_cap);
+ __swab32s (&cr->cr_flags); /* for use with open */
+ __swab32s (&cr->cr_mode);
+ lustre_swab_lu_fid (&cr->cr_fid);
+ lustre_swab_lu_fid (&cr->cr_replayfid);
+ __swab64s (&cr->cr_time);
+ __swab64s (&cr->cr_rdev);
+ __swab32s (&cr->cr_suppgid);
+ CLASSERT(offsetof(typeof(*cr), cr_padding_1) != 0);
+ CLASSERT(offsetof(typeof(*cr), cr_padding_2) != 0);
+ CLASSERT(offsetof(typeof(*cr), cr_padding_3) != 0);
+ CLASSERT(offsetof(typeof(*cr), cr_padding_4) != 0);
+ CLASSERT(offsetof(typeof(*cr), cr_padding_5) != 0);
+}
+
void lustre_swab_mds_rec_link (struct mds_rec_link *lk)
{
__swab32s (&lk->lk_opcode);
CLASSERT(offsetof(typeof(*lk), lk_padding_4) != 0);
}
+void lustre_swab_mdt_rec_link (struct mdt_rec_link *lk)
+{
+ __swab32s (&lk->lk_opcode);
+ __swab32s (&lk->lk_fsuid);
+ __swab32s (&lk->lk_fsgid);
+ __swab32s (&lk->lk_cap);
+ __swab32s (&lk->lk_suppgid1);
+ __swab32s (&lk->lk_suppgid2);
+ lustre_swab_lu_fid (&lk->lk_fid1);
+ lustre_swab_lu_fid (&lk->lk_fid2);
+ __swab64s (&lk->lk_time);
+ CLASSERT(offsetof(typeof(*lk), lk_padding_1) != 0);
+ CLASSERT(offsetof(typeof(*lk), lk_padding_2) != 0);
+ CLASSERT(offsetof(typeof(*lk), lk_padding_3) != 0);
+ CLASSERT(offsetof(typeof(*lk), lk_padding_4) != 0);
+}
+
void lustre_swab_mds_rec_unlink (struct mds_rec_unlink *ul)
{
__swab32s (&ul->ul_opcode);
CLASSERT(offsetof(typeof(*ul), ul_padding_4) != 0);
}
+void lustre_swab_mdt_rec_unlink (struct mdt_rec_unlink *ul)
+{
+ __swab32s (&ul->ul_opcode);
+ __swab32s (&ul->ul_fsuid);
+ __swab32s (&ul->ul_fsgid);
+ __swab32s (&ul->ul_cap);
+ __swab32s (&ul->ul_suppgid);
+ __swab32s (&ul->ul_mode);
+ lustre_swab_lu_fid (&ul->ul_fid1);
+ lustre_swab_lu_fid (&ul->ul_fid2);
+ __swab64s (&ul->ul_time);
+ CLASSERT(offsetof(typeof(*ul), ul_padding_1) != 0);
+ CLASSERT(offsetof(typeof(*ul), ul_padding_2) != 0);
+ CLASSERT(offsetof(typeof(*ul), ul_padding_3) != 0);
+ CLASSERT(offsetof(typeof(*ul), ul_padding_4) != 0);
+}
+
void lustre_swab_mds_rec_rename (struct mds_rec_rename *rn)
{
__swab32s (&rn->rn_opcode);
CLASSERT(offsetof(typeof(*rn), rn_padding_4) != 0);
}
+void lustre_swab_mdt_rec_rename (struct mdt_rec_rename *rn)
+{
+ __swab32s (&rn->rn_opcode);
+ __swab32s (&rn->rn_fsuid);
+ __swab32s (&rn->rn_fsgid);
+ __swab32s (&rn->rn_cap);
+ __swab32s (&rn->rn_suppgid1);
+ __swab32s (&rn->rn_suppgid2);
+ lustre_swab_lu_fid (&rn->rn_fid1);
+ lustre_swab_lu_fid (&rn->rn_fid2);
+ __swab64s (&rn->rn_time);
+ CLASSERT(offsetof(typeof(*rn), rn_padding_1) != 0);
+ CLASSERT(offsetof(typeof(*rn), rn_padding_2) != 0);
+ CLASSERT(offsetof(typeof(*rn), rn_padding_3) != 0);
+ CLASSERT(offsetof(typeof(*rn), rn_padding_4) != 0);
+}
+
void lustre_swab_lov_desc (struct lov_desc *ld)
{
__swab32s (&ld->ld_tgt_count);
EXPORT_SYMBOL(lustre_swab_mdt_body);
EXPORT_SYMBOL(lustre_swab_obd_quotactl);
EXPORT_SYMBOL(lustre_swab_mds_rec_setattr);
+EXPORT_SYMBOL(lustre_swab_mdt_rec_setattr);
EXPORT_SYMBOL(lustre_swab_mds_rec_create);
+EXPORT_SYMBOL(lustre_swab_mdt_rec_create);
EXPORT_SYMBOL(lustre_swab_mds_rec_join);
+EXPORT_SYMBOL(lustre_swab_mdt_rec_join);
EXPORT_SYMBOL(lustre_swab_mds_rec_link);
+EXPORT_SYMBOL(lustre_swab_mdt_rec_link);
EXPORT_SYMBOL(lustre_swab_mds_rec_unlink);
+EXPORT_SYMBOL(lustre_swab_mdt_rec_unlink);
EXPORT_SYMBOL(lustre_swab_mds_rec_rename);
+EXPORT_SYMBOL(lustre_swab_mdt_rec_rename);
EXPORT_SYMBOL(lustre_swab_lov_desc);
EXPORT_SYMBOL(lustre_swab_lov_user_md);
EXPORT_SYMBOL(lustre_swab_lov_user_md_objects);