Whamcloud - gitweb
LU-5916 lod: inherit default pool setting properly 11/13411/2
authorNiu Yawei <yawei.niu@intel.com>
Sun, 11 Jan 2015 11:01:31 +0000 (06:01 -0500)
committerOleg Drokin <oleg.drokin@intel.com>
Tue, 27 Jan 2015 02:42:34 +0000 (02:42 +0000)
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 <yawei.niu@intel.com>
Change-Id: I8ab9623772bb0d78965396daaab54353f07228f0
Reviewed-on: http://review.whamcloud.com/13411
Tested-by: Jenkins
Reviewed-by: Alex Zhuravlev <alexey.zhuravlev@intel.com>
Tested-by: Maloo <hpdd-maloo@intel.com>
Reviewed-by: Oleg Drokin <oleg.drokin@intel.com>
lustre/include/lustre_lib.h
lustre/lod/lod_lov.c
lustre/lod/lod_object.c
lustre/tests/sanity.sh

index 43bccdc..19b2326 100644 (file)
@@ -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 */
 
index 978406e..a907c87 100644 (file)
@@ -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 */
index 3bbf3b1..176ea7d 100644 (file)
@@ -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);
index 854c0de..734b948 100644 (file)
@@ -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