From: Alex Zhuravlev Date: Thu, 7 Jun 2012 07:22:22 +0000 (+0400) Subject: LU-1581 utils: support for multiple underlying devices X-Git-Tag: 2.2.60~19 X-Git-Url: https://git.whamcloud.com/?p=fs%2Flustre-release.git;a=commitdiff_plain;h=f992b0fb3fc6ec1cfc53944d7df7bd5b496ac9cb;hp=af79b4e7e89c6c5f455a0526f1598dae217db2e5 LU-1581 utils: support for multiple underlying devices will be used by zfs backend Signed-off-by: Alex Zhuravlev Change-Id: I90c3630d993811d702f81c838aae7344775cc115 Reviewed-on: http://review.whamcloud.com/3224 Tested-by: Hudson Tested-by: Maloo Reviewed-by: Li Wei Reviewed-by: Andreas Dilger --- diff --git a/lustre/utils/mkfs_lustre.c b/lustre/utils/mkfs_lustre.c index a7f09f9..21f7d19 100644 --- a/lustre/utils/mkfs_lustre.c +++ b/lustre/utils/mkfs_lustre.c @@ -177,6 +177,7 @@ void set_defaults(struct mkfs_opts *mop) mop->mo_ldd.ldd_svindex = INDEX_UNASSIGNED; mop->mo_stripe_count = 1; + mop->mo_pool_vdevs = NULL; } static inline void badopt(const char *opt, char *type) @@ -479,16 +480,20 @@ int parse_opts(int argc, char *const argv[], struct mkfs_opts *mop, } }//while - /* Last arg is device */ - if (optind != argc - 1) { - fatal(); - fprintf(stderr, "Bad argument: %s\n", argv[optind]); - return EINVAL; - } - - /* single argument: */ - if (argc == 2) - ++print_only; + if (optind == argc) { + /* The user didn't specify device name */ + fatal(); + fprintf(stderr, "Not enough arguments - device name or " + "pool/dataset name not specified.\n"); + return EINVAL; + } else { + /* The device or pool/filesystem name */ + strscpy(mop->mo_device, argv[optind], sizeof(mop->mo_device)); + + /* Followed by optional vdevs */ + if (optind < argc - 1) + mop->mo_pool_vdevs = (char **) &argv[optind + 1]; + } return 0; } diff --git a/lustre/utils/mount_utils.h b/lustre/utils/mount_utils.h index 8d99255..6033b58 100644 --- a/lustre/utils/mount_utils.h +++ b/lustre/utils/mount_utils.h @@ -59,6 +59,7 @@ extern int failover; struct mkfs_opts { struct lustre_disk_data mo_ldd; /* to be written in MOUNT_DATA_FILE */ char mo_device[128]; /* disk device name */ + char **mo_pool_vdevs; /* list of pool vdevs */ char mo_loopdev[128]; /* in case a loop dev is needed */ char mo_mkfsopts[512]; /* options to the backing-store mkfs */ __u64 mo_device_sz; /* in KB */