From: Andreas Dilger Date: Thu, 6 Jul 2017 06:55:08 +0000 (-0600) Subject: LU-9611 lov: allow lov.*.stripe{size,count}=-1 param X-Git-Tag: 2.10.55~12 X-Git-Url: https://git.whamcloud.com/?a=commitdiff_plain;h=f93276d9a5b5df475c9f6007265692632d8e7222;p=fs%2Flustre-release.git LU-9611 lov: allow lov.*.stripe{size,count}=-1 param Since LU-7344 patch http://review.whamcloud.com/16930 was landed, lov_stripeoffset_seq_write() and lov_stripecount_seq_write() have incorrectly checked that lov.*.stripecount and lov.*.stripeoffset are not negative. In fact they can both be "-1" to indicate that the filesystem-wide default value should be used. These parameters can also be set internally if using "lfs setstripe -c -1 $MOUNT" or "lfs setstripe -i -1 $MOUNT" to set the system wide default, generating console errors on the MDS from class_process_proc_param(): lov.: error writing proc entry 'stripecount': rc = -34 lov.: error writing proc entry 'stripeoffset': rc = -34 Fix these functions to allow "-1" as a valid value. Signed-off-by: Andreas Dilger Change-Id: I295d2591d535b039634689524a29725e963ebbe5 Reviewed-on: https://review.whamcloud.com/27946 Tested-by: Jenkins Tested-by: Maloo Reviewed-by: James Simmons Reviewed-by: Jian Yu Reviewed-by: John L. Hammond Reviewed-by: Oleg Drokin --- diff --git a/lustre/include/uapi/linux/lustre/lustre_idl.h b/lustre/include/uapi/linux/lustre/lustre_idl.h index 9d76020..b8763df 100644 --- a/lustre/include/uapi/linux/lustre/lustre_idl.h +++ b/lustre/include/uapi/linux/lustre/lustre_idl.h @@ -2046,17 +2046,17 @@ struct mdt_rec_reint { /* lmv structures */ struct lmv_desc { - __u32 ld_tgt_count; /* how many MDS's */ - __u32 ld_active_tgt_count; /* how many active */ - __u32 ld_default_stripe_count; /* how many objects are used */ - __u32 ld_pattern; /* default hash pattern */ - __u64 ld_default_hash_size; - __u64 ld_padding_1; /* also fix lustre_swab_lmv_desc */ - __u32 ld_padding_2; /* also fix lustre_swab_lmv_desc */ - __u32 ld_qos_maxage; /* in second */ - __u32 ld_padding_3; /* also fix lustre_swab_lmv_desc */ - __u32 ld_padding_4; /* also fix lustre_swab_lmv_desc */ - struct obd_uuid ld_uuid; + __u32 ld_tgt_count; /* how many MDS's */ + __u32 ld_active_tgt_count; /* how many active */ + __u32 ld_default_stripe_count; /* how many objects are used */ + __u32 ld_pattern; /* default hash pattern */ + __u64 ld_default_hash_size; + __u64 ld_padding_1; /* also fix lustre_swab_lmv_desc */ + __u32 ld_padding_2; /* also fix lustre_swab_lmv_desc */ + __u32 ld_qos_maxage; /* in second */ + __u32 ld_padding_3; /* also fix lustre_swab_lmv_desc */ + __u32 ld_padding_4; /* also fix lustre_swab_lmv_desc */ + struct obd_uuid ld_uuid; }; /* LMV layout EA, and it will be stored both in master and slave object */ @@ -2227,17 +2227,17 @@ typedef enum { /* LOV settings descriptor (should only contain static info) */ struct lov_desc { - __u32 ld_tgt_count; /* how many OBD's */ - __u32 ld_active_tgt_count; /* how many active */ - __u32 ld_default_stripe_count; /* how many objects are used */ - __u32 ld_pattern; /* default PATTERN_RAID0 */ - __u64 ld_default_stripe_size; /* in bytes */ - __u64 ld_default_stripe_offset; /* in bytes */ - __u32 ld_padding_0; /* unused */ - __u32 ld_qos_maxage; /* in second */ - __u32 ld_padding_1; /* also fix lustre_swab_lov_desc */ - __u32 ld_padding_2; /* also fix lustre_swab_lov_desc */ - struct obd_uuid ld_uuid; + __u32 ld_tgt_count; /* how many OBD's */ + __u32 ld_active_tgt_count; /* how many active */ + __s32 ld_default_stripe_count; /* how many objects are used */ + __u32 ld_pattern; /* default PATTERN_RAID0 */ + __u64 ld_default_stripe_size; /* in bytes */ + __s64 ld_default_stripe_offset; /* starting OST index */ + __u32 ld_padding_0; /* unused */ + __u32 ld_qos_maxage; /* in second */ + __u32 ld_padding_1; /* also fix lustre_swab_lov_desc */ + __u32 ld_padding_2; /* also fix lustre_swab_lov_desc */ + struct obd_uuid ld_uuid; }; #define ld_magic ld_active_tgt_count /* for swabbing from llogs */ diff --git a/lustre/lod/lproc_lod.c b/lustre/lod/lproc_lod.c index 8003fb6..ea17bac 100644 --- a/lustre/lod/lproc_lod.c +++ b/lustre/lod/lproc_lod.c @@ -120,8 +120,7 @@ static int lod_stripeoffset_seq_show(struct seq_file *m, void *v) LASSERT(dev != NULL); lod = lu2lod_dev(dev->obd_lu_dev); - seq_printf(m, "%llu\n", - lod->lod_desc.ld_default_stripe_offset); + seq_printf(m, "%lld\n", lod->lod_desc.ld_default_stripe_offset); return 0; } @@ -151,7 +150,7 @@ lod_stripeoffset_seq_write(struct file *file, const char __user *buffer, LASSERT(dev != NULL); lod = lu2lod_dev(dev->obd_lu_dev); - rc = lprocfs_str_with_units_to_s64(buffer, count, &val, '1'); + rc = lprocfs_str_to_s64(buffer, count, &val); if (rc) return rc; if (val < -1) diff --git a/lustre/lov/lproc_lov.c b/lustre/lov/lproc_lov.c index 1a18e40..fb91183 100644 --- a/lustre/lov/lproc_lov.c +++ b/lustre/lov/lproc_lov.c @@ -82,7 +82,7 @@ static int lov_stripeoffset_seq_show(struct seq_file *m, void *v) LASSERT(dev != NULL); desc = &dev->u.lov.desc; - seq_printf(m, "%llu\n", desc->ld_default_stripe_offset); + seq_printf(m, "%lld\n", desc->ld_default_stripe_offset); return 0; } @@ -100,7 +100,7 @@ static ssize_t lov_stripeoffset_seq_write(struct file *file, rc = lprocfs_str_to_s64(buffer, count, &val); if (rc) return rc; - if (val < 0) + if (val < -1) return -ERANGE; desc->ld_default_stripe_offset = val; @@ -172,7 +172,7 @@ static ssize_t lov_stripecount_seq_write(struct file *file, rc = lprocfs_str_to_s64(buffer, count, &val); if (rc) return rc; - if (val < 0) + if (val < -1) return -ERANGE; stripe_count = val; diff --git a/lustre/obdclass/obd_config.c b/lustre/obdclass/obd_config.c index 81754de..ea7f631 100644 --- a/lustre/obdclass/obd_config.c +++ b/lustre/obdclass/obd_config.c @@ -1371,12 +1371,12 @@ int class_process_proc_param(char *prefix, struct lprocfs_vars *lvars, /* rc = -EINVAL; continue parsing other params */ skip++; } else if (rc < 0) { - CERROR("%s: error writing proc '%s'='%s': rc = %d\n", - lustre_cfg_string(lcfg, 0), key, sval, rc); + CERROR("%s: error writing parameter '%s': rc = %d\n", + lustre_cfg_string(lcfg, 0), key, rc); rc = 0; } else { - CDEBUG(D_CONFIG, "%s: Set parameter '%s'='%s'\n", - lustre_cfg_string(lcfg, 0), key, sval); + CDEBUG(D_CONFIG, "%s: set parameter '%s'\n", + lustre_cfg_string(lcfg, 0), key); } }