X-Git-Url: https://git.whamcloud.com/?a=blobdiff_plain;f=lustre%2Fmdc%2Fmdc_lib.c;h=895b2a5f17fb2a6d88217d684e89531a6f58b6e2;hb=47b56d31b69ba8d6fca6a633ecdbbf11d62d1b6c;hp=effaa56881cefc8665f930d7697cf8e39bb25fd8;hpb=2dc9c16e770415d56839e1996015fec5fab93f29;p=fs%2Flustre-release.git diff --git a/lustre/mdc/mdc_lib.c b/lustre/mdc/mdc_lib.c index effaa56..895b2a5 100644 --- a/lustre/mdc/mdc_lib.c +++ b/lustre/mdc/mdc_lib.c @@ -39,35 +39,17 @@ #endif #endif -void mdc_readdir_pack(struct ptlrpc_request *req, __u64 offset, __u32 size, - struct ll_fid *mdc_fid) +void mdc_readdir_pack(struct ptlrpc_request *req, int req_offset, + __u64 offset, __u32 size, struct lustre_id *mdc_id) { struct mds_body *b; - b = lustre_msg_buf(req->rq_reqmsg, 0, sizeof (*b)); - b->fsuid = current->fsuid; - b->fsgid = current->fsgid; - b->capability = current->cap_effective; - b->fid1 = *mdc_fid; + b = lustre_msg_buf(req->rq_reqmsg, req_offset, sizeof (*b)); + b->id1 = *mdc_id; b->size = offset; /* !! */ - b->suppgid = -1; b->nlink = size; /* !! */ } -static void mdc_pack_body(struct mds_body *b) -{ - LASSERT (b != NULL); - - b->fsuid = current->fsuid; - b->fsgid = current->fsgid; - b->capability = current->cap_effective; -} - -void mdc_pack_req_body(struct ptlrpc_request *req) -{ - struct mds_body *b = lustre_msg_buf(req->rq_reqmsg, 0, sizeof (*b)); - mdc_pack_body(b); -} static __u32 mds_pack_open_flags(__u32 flags) { return @@ -82,28 +64,27 @@ static __u32 mds_pack_open_flags(__u32 flags) ((flags & O_DIRECTORY) ? MDS_OPEN_DIRECTORY : 0) | 0; } + /* packing of MDS records */ void mdc_open_pack(struct lustre_msg *msg, int offset, - struct mdc_op_data *op_data, __u32 mode, __u64 rdev, - __u32 flags, const void *lmm, int lmmlen) + struct mdc_op_data *op_data, __u32 mode, + __u64 rdev, __u32 flags, const void *lmm, + int lmmlen) { struct mds_rec_create *rec; char *tmp; + rec = lustre_msg_buf(msg, offset, sizeof (*rec)); /* XXX do something about time, uid, gid */ rec->cr_opcode = REINT_OPEN; - rec->cr_fsuid = current->fsuid; - rec->cr_fsgid = current->fsgid; - rec->cr_cap = current->cap_effective; if (op_data != NULL) - rec->cr_fid = op_data->fid1; - memset(&rec->cr_replayfid, 0, sizeof(rec->cr_replayfid)); - rec->cr_mode = mode; + rec->cr_id = op_data->id1; + memset(&rec->cr_replayid, 0, sizeof(rec->cr_replayid)); rec->cr_flags = mds_pack_open_flags(flags); - rec->cr_rdev = rdev; rec->cr_time = op_data->mod_time; - rec->cr_suppgid = op_data->ctxt.gid1; + rec->cr_mode = mode; + rec->cr_rdev = rdev; if (op_data->name) { tmp = lustre_msg_buf(msg, offset + 1, @@ -117,21 +98,18 @@ void mdc_open_pack(struct lustre_msg *msg, int offset, memcpy (tmp, lmm, lmmlen); } } -void mdc_getattr_pack(struct lustre_msg *msg, int valid, int offset, - int flags, struct mdc_op_data *data) + +void mdc_getattr_pack(struct lustre_msg *msg, int offset, + __u64 valid, int flags, struct mdc_op_data *data) { struct mds_body *b; b = lustre_msg_buf(msg, offset, sizeof (*b)); - b->fsuid = current->fsuid; - b->fsgid = current->fsgid; - b->capability = current->cap_effective; b->valid = valid; b->flags = flags; - b->suppgid = data->ctxt.gid1; - b->fid1 = data->fid1; - b->fid2 = data->fid2; + b->id1 = data->id1; + b->id2 = data->id2; if (data->name) { char *tmp; tmp = lustre_msg_buf(msg, offset + 1, @@ -141,13 +119,13 @@ void mdc_getattr_pack(struct lustre_msg *msg, int valid, int offset, } void mdc_close_pack(struct ptlrpc_request *req, int offset, struct obdo *oa, - int valid, struct obd_client_handle *och) + __u64 valid, struct obd_client_handle *och) { struct mds_body *body; - body = lustre_msg_buf(req->rq_reqmsg, 0, sizeof(*body)); + body = lustre_msg_buf(req->rq_reqmsg, offset, sizeof(*body)); + mdc_pack_id(&body->id1, oa->o_id, 0, oa->o_mode, 0, 0); - mdc_pack_fid(&body->fid1, oa->o_id, 0, oa->o_mode); memcpy(&body->handle, &och->och_fh, sizeof(body->handle)); if (oa->o_valid & OBD_MD_FLATIME) { body->atime = oa->o_atime; @@ -174,3 +152,28 @@ void mdc_close_pack(struct ptlrpc_request *req, int offset, struct obdo *oa, body->valid |= OBD_MD_FLFLAGS; } } + +/* + * these methods needed for saying higher levels that MDC does not pack/unpack + * any EAs. This is needed to have real abstraction and do not try to recognize + * what OBD type is to avoid calling these methods on it, as they may not be + * implemented. + * + * Sometimes pack/unpack calls happen to MDC too. This is for instance default + * striping info for directories and our goal here is to skip them with no + * errors or any complains. + */ +int mdc_packmd(struct obd_export *exp, struct lov_mds_md **lmmp, + struct lov_stripe_md *lsm) +{ + ENTRY; + RETURN(0); +} + +int mdc_unpackmd(struct obd_export *exp, struct lov_stripe_md **lsmp, + struct lov_mds_md *lmm, int lmm_size) +{ + ENTRY; + RETURN(0); +} +