From ab449d08b362b22b460fd2e53208baea00c14da5 Mon Sep 17 00:00:00 2001 From: nikita Date: Tue, 9 May 2006 10:27:33 +0000 Subject: [PATCH] add lu_attr to the ->moo_object_create() method --- lustre/cmm/cmm_internal.h | 1 - lustre/cmm/cmm_object.c | 13 +++++++------ lustre/cmm/mdc_object.c | 17 +++++++++-------- lustre/include/linux/md_object.h | 3 ++- lustre/mdt/mdt_reint.c | 10 +++++----- 5 files changed, 23 insertions(+), 21 deletions(-) diff --git a/lustre/cmm/cmm_internal.h b/lustre/cmm/cmm_internal.h index a7586bd..08fb439 100644 --- a/lustre/cmm/cmm_internal.h +++ b/lustre/cmm/cmm_internal.h @@ -104,7 +104,6 @@ int cmm_config(struct lu_context *ctx, struct md_device *md, const char *name, int cmm_root_get(struct lu_context *ctx, struct md_device *m, struct lu_fid *f); int cmm_statfs(struct lu_context *ctx, struct md_device *m, struct kstatfs *sfs); -int cmm_object_create(struct lu_context *, struct md_object *); int cmm_mkdir(struct lu_context *ctxt, struct lu_attr*, struct md_object *o, const char *name, struct md_object *child); diff --git a/lustre/cmm/cmm_object.c b/lustre/cmm/cmm_object.c index 0c85892..ad3bc90 100644 --- a/lustre/cmm/cmm_object.c +++ b/lustre/cmm/cmm_object.c @@ -136,7 +136,8 @@ static int cmm_object_print(struct lu_context *ctx, } /* Metadata API */ -int cmm_object_create(struct lu_context *ctx, struct md_object *mo) +static int cmm_object_create(struct lu_context *ctx, + struct md_object *mo, struct lu_attr *attr) { struct cmm_object *cmo = md2cmm_obj(mo); struct md_object *nxo = cmm2child_obj(cmo); @@ -145,9 +146,9 @@ int cmm_object_create(struct lu_context *ctx, struct md_object *mo) ENTRY; LASSERT (cmm_is_local_obj(cmo)); - - rc = nxo->mo_ops->moo_object_create(ctx, nxo); - + + rc = nxo->mo_ops->moo_object_create(ctx, nxo, attr); + RETURN(rc); } int cmm_mkdir(struct lu_context *ctx, struct lu_attr *attr, @@ -157,7 +158,7 @@ int cmm_mkdir(struct lu_context *ctx, struct lu_attr *attr, struct cmm_object *cmm_c = md2cmm_obj(c); struct md_object *local = cmm2child_obj(cmm_p); int rc; - + ENTRY; if (cmm_is_local_obj(cmm_c)) { @@ -169,7 +170,7 @@ int cmm_mkdir(struct lu_context *ctx, struct lu_attr *attr, struct md_object *remote = cmm2child_obj(cmm_c); /* remote object creation and local name insert */ - rc = remote->mo_ops->moo_object_create(ctx, remote); + rc = remote->mo_ops->moo_object_create(ctx, remote, attr); if (rc == 0) { rc = local->mo_dir_ops->mdo_name_insert(ctx, local, name, fid, diff --git a/lustre/cmm/mdc_object.c b/lustre/cmm/mdc_object.c index 71c5a76..357ae33 100644 --- a/lustre/cmm/mdc_object.c +++ b/lustre/cmm/mdc_object.c @@ -63,7 +63,7 @@ int mdc_object_init(struct lu_context *ctx, struct lu_object *lo) //struct mdc_device *d = lu2mdc_dev(o->lo_dev); //struct lu_device *under; //struct lu_fid *fid = &o->lo_header->loh_fid; - + ENTRY; RETURN(0); @@ -92,7 +92,8 @@ static int mdc_object_print(struct lu_context *ctx, return seq_printf(f, LUSTRE_MDC0_NAME"-object@%p", lo); } -static int mdc_object_create(struct lu_context *ctx, struct md_object *mo) +static int mdc_object_create(struct lu_context *ctx, struct md_object *mo, + struct lu_attr *attr) { struct mdc_device *mc = md2mdc_dev(md_device_get(mo)); int rc; @@ -111,17 +112,17 @@ static int mdc_object_create(struct lu_context *ctx, struct md_object *mo) */ rec = lustre_msg_buf(req->rq_reqmsg, MDS_REQ_REC_OFF, sizeof (*rec)); rec->cr_opcode = REINT_CREATE; - rec->cr_fsuid = 0;//uid; - rec->cr_fsgid = 0;//gid; + rec->cr_fsuid = attr->la_uid; + rec->cr_fsgid = attr->la_gid; rec->cr_cap = 0;//cap_effective; rec->cr_fid1 = mo->mo_lu.lo_header->loh_fid; memset(&rec->cr_fid2, 0, sizeof(rec->cr_fid2)); - rec->cr_mode = S_IFDIR;//mode; + rec->cr_mode = attr->la_mode; rec->cr_rdev = 0;//rdev; - rec->cr_time = 0;//op_data->mod_time; + rec->cr_time = attr->la_mtime; //op_data->mod_time; rec->cr_suppgid = 0;//op_data->suppgids[0]; - + size = sizeof(struct mdt_body); req->rq_replen = lustre_msg_size(1, &size); @@ -136,7 +137,7 @@ static int mdc_object_create(struct lu_context *ctx, struct md_object *mo) lustre_swab_mdt_body)) { CERROR ("Can't unpack mdt_body\n"); rc = -EPROTO; - } else + } else CDEBUG(D_INFO, "Done MDC req!\n"); RETURN(rc); diff --git a/lustre/include/linux/md_object.h b/lustre/include/linux/md_object.h index ccdc28a..799fa0a 100644 --- a/lustre/include/linux/md_object.h +++ b/lustre/include/linux/md_object.h @@ -60,7 +60,8 @@ struct md_object_operations { int (*moo_xattr_set)(struct lu_context *ctxt, struct md_object *obj, void *buf, int buf_len, const char *name); /* part of cross-ref operation */ - int (*moo_object_create)(struct lu_context *, struct md_object *); + int (*moo_object_create)(struct lu_context *, + struct md_object *, struct lu_attr *); int (*moo_object_destroy)(struct lu_context *, struct md_object *); }; diff --git a/lustre/mdt/mdt_reint.c b/lustre/mdt/mdt_reint.c index 47f4ae0..aa18587 100644 --- a/lustre/mdt/mdt_reint.c +++ b/lustre/mdt/mdt_reint.c @@ -51,8 +51,8 @@ static int mdt_md_mkdir(struct mdt_thread_info *info) lh->mlh_mode = LCK_PW; parent = mdt_object_find_lock(info->mti_ctxt, - mdt, info->mti_rr.rr_fid1, - lh, + mdt, info->mti_rr.rr_fid1, + lh, MDS_INODELOCK_UPDATE); if (IS_ERR(parent)) return PTR_ERR(parent); @@ -80,15 +80,15 @@ static int mdt_md_mkobj(struct mdt_thread_info *info) struct mdt_object *o; struct mdt_lock_handle *lh; int result; - + ENTRY; o = mdt_object_find(info->mti_ctxt, mdt, info->mti_rr.rr_fid1); if (!IS_ERR(o)) { struct md_object *next = mdt_object_child(o); - result = next->mo_ops->moo_object_create(info->mti_ctxt, next); - //&info->mti_attr, + result = next->mo_ops->moo_object_create(info->mti_ctxt, next, + &info->mti_attr); mdt_object_put(info->mti_ctxt, o); } else result = PTR_ERR(o); -- 1.8.3.1