Whamcloud - gitweb
add lu_attr to the ->moo_object_create() method
authornikita <nikita>
Tue, 9 May 2006 10:27:33 +0000 (10:27 +0000)
committernikita <nikita>
Tue, 9 May 2006 10:27:33 +0000 (10:27 +0000)
lustre/cmm/cmm_internal.h
lustre/cmm/cmm_object.c
lustre/cmm/mdc_object.c
lustre/include/linux/md_object.h
lustre/mdt/mdt_reint.c

index a7586bd..08fb439 100644 (file)
@@ -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);
index 0c85892..ad3bc90 100644 (file)
@@ -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,
index 71c5a76..357ae33 100644 (file)
@@ -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);
index ccdc28a..799fa0a 100644 (file)
@@ -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 *);
 
 };
index 47f4ae0..aa18587 100644 (file)
@@ -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);