Whamcloud - gitweb
LU-16938 utils: setstripe overstripe multiple OST count 92/54192/13
authorRajeev Mishra <rajeevm@hpe.com>
Fri, 9 Feb 2024 16:49:45 +0000 (16:49 +0000)
committerOleg Drokin <green@whamcloud.com>
Wed, 29 May 2024 04:41:53 +0000 (04:41 +0000)
Add an option to "lfs setstripe -C" to specify stripe counts
that are a multiple of the number of OSTs in the filesystem.
Using "-C -1" will create one stripe on all (available) OSTs,
as with "-c -1", to avoid too many stripes.  Using "-C -2"
will create two stripes on each OST, etc.

The maximum multiplier is currently "-C -32", which will
create 32 stripes per OST. It is still possible to specify
a large positive stripe count directly to  "-C" for testing
purposes and to maintain compatibility with current usage.

HPE-bug-id:LUS-11793
Signed-off-by: Rajeev Mishra <rajeevm@hpe.com>
Change-Id: Ib0462d7a9b71853419ea7c30741bb35d576f0d71
Reviewed-on: https://review.whamcloud.com/c/fs/lustre-release/+/54192
Tested-by: jenkins <devops@whamcloud.com>
Tested-by: Maloo <maloo@whamcloud.com>
Reviewed-by: Andreas Dilger <adilger@whamcloud.com>
Reviewed-by: Patrick Farrell <patrick.farrell@oracle.com>
Reviewed-by: Oleg Drokin <green@whamcloud.com>
13 files changed:
lustre/doc/lfs-setstripe.1
lustre/include/lu_object.h
lustre/include/lustre/lustreapi.h
lustre/include/uapi/linux/lustre/lustre_idl.h
lustre/include/uapi/linux/lustre/lustre_user.h
lustre/lod/lod_object.c
lustre/lod/lod_qos.c
lustre/tests/llapi_layout_test.c
lustre/tests/sanity-flr.sh
lustre/tests/sanity.sh
lustre/utils/lfs.c
lustre/utils/liblustreapi_layout.c
lustre/utils/lustreapi_internal.h

index 477bb7f..e9efb35 100644 (file)
@@ -151,8 +151,9 @@ over all available OSTs.
 .B -C\fR, \fB--overstripe-count \fR\fISTRIPE_COUNT\fR
 The number of stripes to create, creating > 1 stripe per OST if count exceeds
 the number of OSTs in the file system. \fB0 \fRmeans to use the filesystem-wide
-default stripe count (default 1), and \fB-1 \fRmeans to stripe over all
-available OSTs.
+default stripe count (default 1), and \fB range -1 to -32\fRmeans to stripe
+over all available OSTs in multiple of OST count. For example, \fB-1\fR means
+one stripe per OST, -2 means two stripes per OST, and so on.
 .TP
 .B -S\fR, \fB--stripe-size \fR\fISTRIPE_SIZE\fR
 The number of bytes to store on each OST before moving to the next OST. A
index 421ee93..9984f61 100644 (file)
@@ -1690,7 +1690,7 @@ static inline __u64 tgt_statfs_iavail(struct lu_tgt_desc *tgt)
 /* number of pointers at 2nd level */
 #define TGT_PTRS_PER_BLOCK     (PAGE_SIZE / sizeof(void *))
 /* number of pointers at 1st level - only need as many as max OST/MDT count */
