Whamcloud - gitweb
add md_attr parameter to the rename_tgt() method in MD API
authortappro <tappro>
Mon, 4 Sep 2006 22:17:31 +0000 (22:17 +0000)
committertappro <tappro>
Mon, 4 Sep 2006 22:17:31 +0000 (22:17 +0000)
lustre/cmm/cmm_object.c
lustre/cmm/mdc_object.c
lustre/include/md_object.h
lustre/mdt/mdt_reint.c

index 5f00f11..564055c 100644 (file)
@@ -429,13 +429,14 @@ static int cml_rename(const struct lu_context *ctx, struct md_object *mo_po,
 
 static int cml_rename_tgt(const struct lu_context *ctx,
                           struct md_object *mo_p, struct md_object *mo_t,
-                          const struct lu_fid *lf, const char *name)
+                          const struct lu_fid *lf, const char *name,
+                          struct md_attr *ma)
 {
         int rc;
         ENTRY;
 
         rc = mdo_rename_tgt(ctx, md_object_next(mo_p),
-                            md_object_next(mo_t), lf, name);
+                            md_object_next(mo_t), lf, name, ma);
         RETURN(rc);
 }
 /* used only in case of rename_tgt() when target is not exist */
@@ -728,7 +729,7 @@ static int cmr_rename(const struct lu_context *ctx, struct md_object *mo_po,
 
         LASSERT(mo_t == NULL);
         rc = mdo_rename_tgt(ctx, md_object_next(mo_pn),
-                            NULL/* mo_t */, lf, t_name);
+                            NULL/* mo_t */, lf, t_name, ma);
         /* only old name is removed localy */
         if (rc == 0)
                 rc = mdo_name_remove(ctx, md_object_next(mo_po),
@@ -741,16 +742,17 @@ static int cmr_rename(const struct lu_context *ctx, struct md_object *mo_po,
  * and unlink target with same name if it exists */
 static int cmr_rename_tgt(const struct lu_context *ctx,
                           struct md_object *mo_p, struct md_object *mo_t,
-                          const struct lu_fid *lf, const char *name)
+                          const struct lu_fid *lf, const char *name,
+                          struct md_attr *ma)
 {
         int rc;
         ENTRY;
         /* target object is remote one */
-        rc = mo_ref_del(ctx, md_object_next(mo_t), NULL);
+        rc = mo_ref_del(ctx, md_object_next(mo_t), ma);
         /* continue locally with name handling only */
         if (rc == 0)
                 rc = mdo_rename_tgt(ctx, md_object_next(mo_p),
-                                    NULL, lf, name);
+                                    NULL, lf, name, ma);
         RETURN(rc);
 }
 
index d9da549..6394db9 100644 (file)
@@ -206,6 +206,9 @@ static int mdc_ref_add(const struct lu_context *ctx, struct md_object *mo)
 
         memset(&mci->mci_opdata, 0, sizeof(mci->mci_opdata));
         mci->mci_opdata.fid1 = *lu_object_fid(&mo->mo_lu);
+        //mci->mci_opdata.mod_time = la->la_ctime;
+        //mci->mci_opdata.fsuid = la->la_uid;
+        //mci->mci_opdata.fsgid = la->la_gid;
 
         rc = md_link(mc->mc_desc.cl_exp, &mci->mci_opdata, &mci->mci_req);
 
