summary |
shortlog |
log |
commit | commitdiff |
tree
raw |
patch |
inline | side by side (from parent 1:
eb2a52d)
The build version checking in lfs_getstripe() and lfs_find() was
incorrectly using LUSTRE_VERSION instead of LUSTRE_VERSION_CODE.
The old "positional" parameters for "lfs setstripe" have long been
deprecated and are now being removed. The "--offset" and "--index"
options were not correctly being deprecated since 2.4.50 as intended.
Remove the code and conditions for already-passed build versions,
and fix the remaining checks to use LUSTRE_VERSION_CODE. Fix one
test that was using a deprecated option.
Signed-off-by: Andreas Dilger <andreas.dilger@intel.com>
Signed-off-by: Bob Glossman <bob.glossman@intel.com>
Change-Id: I086c869ea5b3ba6c1f83cc2b6ce2c866b43ebbe5
Reviewed-on: http://review.whamcloud.com/8631
Tested-by: Jenkins
Reviewed-by: John L. Hammond <john.hammond@intel.com>
Tested-by: Maloo <hpdd-maloo@intel.com>
"abort recovery on a restarting MDT or OST device\n"},
{"set_timeout", jt_lcfg_set_timeout, 0,
"usage: conf_param obd_timeout=<secs>\n"},
"abort recovery on a restarting MDT or OST device\n"},
{"set_timeout", jt_lcfg_set_timeout, 0,
"usage: conf_param obd_timeout=<secs>\n"},
-#if LUSTRE_VERSION >= OBD_OCD_VERSION(3,0,53,0)
-#warning "remove conf_param option"
-#else
+#if LUSTRE_VERSION_CODE < OBD_OCD_VERSION(3, 0, 53, 0)
{"conf_param", jt_lcfg_mgsparam, 0,"set a permanent config parameter.\n"
"This command must be run on the MGS node\n"
"usage: conf_param [-d] <target.keyword=val>\n"
{"conf_param", jt_lcfg_mgsparam, 0,"set a permanent config parameter.\n"
"This command must be run on the MGS node\n"
"usage: conf_param [-d] <target.keyword=val>\n"
-static int isnumber(const char *str)
-{
- const char *ptr;
-
- if (str[0] != '-' && !isdigit(str[0]))
- return 0;
-
- for (ptr = str + 1; *ptr != '\0'; ptr++) {
- if (!isdigit(*ptr))
- return 0;
- }
-
- return 1;
-}
-
#define MIGRATION_BLOCKS 1
static int lfs_migrate(char *name, unsigned long long stripe_size,
#define MIGRATION_BLOCKS 1
static int lfs_migrate(char *name, unsigned long long stripe_size,
struct option long_opts[] = {
/* valid only in migrate mode */
{"block", no_argument, 0, 'b'},
struct option long_opts[] = {
/* valid only in migrate mode */
{"block", no_argument, 0, 'b'},
-#if LUSTRE_VERSION >= OBD_OCD_VERSION(2,9,50,0)
-#warning "remove deprecated --count option"
-#else
+#if LUSTRE_VERSION_CODE < OBD_OCD_VERSION(2, 9, 53, 0)
/* This formerly implied "stripe-count", but was explicitly
* made "stripe-count" for consistency with other options,
* and to separate it from "mdt-count" when DNE arrives. */
/* This formerly implied "stripe-count", but was explicitly
* made "stripe-count" for consistency with other options,
* and to separate it from "mdt-count" when DNE arrives. */
{"stripe-count", required_argument, 0, 'c'},
{"stripe_count", required_argument, 0, 'c'},
{"delete", no_argument, 0, 'd'},
{"stripe-count", required_argument, 0, 'c'},
{"stripe_count", required_argument, 0, 'c'},
{"delete", no_argument, 0, 'd'},
-#if LUSTRE_VERSION >= OBD_OCD_VERSION(2,9,50,0)
-#warning "remove deprecated --index option"
-#else
+#if LUSTRE_VERSION_CODE < OBD_OCD_VERSION(2, 9, 53, 0)
/* This formerly implied "stripe-index", but was explicitly
* made "stripe-index" for consistency with other options,
* and to separate it from "mdt-index" when DNE arrives. */
/* This formerly implied "stripe-index", but was explicitly
* made "stripe-index" for consistency with other options,
* and to separate it from "mdt-index" when DNE arrives. */
#endif
{"stripe-index", required_argument, 0, 'i'},
{"stripe_index", required_argument, 0, 'i'},
#endif
{"stripe-index", required_argument, 0, 'i'},
{"stripe_index", required_argument, 0, 'i'},
-#if LUSTRE_VERSION >= OBD_OCD_VERSION(2,9,50,0)
-#warning "remove deprecated --offset option"
-#else
+#if LUSTRE_VERSION_CODE < OBD_OCD_VERSION(2, 9, 53, 0)
/* This formerly implied "stripe-index", but was confusing
* with "file offset" (which will eventually be needed for
* with different layouts by offset), so deprecate it. */
/* This formerly implied "stripe-index", but was confusing
* with "file offset" (which will eventually be needed for
* with different layouts by offset), so deprecate it. */
- {"offset", required_argument, 0, 'o'},
+ {"offset", required_argument, 0, 'o'},
#endif
{"pool", required_argument, 0, 'p'},
#endif
{"pool", required_argument, 0, 'p'},
-#if LUSTRE_VERSION >= OBD_OCD_VERSION(2,9,50,0)
-#warning "remove deprecated --size option"
-#else
+#if LUSTRE_VERSION_CODE < OBD_OCD_VERSION(2, 9, 53, 0)
/* This formerly implied "--stripe-size", but was confusing
* with "lfs find --size|-s", which means "file size", so use
* the consistent "--stripe-size|-S" for all commands. */
/* This formerly implied "--stripe-size", but was confusing
* with "lfs find --size|-s", which means "file size", so use
* the consistent "--stripe-size|-S" for all commands. */
if (strcmp(argv[0], "migrate") == 0)
migrate_mode = 1;
if (strcmp(argv[0], "migrate") == 0)
migrate_mode = 1;
-#if LUSTRE_VERSION < OBD_OCD_VERSION(2,4,50,0)
- if (argc == 5 && argv[1][0] != '-' &&
- isnumber(argv[2]) && isnumber(argv[3]) && isnumber(argv[4])) {
- fprintf(stderr, "error: obsolete usage of setstripe "
- "positional parameters. Use -c, -i, -S instead.\n");
- return CMD_HELP;
- } else
-#else
-#warning "remove obsolete positional parameter error"
-#endif
- {
- optind = 0;
- while ((c = getopt_long(argc, argv, "c:di:o:p:s:S:",
- long_opts, NULL)) >= 0) {
- switch (c) {
- case 0:
- /* Long options. */
- break;
+ optind = 0;
+ while ((c = getopt_long(argc, argv, "c:di:o:p:s:S:",
+ long_opts, NULL)) >= 0) {
+ switch (c) {
+ case 0:
+ /* Long options. */
+ break;
case 'b':
if (migrate_mode == 0) {
fprintf(stderr, "--block is valid only for"
case 'b':
if (migrate_mode == 0) {
fprintf(stderr, "--block is valid only for"
}
migration_flags |= MIGRATION_BLOCKS;
break;
}
migration_flags |= MIGRATION_BLOCKS;
break;
- case 'c':
-#if LUSTRE_VERSION >= OBD_OCD_VERSION(2,9,50,0)
-#warning "remove deprecated --count option"
-#elif LUSTRE_VERSION >= OBD_OCD_VERSION(2,6,50,0)
- if (strcmp(argv[optind - 1], "--count") == 0)
- fprintf(stderr, "warning: '--count' deprecated"
- ", use '--stripe-count' instead\n");
+ case 'c':
+#if LUSTRE_VERSION_CODE >= OBD_OCD_VERSION(2, 6, 53, 0)
+ if (strcmp(argv[optind - 1], "--count") == 0)
+ fprintf(stderr, "warning: '--count' deprecated"
+ ", use '--stripe-count' instead\n");
- stripe_count_arg = optarg;
- break;
- case 'd':
- /* delete the default striping pattern */
- delete = 1;
- break;
- case 'o':
-#if LUSTRE_VERSION >= OBD_OCD_VERSION(2,4,50,0)
- fprintf(stderr, "warning: '--offset|-o' deprecated, "
- "use '--stripe-index|-i' instead\n");
-#else
- if (strcmp(argv[optind - 1], "--offset") == 0)
- /* need --stripe-index established first */
- fprintf(stderr, "warning: '--offset' deprecated"
- ", use '--index' instead\n");
+ stripe_count_arg = optarg;
+ break;
+ case 'd':
+ /* delete the default striping pattern */
+ delete = 1;
+ break;
+#if LUSTRE_VERSION_CODE < OBD_OCD_VERSION(2, 9, 53, 0)
+ case 'o':
+ fprintf(stderr, "warning: '--offset|-o' deprecated, "
+ "use '--stripe-index|-i' instead\n");
- case 'i':
-#if LUSTRE_VERSION >= OBD_OCD_VERSION(2,9,50,0)
-#warning "remove deprecated --offset and --index options"
-#elif LUSTRE_VERSION >= OBD_OCD_VERSION(2,6,50,0)
- if (strcmp(argv[optind - 1], "--index") == 0)
- fprintf(stderr, "warning: '--index' deprecated"
- ", use '--stripe-index' instead\n");
+ case 'i':
+#if LUSTRE_VERSION_CODE >= OBD_OCD_VERSION(2, 6, 53, 0)
+ if (strcmp(argv[optind - 1], "--index") == 0)
+ fprintf(stderr, "warning: '--index' deprecated"
+ ", use '--stripe-index' instead\n");
- stripe_off_arg = optarg;
- break;
- case 's':
-#if LUSTRE_VERSION >= OBD_OCD_VERSION(2,9,50,0)
-#warning "remove deprecated --size option"
-#elif LUSTRE_VERSION >= OBD_OCD_VERSION(2,6,50,0)
- fprintf(stderr, "warning: '--size|-s' deprecated, "
- "use '--stripe-size|-S' instead\n");
+ stripe_off_arg = optarg;
+ break;
+#if LUSTRE_VERSION_CODE < OBD_OCD_VERSION(2, 9, 53, 0)
+ case 's':
+#if LUSTRE_VERSION_CODE >= OBD_OCD_VERSION(2, 6, 53, 0)
+ fprintf(stderr, "warning: '--size|-s' deprecated, "
+ "use '--stripe-size|-S' instead\n");
- case 'S':
- stripe_size_arg = optarg;
- break;
- case 'p':
- pool_name_arg = optarg;
- break;
- default:
- return CMD_HELP;
- }
- }
+#endif /* LUSTRE_VERSION_CODE < OBD_OCD_VERSION(2, 9, 53, 0) */
+ case 'S':
+ stripe_size_arg = optarg;
+ break;
+ case 'p':
+ pool_name_arg = optarg;
+ break;
+ default:
+ return CMD_HELP;
+ }
+ }
- if (delete &&
- (stripe_size_arg != NULL || stripe_off_arg != NULL ||
- stripe_count_arg != NULL || pool_name_arg != NULL)) {
- fprintf(stderr, "error: %s: cannot specify -d with "
- "-s, -c, -o, or -p options\n",
- argv[0]);
- return CMD_HELP;
- }
- }
+ if (delete &&
+ (stripe_size_arg != NULL || stripe_off_arg != NULL ||
+ stripe_count_arg != NULL || pool_name_arg != NULL)) {
+ fprintf(stderr, "error: %s: cannot specify -d with "
+ "-s, -c, -o, or -p options\n",
+ argv[0]);
+ return CMD_HELP;
+ }
- if (optind == argc) {
- fprintf(stderr, "error: %s: missing filename|dirname\n",
- argv[0]);
- return CMD_HELP;
- }
+ if (optind == argc) {
+ fprintf(stderr, "error: %s: missing filename|dirname\n",
+ argv[0]);
+ return CMD_HELP;
+ }
/* get the stripe size */
if (stripe_size_arg != NULL) {
/* get the stripe size */
if (stripe_size_arg != NULL) {
struct find_param *param)
{
struct option long_opts[] = {
struct find_param *param)
{
struct option long_opts[] = {
-#if LUSTRE_VERSION >= OBD_OCD_VERSION(2,9,50,0)
-#warning "remove deprecated --count option"
-#else
+#if LUSTRE_VERSION_CODE < OBD_OCD_VERSION(2, 9, 53, 0)
/* This formerly implied "stripe-count", but was explicitly
* made "stripe-count" for consistency with other options,
* and to separate it from "mdt-count" when DNE arrives. */
/* This formerly implied "stripe-count", but was explicitly
* made "stripe-count" for consistency with other options,
* and to separate it from "mdt-count" when DNE arrives. */
{"stripe_count", no_argument, 0, 'c'},
{"directory", no_argument, 0, 'd'},
{"generation", no_argument, 0, 'g'},
{"stripe_count", no_argument, 0, 'c'},
{"directory", no_argument, 0, 'd'},
{"generation", no_argument, 0, 'g'},
-#if LUSTRE_VERSION >= OBD_OCD_VERSION(2,9,50,0)
-#warning "remove deprecated --index option"
-#else
+#if LUSTRE_VERSION_CODE < OBD_OCD_VERSION(2, 9, 53, 0)
/* This formerly implied "stripe-index", but was explicitly
* made "stripe-index" for consistency with other options,
* and to separate it from "mdt-index" when DNE arrives. */
/* This formerly implied "stripe-index", but was explicitly
* made "stripe-index" for consistency with other options,
* and to separate it from "mdt-index" when DNE arrives. */
{"layout", no_argument, 0, 'L'},
{"mdt-index", no_argument, 0, 'M'},
{"mdt_index", no_argument, 0, 'M'},
{"layout", no_argument, 0, 'L'},
{"mdt-index", no_argument, 0, 'M'},
{"mdt_index", no_argument, 0, 'M'},
-#if LUSTRE_VERSION >= OBD_OCD_VERSION(2,9,50,0)
-#warning "remove deprecated --offset option"
-#else
+#if LUSTRE_VERSION_CODE < OBD_OCD_VERSION(2, 9, 53, 0)
/* This formerly implied "stripe-index", but was confusing
* with "file offset" (which will eventually be needed for
* with different layouts by offset), so deprecate it. */
/* This formerly implied "stripe-index", but was confusing
* with "file offset" (which will eventually be needed for
* with different layouts by offset), so deprecate it. */
{"quiet", no_argument, 0, 'q'},
{"recursive", no_argument, 0, 'r'},
{"raw", no_argument, 0, 'R'},
{"quiet", no_argument, 0, 'q'},
{"recursive", no_argument, 0, 'r'},
{"raw", no_argument, 0, 'R'},
-#if LUSTRE_VERSION >= OBD_OCD_VERSION(2,9,50,0)
-#warning "remove deprecated --size option"
-#else
+#if LUSTRE_VERSION_CODE < OBD_OCD_VERSION(2, 9, 53, 0)
/* This formerly implied "--stripe-size", but was confusing
* with "lfs find --size|-s", which means "file size", so use
* the consistent "--stripe-size|-S" for all commands. */
/* This formerly implied "--stripe-size", but was confusing
* with "lfs find --size|-s", which means "file size", so use
* the consistent "--stripe-size|-S" for all commands. */
param->verbose = VERBOSE_ALL | VERBOSE_DETAIL;
break;
case 'c':
param->verbose = VERBOSE_ALL | VERBOSE_DETAIL;
break;
case 'c':
-#if LUSTRE_VERSION >= OBD_OCD_VERSION(2,9,50,0)
-#warning "remove deprecated --count option"
-#elif LUSTRE_VERSION >= OBD_OCD_VERSION(2,6,50,0)
+#if LUSTRE_VERSION_CODE >= OBD_OCD_VERSION(2, 6, 53, 0)
if (strcmp(argv[optind - 1], "--count") == 0)
fprintf(stderr, "warning: '--count' deprecated,"
" use '--stripe-count' instead\n");
if (strcmp(argv[optind - 1], "--count") == 0)
fprintf(stderr, "warning: '--count' deprecated,"
" use '--stripe-count' instead\n");
param->maxdepth = 0;
}
break;
param->maxdepth = 0;
}
break;
+#if LUSTRE_VERSION_CODE < OBD_OCD_VERSION(2, 9, 53, 0)
-#if LUSTRE_VERSION >= OBD_OCD_VERSION(2,9,50,0)
-#warning "remove deprecated --size option"
-#elif LUSTRE_VERSION >= OBD_OCD_VERSION(2,6,50,0)
+#if LUSTRE_VERSION_CODE >= OBD_OCD_VERSION(2, 6, 53, 0)
fprintf(stderr, "warning: '--size|-s' deprecated, "
"use '--stripe-size|-S' instead\n");
#endif
fprintf(stderr, "warning: '--size|-s' deprecated, "
"use '--stripe-size|-S' instead\n");
#endif
+#endif /* LUSTRE_VERSION_CODE < OBD_OCD_VERSION(2, 9, 53, 0) */
case 'S':
if (!(param->verbose & VERBOSE_DETAIL)) {
param->verbose |= VERBOSE_SIZE;
param->maxdepth = 0;
}
break;
case 'S':
if (!(param->verbose & VERBOSE_DETAIL)) {
param->verbose |= VERBOSE_SIZE;
param->maxdepth = 0;
}
break;
+#if LUSTRE_VERSION_CODE < OBD_OCD_VERSION(2, 9, 53, 0)
-#if LUSTRE_VERSION >= OBD_OCD_VERSION(2,4,50,0)
fprintf(stderr, "warning: '--offset|-o' deprecated, "
"use '--stripe-index|-i' instead\n");
fprintf(stderr, "warning: '--offset|-o' deprecated, "
"use '--stripe-index|-i' instead\n");
-#else
- if (strcmp(argv[optind - 1], "--offset") == 0)
- /* need --stripe-index established first */
- fprintf(stderr, "warning: '--offset' deprecated"
- ", use '--index' instead\n");
-#if LUSTRE_VERSION >= OBD_OCD_VERSION(2,9,50,0)
-#warning "remove deprecated --offset and --index options"
-#elif LUSTRE_VERSION >= OBD_OCD_VERSION(2,6,50,0)
+#if LUSTRE_VERSION_CODE >= OBD_OCD_VERSION(2, 6, 53, 0)
if (strcmp(argv[optind - 1], "--index") == 0)
fprintf(stderr, "warning: '--index' deprecated"
", use '--stripe-index' instead\n");
if (strcmp(argv[optind - 1], "--index") == 0)
fprintf(stderr, "warning: '--index' deprecated"
", use '--stripe-index' instead\n");
* AT NEXT REBOOT, not immediately. */
int jt_lcfg_mgsparam(int argc, char **argv)
{
* AT NEXT REBOOT, not immediately. */
int jt_lcfg_mgsparam(int argc, char **argv)
{
- int rc;
- int del = 0;
- struct lustre_cfg_bufs bufs;
- struct lustre_cfg *lcfg;
- char *buf = NULL;
+ int rc;
+ int del = 0;
+ struct lustre_cfg_bufs bufs;
+ struct lustre_cfg *lcfg;
+ char *buf = NULL;
-#if LUSTRE_VERSION >= OBD_OCD_VERSION(2,7,53,0)
+#if LUSTRE_VERSION_CODE >= OBD_OCD_VERSION(2, 7, 53, 0)
fprintf(stderr, "warning: 'lctl conf_param' is deprecated, "
"use 'lctl set_param -P' instead\n");
#endif
fprintf(stderr, "warning: 'lctl conf_param' is deprecated, "
"use 'lctl set_param -P' instead\n");
#endif