-#define TGT_PTRS               ((LOV_ALL_STRIPES + 1) / TGT_PTRS_PER_BLOCK)
+#define TGT_PTRS               ((LOV_ALL_STRIPES_MAX + 1) / TGT_PTRS_PER_BLOCK)
 
 struct lu_tgt_desc_idx {
        struct lu_tgt_desc *ldi_tgt[TGT_PTRS_PER_BLOCK];
index 876dce6..9cc1b54 100644 (file)
@@ -866,7 +866,10 @@ int llapi_layout_merge(struct llapi_layout **dst_layout,
  * When specified or returned as the value for stripe count, all
  * available OSTs will be used.
  */
-#define LLAPI_LAYOUT_WIDE      (LLAPI_LAYOUT_INVALID + 2)
+#define LLAPI_MIN_STRIPE_COUNT    (-1)
+#define LLAPI_MAX_STRIPE_COUNT    (-32)
+#define LLAPI_LAYOUT_WIDE_MIN  (LLAPI_LAYOUT_INVALID + 2)
+#define LLAPI_LAYOUT_WIDE_MAX  (LLAPI_LAYOUT_WIDE_MIN + 32)
 
 /**
  * When specified as the value for layout pattern, file objects will be
index bc88bd1..5b4d724 100644 (file)
@@ -1284,7 +1284,7 @@ struct lov_mds_md_v3 {            /* LOV EA mds/wire data (little-endian) */
 
 static inline __u32 lov_mds_md_size(__u16 stripes, __u32 lmm_magic)
 {
-       if (stripes == LOV_ALL_STRIPES)
+       if (stripes >= LOV_ALL_STRIPES_MIN && stripes <= LOV_ALL_STRIPES_MAX)
                stripes = 0;
 
        if (lmm_magic == LOV_MAGIC_V1)
index e81b85f..abf779a 100644 (file)
@@ -811,7 +811,12 @@ static inline bool lov_pool_is_reserved(const char *pool)
  * (max buffer size - lov+rpc header) / sizeof(struct lov_ost_data_v1)
  */
 #define LOV_MAX_STRIPE_COUNT 2000  /* ~((12 * 4096 - 256) / 24) */
-#define LOV_ALL_STRIPES       0xffff /* only valid for directories */
+
+/* Below given max and min values are used to check range of stripe count */
+/* LOV_ALL_STRIPES_MAX  LLAPI_MIN_STRIPE_COUNT */
+/* LOV_ALL_STRIPES_MIN  LLAPI_MIN_STRIPE_COUNT+ LLAPI_MAX_STRIPE_COUNT */
+#define LOV_ALL_STRIPES_MAX 0xffff
+#define LOV_ALL_STRIPES_MIN 0xffdf
 #define LOV_V1_INSANE_STRIPE_COUNT 65532 /* maximum stripe count bz13933 */
 
 #define XATTR_LUSTRE_PREFIX    "lustre."
@@ -1053,7 +1058,7 @@ struct lov_comp_md_v1 {
 
 static inline __u32 lov_user_md_size(__u16 stripes, __u32 lmm_magic)
 {
-       if (stripes == LOV_ALL_STRIPES)
+       if (stripes >= LOV_ALL_STRIPES_MIN && stripes <= LOV_ALL_STRIPES_MAX)
                stripes = 0;
 
        if (lmm_magic == LOV_USER_MAGIC_V1)
index 3878d3b..c0a7959 100644 (file)
@@ -2729,7 +2729,8 @@ __u16 lod_comp_entry_stripe_count(struct lod_object *lo, int comp_idx,
        entry = &lo->ldo_comp_entries[comp_idx];
        if (lod_comp_inited(entry))
                return entry->llc_stripe_count;
-       if (entry->llc_stripe_count == LOV_ALL_STRIPES)
+       if (entry->llc_stripe_count >= LOV_ALL_STRIPES_MIN &&
+            entry->llc_stripe_count <= LOV_ALL_STRIPES_MAX)
                return lod_get_stripe_count_plain(lod, lo,
                                                  entry->llc_stripe_count,
                                                  entry->llc_pattern &
@@ -2883,7 +2884,8 @@ static int lod_declare_layout_add(const struct lu_env *env,
                    (lod_comp_inited(lod_comp) ||
                     lod_comp->llc_extent.e_start <
                     lod_comp->llc_extent.e_end) &&
-                   lod_comp->llc_stripe_count != LOV_ALL_STRIPES &&
+                    !(lod_comp->llc_stripe_count >= LOV_ALL_STRIPES_MIN &&
+                      lod_comp->llc_stripe_count <= LOV_ALL_STRIPES_MAX) &&
                    ext->e_end != OBD_OBJECT_EOF &&
                    (__u64)(lod_comp->llc_stripe_count *
                            lod_comp->llc_stripe_size) >
index 8adc06c..c46c54e 100644 (file)
@@ -2070,19 +2070,28 @@ __u16 lod_get_stripe_count_plain(struct lod_device *lod, struct lod_object *lo,
 {
        struct lov_desc *lov_desc = &lod->lod_ost_descs.ltd_lov_desc;
 
-       if (!stripe_count)
-               stripe_count = lov_desc->ld_default_stripe_count;
-
        /* Overstriping allows more stripes than targets */
-       if (stripe_count > lov_desc->ld_active_tgt_count && !overstriping) {
-               *flags |= LOD_USES_DEFAULT_STRIPE;
-               if (stripe_count == LOV_ALL_STRIPES && lod->lod_max_stripecount)
-                       stripe_count = lod->lod_max_stripecount;
-               else
-                       stripe_count = lov_desc->ld_active_tgt_count;
+       if (stripe_count > lov_desc->ld_active_tgt_count) {
+               if (overstriping) {
+                       if (stripe_count >= LOV_ALL_STRIPES_MIN &&
+                               stripe_count <= LOV_ALL_STRIPES_MAX) {
+                               stripe_count =
+                               ((stripe_count - LOV_ALL_STRIPES_MIN) + 1) *
+                               lov_desc->ld_active_tgt_count;
+                       }
+               } else {
+                       *flags |= LOD_USES_DEFAULT_STRIPE;
+                       if ((stripe_count >= LOV_ALL_STRIPES_MIN &&
+                            stripe_count <= LOV_ALL_STRIPES_MAX) &&
+                            lod->lod_max_stripecount)
+                               stripe_count = lod->lod_max_stripecount;
+                       else
+                               stripe_count = lov_desc->ld_active_tgt_count;
+               }
        }
+
        if (!stripe_count)
-               stripe_count = 1;
+               stripe_count = lov_desc->ld_default_stripe_count;
 
        if (overstriping && stripe_count > LOV_MAX_STRIPE_COUNT)
                stripe_count = LOV_MAX_STRIPE_COUNT;
@@ -2301,7 +2310,8 @@ int lod_use_defined_striping(const struct lu_env *env,
                    (lod_comp_inited(lod_comp) ||
                     lod_comp->llc_extent.e_start <
                     lod_comp->llc_extent.e_end) &&
-                   lod_comp->llc_stripe_count != LOV_ALL_STRIPES &&
+                   !(lod_comp->llc_stripe_count >= LOV_ALL_STRIPES_MIN &&
+                     lod_comp->llc_stripe_count <= LOV_ALL_STRIPES_MAX) &&
                    lod_comp->llc_extent.e_end != OBD_OBJECT_EOF &&
                    (__u64)lod_comp->llc_stripe_count *
                           lod_comp->llc_stripe_size >
@@ -2596,7 +2606,8 @@ int lod_qos_parse_config(const struct lu_env *env, struct lod_object *lo,
                 */
                if (lo->ldo_is_composite &&
                    !(lod_comp->llc_flags & LCME_FL_EXTENSION) &&
-                   lod_comp->llc_stripe_count != LOV_ALL_STRIPES &&
+                   !(lod_comp->llc_stripe_count >= LOV_ALL_STRIPES_MIN &&
+                     lod_comp->llc_stripe_count <= LOV_ALL_STRIPES_MAX) &&
                    (lod_comp_inited(lod_comp) ||
                     lod_comp->llc_extent.e_start <
                     lod_comp->llc_extent.e_end) &&
index f9051a0..051e048 100644 (file)
@@ -68,6 +68,8 @@ do {                                                                  \
                DIE("assertion '%s' failed: "fmt, #cond, ## __VA_ARGS__);\
 } while (0)                                                            \
 
+#define IN_RANGE(value, low, high) ((value >= low) && (value <= high))
+
 static char *lustre_dir;
 static char *poolname;
 static bool run_list_provided;
@@ -722,7 +724,7 @@ static void test16(void)
        rc = llapi_layout_stripe_count_get(filelayout, &fcount);
        ASSERTF(rc == 0, "errno = %d", errno);
        ASSERTF(fcount == dcount || dcount == LLAPI_LAYOUT_DEFAULT ||
-               dcount == LLAPI_LAYOUT_WIDE,
+               IN_RANGE(dcount, LLAPI_LAYOUT_WIDE_MIN, LLAPI_LAYOUT_WIDE_MAX),
                "%"PRIu64" != %"PRIu64, fcount, dcount);
 
        rc = llapi_layout_stripe_size_get(filelayout, &fsize);
@@ -745,7 +747,7 @@ static void test16(void)
        rc = llapi_layout_stripe_size_get(filelayout, &fsize);
        ASSERTF(rc == 0, "errno = %d", errno);
        ASSERTF(fcount == dcount || dcount == LLAPI_LAYOUT_DEFAULT ||
-               dcount == LLAPI_LAYOUT_WIDE,
+               IN_RANGE(dcount, LLAPI_LAYOUT_WIDE_MIN, LLAPI_LAYOUT_WIDE_MAX),
                "%"PRIu64" != %"PRIu64, fcount, dcount);
        ASSERTF(fsize == dsize, "%"PRIu64" != %"PRIu64, fsize, dsize);
 
@@ -771,7 +773,7 @@ static void test17(void)
        ASSERTF(rc == 0 || errno == ENOENT, "errno = %d", errno);
        layout = llapi_layout_alloc();
        ASSERTF(layout != NULL, "errno = %d", errno);
-       rc = llapi_layout_stripe_count_set(layout, LLAPI_LAYOUT_WIDE);
+       rc = llapi_layout_stripe_count_set(layout, LLAPI_LAYOUT_WIDE_MIN);
        ASSERTF(rc == 0, "errno = %d", errno);
        fd = llapi_layout_file_create(path, 0, 0640, layout);
        ASSERTF(fd >= 0, "errno = %d", errno);
@@ -905,7 +907,7 @@ static void test20(void)
        rc = llapi_layout_stripe_count_get(deflayout, &dcount);
        ASSERTF(rc == 0, "errno = %d", errno);
        ASSERTF(fcount == dcount || dcount == LLAPI_LAYOUT_DEFAULT ||
-               dcount == LLAPI_LAYOUT_WIDE,
+               IN_RANGE(dcount, LLAPI_LAYOUT_WIDE_MIN, LLAPI_LAYOUT_WIDE_MAX),
                "%"PRIu64" != %"PRIu64, fcount, dcount);
 
        rc = llapi_layout_stripe_size_get(filelayout, &fsize);
@@ -1214,7 +1216,9 @@ static void test28(void)
 
        rc = llapi_layout_stripe_count_get(layout, &count);
        ASSERTF(rc == 0, "errno = %d\n", errno);
-       ASSERTF(count == LLAPI_LAYOUT_WIDE, "count = %"PRIu64"\n", count);
+       ASSERTF((count >= LLAPI_LAYOUT_WIDE_MIN &&
+                count <= LLAPI_LAYOUT_WIDE_MAX),
+                "count = %"PRIu64"\n", count);
 
        llapi_layout_free(layout);
 }
index 371cc2b..ed0526c 100644 (file)
@@ -499,7 +499,13 @@ test_0c() {
        # verify components ${ids[6]}, ${ids[8]} and ${ids[10]}
        for i in 6 8 10; do
                verify_comp_attr stripe-size $tf ${ids[$i]} 16777216
-               verify_comp_attr stripe-count $tf ${ids[$i]} -1
+               # ffdf which is -33 and matches LOV_ALL_STRIPES_MIN
+               local decimal_lov_lower_limit=-33
+               #C_opt is -c option which can be -1 to -32
+               local C_opt=-1
+               local count_exp=$(($decimal_lov_lower_limit + $C_opt + 1))
+
+               verify_comp_attr stripe-count $tf ${ids[$i]} $count_exp
                verify_comp_attr pool $tf ${ids[$i]} archive
                verify_comp_extent $tf ${ids[$i]} 536870912 EOF
        done
@@ -709,7 +715,13 @@ test_0f() {
        # verify components ${ids[9]}, ${ids[11]} and ${ids[13]}
        for i in 9 11 13; do
                verify_comp_attr stripe-size $tf ${ids[$i]} 16777216
-               verify_comp_attr stripe-count $tf ${ids[$i]} -1
+               # ffdf which is -33 and matches LOV_ALL_STRIPES_MIN
+               local decimal_lov_lower_limit=-33
+               #C_opt is -c option which can be -1 to -32
+               local C_opt=-1
+               local count_exp=$(($decimal_lov_lower_limit + $C_opt + 1))
+
+               verify_comp_attr stripe-count $tf ${ids[$i]} $count_exp
                verify_comp_attr pool $tf ${ids[$i]} archive
                verify_comp_extent $tf ${ids[$i]} 536870912 EOF
        done
index a375ff9..dbe6116 100755 (executable)
@@ -2624,6 +2624,25 @@ test_27Ci() {
 }
 run_test 27Ci "add an overstriping component"
 
+test_27Cj() {
+       [[ $($LCTL get_param mdc.*.import) =~ connect_flags.*overstriping ]] ||
+               skip "server does not support overstriping"
+       (( $MDS1_VERSION >= $(version_code 2.15.61.76) )) ||
+               skip "need MDS >= 2.15.61.76"
+
+       stack_trap "rm -f $DIR/$tfile"
+       # start_full_debug_logging
+       # number of stripes created will be 32*ost count
+       $LFS setstripe  -C -32 $DIR/$tfile || error "create $tfile failed"
+       local count=$($LFS getstripe -c $DIR/$tfile)
+       local stripe_cnt=$(($OSTCOUNT * 32))
+       (( $count == $stripe_cnt )) ||
+               error "$DIR/$tfile stripe count $count != $OSTCOUNT"
+       #check that beyond -32 it fails
+       !($LFS setstripe  -C -34 $DIR/$tfile) || error "setstripe should fail"
+}
+run_test 27Cj "overstriping with -C for max values in multiple of targets"
+
 test_27D() {
        [ $OSTCOUNT -lt 2 ] && skip_env "needs >= 2 OSTs"
        [ -n "$FILESET" ] && skip "SKIP due to FILESET set"
index b40d7f2..a5f23c1 100644 (file)
@@ -2748,7 +2748,8 @@ static int lsa_args_stripe_count_check(struct lfs_setstripe_args *lsa)
 
                if (lsa->lsa_stripe_count > 0 &&
                    lsa->lsa_stripe_count != LLAPI_LAYOUT_DEFAULT &&
-                   lsa->lsa_stripe_count != LLAPI_LAYOUT_WIDE &&
+                   !(lsa->lsa_stripe_count >= LLAPI_LAYOUT_WIDE_MIN &&
+                    lsa->lsa_stripe_count <= LLAPI_LAYOUT_WIDE_MAX) &&
                    lsa->lsa_nr_tgts != lsa->lsa_stripe_count) {
                        fprintf(stderr, "stripe_count(%lld) != nr_tgts(%d)\n",
                                lsa->lsa_stripe_count,
@@ -3848,7 +3849,7 @@ static int lfs_setstripe_internal(int argc, char **argv,
                        errno = 0;
                        lsa.lsa_stripe_count = strtoul(optarg, &end, 0);
                        if (errno != 0 || *end != '\0'|| optarg == end ||
-                           lsa.lsa_stripe_count < -1 ||
+                           lsa.lsa_stripe_count < LLAPI_MAX_STRIPE_COUNT ||
                            lsa.lsa_stripe_count > LOV_MAX_STRIPE_COUNT) {
                                fprintf(stderr,
                                        "%s %s: invalid stripe count '%s'\n",
@@ -3856,8 +3857,11 @@ static int lfs_setstripe_internal(int argc, char **argv,
                                goto usage_error;
                        }
 
-                       if (lsa.lsa_stripe_count == -1)
-                               lsa.lsa_stripe_count = LLAPI_LAYOUT_WIDE;
+                       if (lsa.lsa_stripe_count <= LLAPI_MIN_STRIPE_COUNT &&
+                           lsa.lsa_stripe_count >= LLAPI_MAX_STRIPE_COUNT) {
+                               lsa.lsa_stripe_count = LLAPI_LAYOUT_WIDE_MIN +
+                                   abs(lsa.lsa_stripe_count + 1);
+                       }
                        break;
                case 'd':
                        if (migrate_mode) {
@@ -4444,8 +4448,10 @@ static int lfs_setstripe_internal(int argc, char **argv,
                if (lsa.lsa_stripe_size != LLAPI_LAYOUT_DEFAULT)
                        param->lsp_stripe_size = lsa.lsa_stripe_size;
                if (lsa.lsa_stripe_count != LLAPI_LAYOUT_DEFAULT) {
-                       if (lsa.lsa_stripe_count == LLAPI_LAYOUT_WIDE)
-                               param->lsp_stripe_count = -1;
+                       if (lsa.lsa_stripe_count >= LLAPI_LAYOUT_WIDE_MIN &&
+                               lsa.lsa_stripe_count < LLAPI_LAYOUT_WIDE_MAX)
+                               param->lsp_stripe_count = LOV_ALL_STRIPES_MIN +
+                               (lsa.lsa_stripe_count - LLAPI_LAYOUT_WIDE_MIN);
                        else
                                param->lsp_stripe_count = lsa.lsa_stripe_count;
                }
@@ -7073,7 +7079,7 @@ static int mntdf(char *mntdir, char *fsname, char *pool, enum mntdf_flags flags,
                if (!(tp->st_op & ops))
                        continue;
 
-               for (index = 0; index < LOV_ALL_STRIPES &&
+               for (index = 0; index < LOV_ALL_STRIPES_MAX &&
                     (!lsb || lsb->sb_count < LL_STATFS_MAX); index++) {
                        memset(&stat_buf, 0, sizeof(struct obd_statfs));
                        memset(&uuid_buf, 0, sizeof(struct obd_uuid));
@@ -7252,7 +7258,7 @@ static int lfs_setdirstripe(int argc, char **argv)
                        errno = 0;
                        lsa.lsa_stripe_count = strtoul(optarg, &end, 0);
                        if (errno != 0 || *end != '\0' ||
-                           lsa.lsa_stripe_count < -1 ||
+                           lsa.lsa_stripe_count < LLAPI_MAX_STRIPE_COUNT ||
                            lsa.lsa_stripe_count > LOV_MAX_STRIPE_COUNT) {
                                fprintf(stderr,
                                        "%s: invalid stripe count '%s'\n",
index 640cc7d..5db3d94 100644 (file)
@@ -683,8 +683,12 @@ struct llapi_layout *llapi_layout_get_by_xattr(void *lov_xattr,
                else
                        comp->llc_stripe_size = v1->lmm_stripe_size;
 
-               if (v1->lmm_stripe_count == (typeof(v1->lmm_stripe_count))-1)
-                       comp->llc_stripe_count = LLAPI_LAYOUT_WIDE;
+               if (v1->lmm_stripe_count >= (typeof(v1->lmm_stripe_count))
+                    LOV_ALL_STRIPES_MIN && v1->lmm_stripe_count <=
+                    (typeof(v1->lmm_stripe_count)) LOV_ALL_STRIPES_MAX)
+                       comp->llc_stripe_count =
+                       LLAPI_LAYOUT_WIDE_MIN +
+                       (v1->lmm_stripe_count -  LOV_ALL_STRIPES_MIN);
                else if (v1->lmm_stripe_count == 0)
                        comp->llc_stripe_count = LLAPI_LAYOUT_DEFAULT;
                else
@@ -870,8 +874,11 @@ llapi_layout_to_lum(const struct llapi_layout *layout)
 
                if (comp->llc_stripe_count == LLAPI_LAYOUT_DEFAULT)
                        blob->lmm_stripe_count = 0;
-               else if (comp->llc_stripe_count == LLAPI_LAYOUT_WIDE)
-                       blob->lmm_stripe_count = LOV_ALL_STRIPES;
+               else if (comp->llc_stripe_count >= LLAPI_LAYOUT_WIDE_MIN &&
+                        comp->llc_stripe_count <= LLAPI_LAYOUT_WIDE_MAX) {
+                       blob->lmm_stripe_count = LOV_ALL_STRIPES_MIN +
+                       (comp->llc_stripe_count - LLAPI_LAYOUT_WIDE_MIN);
+               }
                else
                        blob->lmm_stripe_count = comp->llc_stripe_count;
 
@@ -1300,8 +1307,11 @@ int llapi_layout_stripe_count_get(const struct llapi_layout *layout,
 bool llapi_layout_stripe_count_is_valid(int64_t stripe_count)
 {
        return stripe_count == LLAPI_LAYOUT_DEFAULT ||
-               stripe_count == LLAPI_LAYOUT_WIDE ||
-               (stripe_count != 0 && stripe_count != -1 &&
+               (stripe_count >= LLAPI_LAYOUT_WIDE_MIN &&
+                stripe_count <= LLAPI_LAYOUT_WIDE_MAX) ||
+               (stripe_count != 0 && !(stripe_count <=
+                LLAPI_MIN_STRIPE_COUNT &&
+                stripe_count >= LLAPI_MAX_STRIPE_COUNT) &&
                 llapi_stripe_count_is_valid(stripe_count));
 }
 
@@ -1349,7 +1359,6 @@ int llapi_layout_stripe_count_set(struct llapi_layout *layout,
                errno = EINVAL;
                return -1;
        }
-
        comp->llc_stripe_count = count;
 
        return 0;
index 38ce395..0cea0d5 100644 (file)
@@ -129,7 +129,8 @@ static inline bool llapi_stripe_size_is_too_big(uint64_t size)
 
 static inline bool llapi_stripe_count_is_valid(int64_t count)
 {
-       return count >= -1 && count <= LOV_MAX_STRIPE_COUNT;
+       return (count >= LOV_ALL_STRIPES_MIN && count <= LOV_ALL_STRIPES_MAX) ||
+                  count <= LOV_MAX_STRIPE_COUNT;
 }
 
 static inline bool llapi_stripe_index_is_valid(int64_t index)