Whamcloud - gitweb
LU-9611 lod: allow -1 for default stripe count/offset 73/27473/3
authorAndreas Dilger <andreas.dilger@intel.com>
Tue, 6 Jun 2017 21:38:15 +0000 (15:38 -0600)
committerOleg Drokin <oleg.drokin@intel.com>
Fri, 16 Jun 2017 16:57:02 +0000 (16:57 +0000)
Since LU-7344 patch http://review.whamcloud.com/16930 was landed,
lod_stripeoffset_seq_write() and lod_stripecount_seq_write() have
incorrectly checked that lod.*.stripecount and lod.*.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

Add comment blocks to lod_fix_desc_stripe*() to indicate their use.
Fix these functions to allow "-1" as a valid value.
Fix the error message to properly indicate which device is being
modified, in case multiple filesystems are mounted.

Signed-off-by: Andreas Dilger <andreas.dilger@intel.com>
Change-Id: I295d2591d535b039634689524a29725e96ce2c01
Reviewed-on: https://review.whamcloud.com/27473
Tested-by: Jenkins
Tested-by: Maloo <hpdd-maloo@intel.com>
Reviewed-by: Emoly Liu <emoly.liu@intel.com>
Reviewed-by: Giuseppe Di Natale <dinatale2@llnl.gov>
Reviewed-by: Oleg Drokin <oleg.drokin@intel.com>
lustre/lod/lod_lov.c
lustre/lod/lproc_lod.c
lustre/obdclass/obd_config.c

index 671b768..43375f2 100644 (file)
@@ -1718,6 +1718,15 @@ int lod_verify_striping(struct lod_device *d, const struct lu_buf *buf,
        RETURN(rc);
 }
 
+/**
+ * set the default stripe size, if unset.
+ *
+ * \param[in,out] val  number of bytes per OST stripe
+ *
+ * The minimum stripe size is 64KB to ensure that a single stripe is an
+ * even multiple of a client PAGE_SIZE (IA64, PPC, etc).  Otherwise, it
+ * is difficult to split dirty pages across OSCs during writes.
+ */
 void lod_fix_desc_stripe_size(__u64 *val)
 {
        if (*val < LOV_MIN_STRIPE_SIZE) {
@@ -1734,12 +1743,30 @@ void lod_fix_desc_stripe_size(__u64 *val)
        }
 }
 
+/**
+ * set the filesystem default number of stripes, if unset.
+ *
+ * \param[in,out] val  number of stripes
+ *
+ * A value of "0" means "use the system-wide default stripe count", which
+ * has either been inherited by now, or falls back to 1 stripe per file.
+ * A value of "-1" (0xffffffff) means "stripe over all available OSTs",
+ * and is a valid value, so is left unchanged here.
+ */
 void lod_fix_desc_stripe_count(__u32 *val)
 {
        if (*val == 0)
                *val = 1;
 }
 
+/**
+ * set the filesystem default layout pattern
+ *
+ * \param[in,out] val  LOV_PATTERN_* layout
+ *
+ * A value of "0" means "use the system-wide default layout type", which
+ * has either been inherited by now, or falls back to plain RAID0 striping.
+ */
 void lod_fix_desc_pattern(__u32 *val)
 {
        /* from lov_setstripe */
index 06dd2ee..3347a4d 100644 (file)
@@ -154,7 +154,7 @@ lod_stripeoffset_seq_write(struct file *file, const char __user *buffer,
        rc = lprocfs_str_with_units_to_s64(buffer, count, &val, '1');
        if (rc)
                return rc;
-       if (val < 0)
+       if (val < -1)
                return -ERANGE;
 
        lod->lod_desc.ld_default_stripe_offset = val;
@@ -271,7 +271,7 @@ lod_stripecount_seq_write(struct file *file, const char __user *buffer,
        rc = lprocfs_str_to_s64(buffer, count, &val);
        if (rc)
                return rc;
-       if (val < 0)
+       if (val < -1)
                return -ERANGE;
 
        stripe_count = val;
index 0557d82..193c8c6 100644 (file)
@@ -1383,8 +1383,10 @@ int class_process_proc_param(char *prefix, struct lprocfs_vars *lvars,
                         * can pass it down the stack */
                        RETURN(-ENOSYS);
                sval = strchr(key, '=');
-               if (!sval || (*(sval + 1) == 0)) {
-                       CERROR("Can't parse param %s (missing '=')\n", key);
+               if (!sval || *(sval + 1) == 0) {
+                       CERROR("%s: can't parse param '%s' (missing '=')\n",
+                              lustre_cfg_string(lcfg, 0),
+                              lustre_cfg_string(lcfg, i));
                        /* rc = -EINVAL;        continue parsing other params */
                        continue;
                }
@@ -1419,20 +1421,18 @@ int class_process_proc_param(char *prefix, struct lprocfs_vars *lvars,
                        if (strncmp("sec_level", key, keylen) == 0)
                                continue;
 
-                       CERROR("%.*s: %s unknown param %s\n",
-                              (int)strlen(prefix) - 1, prefix,
-                              (char *)lustre_cfg_string(lcfg, 0), key);
+                       CERROR("%s: unknown config parameter '%s'\n",
+                              lustre_cfg_string(lcfg, 0),
+                              lustre_cfg_string(lcfg, i));
                        /* rc = -EINVAL;        continue parsing other params */
                        skip++;
                } else if (rc < 0) {
-                       CERROR("%s: error writing proc entry '%s': rc = %d\n",
-                              prefix, var->name, rc);
+                       CERROR("%s: error writing proc '%s'='%s': rc = %d\n",
+                              lustre_cfg_string(lcfg, 0), key, sval, rc);
                        rc = 0;
                } else {
-                       CDEBUG(D_CONFIG, "%s.%.*s: Set parameter %.*s=%s\n",
-                                        lustre_cfg_string(lcfg, 0),
-                                        (int)strlen(prefix) - 1, prefix,
-                                        (int)(sval - key - 1), key, sval);
+                       CDEBUG(D_CONFIG, "%s: Set parameter '%s'='%s'\n",
+                              lustre_cfg_string(lcfg, 0), key, sval);
                }
        }