@@ -227,7 +230,8 @@ static int mdc_ref_del(const struct lu_context *ctx, struct md_object *mo,
         mci->mci_opdata.fid1 = *lu_object_fid(&mo->mo_lu);
         mci->mci_opdata.create_mode = la->la_mode;
         mci->mci_opdata.mod_time = la->la_ctime;
-
+        mci->mci_opdata.fsuid = la->la_uid;
+        mci->mci_opdata.fsgid = la->la_gid;
         rc = md_unlink(mc->mc_desc.cl_exp, &mci->mci_opdata, &mci->mci_req);
         if (rc == 0) {
                 /* get attr from request */
@@ -262,9 +266,11 @@ static struct md_object_operations mdc_mo_ops = {
 /* md_dir_operations */
 static int mdc_rename_tgt(const struct lu_context *ctx,
                           struct md_object *mo_p, struct md_object *mo_t,
-                          const struct lu_fid *lf, const char *name)
+                          const struct lu_fid *lf, const char *name,
+                          struct md_attr *ma)
 {
         struct mdc_device *mc = md2mdc_dev(md_obj2dev(mo_p));
+        struct lu_attr *la = &ma->ma_attr;
         struct mdc_thread_info *mci;
         int rc;
         ENTRY;
@@ -272,6 +278,9 @@ static int mdc_rename_tgt(const struct lu_context *ctx,
         mci = mdc_info_init(ctx);
         mci->mci_opdata.fid1 = *lu_object_fid(&mo_p->mo_lu);
         mci->mci_opdata.fid2 = *lf;
+        mci->mci_opdata.mod_time = la->la_ctime;
+        mci->mci_opdata.fsuid = la->la_uid;
+        mci->mci_opdata.fsgid = la->la_gid;
 
         rc = md_rename(mc->mc_desc.cl_exp, &mci->mci_opdata, NULL, 0,
                        name, strlen(name), &mci->mci_req);
index 8c1dd40..c14434b 100644 (file)
@@ -164,7 +164,7 @@ struct md_dir_operations {
                                const char *);
         int (*mdo_rename_tgt)(const struct lu_context *, struct md_object *,
                               struct md_object *, const struct lu_fid *,
-                              const char *);
+                              const char *, struct md_attr *);
 };
 
 struct md_device_operations {
@@ -410,14 +410,15 @@ static inline int mdo_name_remove(const struct lu_context *cx,
 
 static inline int mdo_rename_tgt(const struct lu_context *cx,
                                  struct md_object *p, struct md_object *t,
-                                 const struct lu_fid *lf, const char *name)
+                                 const struct lu_fid *lf, const char *name,
+                                 struct md_attr *ma)
 {
         if (t) {
                 LASSERT(t->mo_dir_ops->mdo_rename_tgt);
-                return t->mo_dir_ops->mdo_rename_tgt(cx, p, t, lf, name);
+                return t->mo_dir_ops->mdo_rename_tgt(cx, p, t, lf, name, ma);
         } else {
                 LASSERT(p->mo_dir_ops->mdo_rename_tgt);
-                return p->mo_dir_ops->mdo_rename_tgt(cx, p, t, lf, name);
+                return p->mo_dir_ops->mdo_rename_tgt(cx, p, t, lf, name, ma);
         }
 }
 
index f363a14..4a0698c 100644 (file)
@@ -366,6 +366,7 @@ static int mdt_reint_rename_tgt(struct mdt_thread_info *info)
 {
         struct mdt_reint_record *rr = &info->mti_rr;
         struct ptlrpc_request   *req = mdt_info_req(info);
+        struct md_attr          *ma = &info->mti_attr;
         struct mdt_object       *mtgtdir;
         struct mdt_object       *mtgt = NULL;
         struct mdt_lock_handle  *lh_tgtdir;
@@ -407,10 +408,10 @@ static int mdt_reint_rename_tgt(struct mdt_thread_info *info)
         if (mtgt)
                 rc = mdo_rename_tgt(info->mti_ctxt, mdt_object_child(mtgtdir),
                                     mdt_object_child(mtgt),
-                                    rr->rr_fid2, rr->rr_tgt);
+                                    rr->rr_fid2, rr->rr_tgt, ma);
         else
                 rc = mdo_name_insert(info->mti_ctxt, mdt_object_child(mtgtdir),
-                                     rr->rr_tgt, rr->rr_fid2, 0 /* FIXME */);
+                                     rr->rr_tgt, rr->rr_fid2, 0 /* FIXME: isdir */);
         GOTO(out_unlock_tgt, rc);
 
 out_unlock_tgt: