Whamcloud - gitweb
LU-7918 mdd: no need to declare attr_set at create 32/19132/4
authorAlex Zhuravlev <alexey.zhuravlev@intel.com>
Thu, 24 Mar 2016 20:55:49 +0000 (23:55 +0300)
committerOleg Drokin <oleg.drokin@intel.com>
Thu, 2 Jun 2016 04:44:44 +0000 (04:44 +0000)
as dt_create() will set the attributes we need. also, we can save
couple dt_record_write() in tgt_txn_start_cb() as one is not needed
with multislot enabled while another is not needed at all.
these changes decrease disk/memory reservation from ~33MB to 6MB.

Change-Id: I65e537dd053eb7b4e4d2cccab41973096072b1db
Signed-off-by: Alex Zhuravlev <alexey.zhuravlev@intel.com>
Reviewed-on: http://review.whamcloud.com/19132
Tested-by: Jenkins
Reviewed-by: Andreas Dilger <andreas.dilger@intel.com>
Reviewed-by: John L. Hammond <john.hammond@intel.com>
Tested-by: Maloo <hpdd-maloo@intel.com>
lustre/mdd/mdd_dir.c
lustre/target/tgt_lastrcvd.c

index 1386935..0e9e941 100644 (file)
@@ -1862,24 +1862,15 @@ out_free:
 static int mdd_declare_object_initialize(const struct lu_env *env,
                                         struct mdd_object *parent,
                                         struct mdd_object *child,
-                                        struct lu_attr *attr,
+                                        const struct lu_attr *attr,
                                         struct thandle *handle)
 {
        int rc;
        ENTRY;
 
-       /*
-        * inode mode has been set in creation time, and it's based on umask,
-        * la_mode and acl, don't set here again! (which will go wrong
-        * because below function doesn't consider umask).
-        * I'd suggest set all object attributes in creation time, see above.
-        */
        LASSERT(attr->la_valid & (LA_MODE | LA_TYPE));
-       attr->la_valid &= ~(LA_MODE | LA_TYPE);
-       rc = mdo_declare_attr_set(env, child, attr, handle);
-       attr->la_valid |= LA_MODE | LA_TYPE;
-       if (rc != 0 || !S_ISDIR(attr->la_mode))
-               RETURN(rc);
+       if (!S_ISDIR(attr->la_mode))
+               RETURN(0);
 
        rc = mdo_declare_index_insert(env, child, mdo2fid(child), S_IFDIR,
                                      dot, handle);
index 7b0cf2b..f0d9222 100644 (file)
@@ -1717,20 +1717,6 @@ int tgt_txn_start_cb(const struct lu_env *env, struct thandle *th,
        if (tsi->tsi_exp == NULL)
                return 0;
 
-       dto = dt_object_locate(tgt->lut_last_rcvd, th->th_dev);
-       tti_buf_lcd(tti);
-
-       rc = dt_declare_record_write(env, dto, &tti->tti_buf,
-                                    tsi->tsi_exp->exp_target_data.ted_lr_off,
-                                    th);
-       if (rc)
-               return rc;
-
-       tti_buf_lsd(tti);
-       rc = dt_declare_record_write(env, dto, &tti->tti_buf, 0, th);
-       if (rc)
-               return rc;
-
        if (tgt_is_multimodrpcs_client(tsi->tsi_exp)) {
                /*
                 * Use maximum possible file offset for declaration to ensure
@@ -1748,6 +1734,14 @@ int tgt_txn_start_cb(const struct lu_env *env, struct thandle *th,
                                             tti->tti_off, th);
                if (rc)
                        return rc;
+       } else {
+               dto = dt_object_locate(tgt->lut_last_rcvd, th->th_dev);
+               tti_buf_lcd(tti);
+               tti->tti_off = tsi->tsi_exp->exp_target_data.ted_lr_off;
+               rc = dt_declare_record_write(env, dto, &tti->tti_buf,
+                                            tti->tti_off, th);
+               if (rc)
+                       return rc;
        }
 
        if (tsi->tsi_vbr_obj != NULL &&