From 56211bf18fbca9930d77cea1ee0e3f2d83d59ec4 Mon Sep 17 00:00:00 2001 From: Niu Yawei Date: Sun, 11 Jan 2015 06:01:31 -0500 Subject: [PATCH] LU-5916 lod: inherit default pool setting properly When parent directory has no default striping but has only default pool setting, the pool setting should be inherited by subdir properly. This patch fixed the problem by changing the LOVEA_DELETE_VALUES() to check pool name as well, and it removed the unused function lod_store_def_striping(). Lustre-commit: e8214d6bd4ccc3ff386c77904664c60f1848ef11 Lustre-change: http://review.whamcloud.com/#/c/12746/ Signed-off-by: Niu Yawei Change-Id: I8ab9623772bb0d78965396daaab54353f07228f0 Reviewed-on: http://review.whamcloud.com/13411 Tested-by: Jenkins Reviewed-by: Alex Zhuravlev Tested-by: Maloo Reviewed-by: Oleg Drokin --- lustre/include/lustre_lib.h | 6 ++++-- lustre/lod/lod_lov.c | 2 +- lustre/lod/lod_object.c | 15 +++++++++------ lustre/tests/sanity.sh | 3 +++ 4 files changed, 17 insertions(+), 9 deletions(-) diff --git a/lustre/include/lustre_lib.h b/lustre/include/lustre_lib.h index 43bccdc..19b2326 100644 --- a/lustre/include/lustre_lib.h +++ b/lustre/include/lustre_lib.h @@ -561,8 +561,10 @@ static inline void obd_ioctl_freedata(char *buf, int len) #define LUSTRE_STRIPE_MAXBYTES 0x1fffffff000ULL /* Special values for remove LOV EA from disk */ -#define LOVEA_DELETE_VALUES(size, count, offset) (size == 0 && count == 0 && \ - offset == (typeof(offset))(-1)) +#define LOVEA_DELETE_VALUES(size, count, offset, pool) \ + ((size) == 0 && (count) == 0 && \ + (offset) == (typeof(offset))(-1) && (pool) == NULL) + /* #define POISON_BULK 0 */ diff --git a/lustre/lod/lod_lov.c b/lustre/lod/lod_lov.c index 978406e..a907c87 100644 --- a/lustre/lod/lod_lov.c +++ b/lustre/lod/lod_lov.c @@ -634,7 +634,7 @@ int lod_store_def_striping(const struct lu_env *env, struct dt_object *dt, RETURN(0); if (LOVEA_DELETE_VALUES(lo->ldo_def_stripe_size, lo->ldo_def_stripenr, - lo->ldo_def_stripe_offset)) + lo->ldo_def_stripe_offset, lo->ldo_pool)) RETURN(0); /* XXX: use thread info */ diff --git a/lustre/lod/lod_object.c b/lustre/lod/lod_object.c index 3bbf3b1..176ea7d 100644 --- a/lustre/lod/lod_object.c +++ b/lustre/lod/lod_object.c @@ -515,6 +515,7 @@ static int lod_xattr_set_lov_on_dir(const struct lu_env *env, struct lod_object *l = lod_dt_obj(dt); struct lov_user_md_v1 *lum; struct lov_user_md_v3 *v3 = NULL; + const char *pool_name = NULL; int rc; ENTRY; @@ -532,8 +533,11 @@ static int lod_xattr_set_lov_on_dir(const struct lu_env *env, if (rc) RETURN(rc); - if (lum->lmm_magic == LOV_USER_MAGIC_V3) + if (lum->lmm_magic == LOV_USER_MAGIC_V3) { v3 = buf->lb_buf; + if (v3->lmm_pool_name[0] != '\0') + pool_name = v3->lmm_pool_name; + } /* if { size, offset, count } = { 0, -1, 0 } and no pool * (i.e. all default values specified) then delete default @@ -545,10 +549,8 @@ static int lod_xattr_set_lov_on_dir(const struct lu_env *env, (int)lum->lmm_stripe_offset, v3 ? "from" : "", v3 ? v3->lmm_pool_name : ""); - if (LOVEA_DELETE_VALUES((lum->lmm_stripe_size), - (lum->lmm_stripe_count), - (lum->lmm_stripe_offset)) && - lum->lmm_magic == LOV_USER_MAGIC_V1) { + if (LOVEA_DELETE_VALUES(lum->lmm_stripe_size, lum->lmm_stripe_count, + lum->lmm_stripe_offset, pool_name)) { rc = dt_xattr_del(env, next, name, th, capa); if (rc == -ENODATA) rc = 0; @@ -966,7 +968,8 @@ static int lod_declare_object_create(const struct lu_env *env, if (LOVEA_DELETE_VALUES(lo->ldo_def_stripe_size, lo->ldo_def_stripenr, - lo->ldo_def_stripe_offset)) + lo->ldo_def_stripe_offset, + lo->ldo_pool)) RETURN(0); OBD_ALLOC_PTR(v3); diff --git a/lustre/tests/sanity.sh b/lustre/tests/sanity.sh index 854c0de..734b948 100644 --- a/lustre/tests/sanity.sh +++ b/lustre/tests/sanity.sh @@ -10852,6 +10852,7 @@ test_200() { local ost_range="$first_ost $last_ost $ost_step" local test_path=$POOL_ROOT/$POOL_DIR_NAME local file_dir=$POOL_ROOT/file_tst + local subdir=$test_path/subdir local rc=0 while : ; do @@ -10862,6 +10863,8 @@ test_200() { mkdir -p $test_path pool_set_dir $POOL $test_path || { rc=$? ; break; } pool_check_dir $POOL $test_path || { rc=$? ; break; } + mkdir -p $subdir + pool_check_dir $POOL $subdir || { rc=$? ; break; } pool_dir_rel_path $POOL $POOL_DIR_NAME $POOL_ROOT \ || { rc=$? ; break; } # former test_200e test_200f -- 1.8.3.1