From 4da593b06db960e5afef64e175d7e19281063e56 Mon Sep 17 00:00:00 2001 From: Alex Zhuravlev Date: Thu, 24 Mar 2016 23:55:49 +0300 Subject: [PATCH] LU-7918 mdd: no need to declare attr_set at create 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 Reviewed-on: http://review.whamcloud.com/19132 Tested-by: Jenkins Reviewed-by: Andreas Dilger Reviewed-by: John L. Hammond Tested-by: Maloo --- lustre/mdd/mdd_dir.c | 15 +++------------ lustre/target/tgt_lastrcvd.c | 22 ++++++++-------------- 2 files changed, 11 insertions(+), 26 deletions(-) diff --git a/lustre/mdd/mdd_dir.c b/lustre/mdd/mdd_dir.c index 1386935..0e9e941 100644 --- a/lustre/mdd/mdd_dir.c +++ b/lustre/mdd/mdd_dir.c @@ -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); diff --git a/lustre/target/tgt_lastrcvd.c b/lustre/target/tgt_lastrcvd.c index 7b0cf2b..f0d9222 100644 --- a/lustre/target/tgt_lastrcvd.c +++ b/lustre/target/tgt_lastrcvd.c @@ -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 && -- 1.8.3.1