From: Wang Di Date: Thu, 26 Jun 2014 06:49:27 +0000 (-0700) Subject: LU-5130 lod: Do not merge attr for striped directory X-Git-Tag: 2.6.0-RC1~22 X-Git-Url: https://git.whamcloud.com/?p=fs%2Flustre-release.git;a=commitdiff_plain;h=94c6962ad22ff819fbf4a4bb7f412ac13cfeb4ca LU-5130 lod: Do not merge attr for striped directory Does not need to merge attributes in lod_attr_get(), because client will merge attributes itself for striped directory (see lmv_merge_attr()), and also there are no logic in MDD will reply on directory nlink/size/time. Besides lod_attr_get is in the path of object initialization, mdd_object_start()->mdd_la_get()->lod_attr_get(), if it tries to get attribute from other MDTs, and if other MDTs are not ready yet, it will cause unnecessary failures for object initialization. Change-Id: I56395a40fcd82142f99228a0776b5b7338c633ac Signed-off-by: Wang Di Reviewed-on: http://review.whamcloud.com/10841 Tested-by: Jenkins Tested-by: Maloo Reviewed-by: Andreas Dilger Reviewed-by: Fan Yong Reviewed-by: Oleg Drokin --- diff --git a/lustre/lod/lod_object.c b/lustre/lod/lod_object.c index 25cc60d8..d6dc2e5 100644 --- a/lustre/lod/lod_object.c +++ b/lustre/lod/lod_object.c @@ -757,62 +757,11 @@ static int lod_attr_get(const struct lu_env *env, struct lu_attr *attr, struct lustre_capa *capa) { - struct lod_object *lo = lod_dt_obj(dt); - int i; - int rc; - ENTRY; - - rc = dt_attr_get(env, dt_object_child(dt), attr, capa); - if (!S_ISDIR(dt->do_lu.lo_header->loh_attr) || rc != 0) - RETURN(rc); - - rc = lod_load_striping_locked(env, lo); - if (rc) - RETURN(rc); - - if (lo->ldo_stripenr == 0) - RETURN(rc); - - attr->la_nlink = 2; - attr->la_size = 0; - for (i = 0; i < lo->ldo_stripenr; i++) { - struct lu_attr *sub_attr = &lod_env_info(env)->lti_attr; - - LASSERT(lo->ldo_stripe[i]); - if (dt_object_exists(lo->ldo_stripe[i])) - continue; - - rc = dt_attr_get(env, lo->ldo_stripe[i], sub_attr, capa); - if (rc != 0) - break; - - /* -2 for . and .. on each stripe */ - if (sub_attr->la_valid & LA_NLINK && attr->la_valid & LA_NLINK) - attr->la_nlink += sub_attr->la_nlink - 2; - if (sub_attr->la_valid & LA_SIZE && attr->la_valid & LA_SIZE) - attr->la_size += sub_attr->la_size; - - if (sub_attr->la_valid & LA_ATIME && - attr->la_valid & LA_ATIME && - attr->la_atime < sub_attr->la_atime) - attr->la_atime = sub_attr->la_atime; - - if (sub_attr->la_valid & LA_CTIME && - attr->la_valid & LA_CTIME && - attr->la_ctime < sub_attr->la_ctime) - attr->la_ctime = sub_attr->la_ctime; - - if (sub_attr->la_valid & LA_MTIME && - attr->la_valid & LA_MTIME && - attr->la_mtime < sub_attr->la_mtime) - attr->la_mtime = sub_attr->la_mtime; - } - - CDEBUG(D_INFO, DFID" stripe_count %d nlink %u size "LPU64"\n", - PFID(lu_object_fid(&dt->do_lu)), lo->ldo_stripenr, - attr->la_nlink, attr->la_size); - - RETURN(rc); + /* Note: for striped directory, client will merge attributes + * from all of the sub-stripes see lmv_merge_attr(), and there + * no MDD logic depend on directory nlink/size/time, so we can + * always use master inode nlink and size for now. */ + return dt_attr_get(env, dt_object_child(dt), attr, capa); } /**