Whamcloud - gitweb
LU-5233 lod: Remove ldo_def_striping_set check 72/10772/4
authorWang Di <di.wang@intel.com>
Fri, 20 Jun 2014 15:15:04 +0000 (08:15 -0700)
committerOleg Drokin <oleg.drokin@intel.com>
Thu, 26 Jun 2014 05:33:40 +0000 (05:33 +0000)
Only check ldo_stripenr/ldo_stripe_offset before create
striped directory, and ldo_def_striping_set is used to
mark whether the directory has default stripe, which can
be inherited to its children.

Reset ldo_stripenr to 0, if initialization fails, otherwise
it will leave some invalid object in cache.

Change-Id: Iba6985861fb1443bd4e7fcce3cd8c523b31a5940
Signed-off-by: Wang Di <di.wang@intel.com>
Reviewed-on: http://review.whamcloud.com/10772
Reviewed-by: Andreas Dilger <andreas.dilger@intel.com>
Tested-by: Jenkins
Reviewed-by: John L. Hammond <john.hammond@intel.com>
Tested-by: Maloo <hpdd-maloo@intel.com>
Reviewed-by: Oleg Drokin <oleg.drokin@intel.com>
lustre/lod/lod_lov.c
lustre/lod/lod_object.c
lustre/lod/lod_qos.c

index 148020a..4ff0f10 100644 (file)
@@ -780,6 +780,7 @@ out:
                                lu_object_put(env, &stripe[i]->do_lu);
 
                OBD_FREE(stripe, sizeof(stripe[0]) * stripe_len);
                                lu_object_put(env, &stripe[i]->do_lu);
 
                OBD_FREE(stripe, sizeof(stripe[0]) * stripe_len);
+               lo->ldo_stripenr = 0;
        } else {
                lo->ldo_stripe = stripe;
                lo->ldo_stripes_allocated = stripe_len;
        } else {
                lo->ldo_stripe = stripe;
                lo->ldo_stripes_allocated = stripe_len;
index ed457a8..25cc60d 100644 (file)
@@ -2028,8 +2028,7 @@ int lod_dir_striping_create_internal(const struct lu_env *env,
        int                     rc;
        ENTRY;
 
        int                     rc;
        ENTRY;
 
-       if (lo->ldo_dir_def_striping_set &&
-           !LMVEA_DELETE_VALUES(lo->ldo_stripenr,
+       if (!LMVEA_DELETE_VALUES(lo->ldo_stripenr,
                                 lo->ldo_dir_stripe_offset)) {
                struct lmv_user_md_v1 *v1 = info->lti_ea_store;
                int stripe_count = lo->ldo_stripenr;
                                 lo->ldo_dir_stripe_offset)) {
                struct lmv_user_md_v1 *v1 = info->lti_ea_store;
                int stripe_count = lo->ldo_stripenr;
@@ -2480,7 +2479,7 @@ static void lod_ah_init(const struct lu_env *env,
                               lc->ldo_dir_def_hash_type);
                }
 
                               lc->ldo_dir_def_hash_type);
                }
 
-               /* If the directory is specified with certain stripes */
+               /* It should always honour the specified stripes */
                if (ah->dah_eadata != NULL && ah->dah_eadata_len != 0) {
                        const struct lmv_user_md_v1 *lum1 = ah->dah_eadata;
 
                if (ah->dah_eadata != NULL && ah->dah_eadata_len != 0) {
                        const struct lmv_user_md_v1 *lum1 = ah->dah_eadata;
 
@@ -2499,6 +2498,7 @@ static void lod_ah_init(const struct lu_env *env,
                                       lc->ldo_stripenr,
                                       (int)lc->ldo_dir_stripe_offset);
                        }
                                       lc->ldo_stripenr,
                                       (int)lc->ldo_dir_stripe_offset);
                        }
+               /* then check whether there is default stripes from parent */
                } else if (lp->ldo_dir_def_striping_set) {
                        /* If there are default dir stripe from parent */
                        lc->ldo_stripenr = lp->ldo_dir_def_stripenr;
                } else if (lp->ldo_dir_def_striping_set) {
                        /* If there are default dir stripe from parent */
                        lc->ldo_stripenr = lp->ldo_dir_def_stripenr;
index 2b8f1d1..ba70a97 100644 (file)
@@ -1435,6 +1435,7 @@ int lod_qos_prep_create(const struct lu_env *env, struct lod_object *lo,
                                        lu_object_put(env, &stripe[i]->do_lu);
 
                        OBD_FREE(stripe, sizeof(stripe[0]) * stripe_len);
                                        lu_object_put(env, &stripe[i]->do_lu);
 
                        OBD_FREE(stripe, sizeof(stripe[0]) * stripe_len);
+                       lo->ldo_stripenr = 0;
                } else {
                        lo->ldo_stripe = stripe;
                        lo->ldo_stripes_allocated = stripe_len;
                } else {
                        lo->ldo_stripe = stripe;
                        lo->ldo_stripes_allocated = stripe_len;