X-Git-Url: https://git.whamcloud.com/?a=blobdiff_plain;f=lustre%2Futils%2Fmkfs_lustre.c;h=0e62785001c3c46ec65b1c6a23ab6b7ed9b76acd;hb=2e0ad6d40070d38076c77038b7d48ac90af7b130;hp=6024c74cdbdc30f03b7ec1eb3233595375262d62;hpb=8eaf21f9a9a6264598b9fed93b2c5d423b00bd9a;p=fs%2Flustre-release.git diff --git a/lustre/utils/mkfs_lustre.c b/lustre/utils/mkfs_lustre.c index 6024c74..0e62785 100644 --- a/lustre/utils/mkfs_lustre.c +++ b/lustre/utils/mkfs_lustre.c @@ -26,7 +26,7 @@ * GPL HEADER END */ /* - * Copyright 2008 Sun Microsystems, Inc. All rights reserved + * Copyright (c) 2007, 2010, Oracle and/or its affiliates. All rights reserved. * Use is subject to license terms. */ /* @@ -68,7 +68,9 @@ /* libcfs.h is not really needed here, but on SLES10/PPC, fs.h includes idr.h which * requires BITS_PER_LONG to be defined */ #include +#ifndef BLKGETSIZE64 #include /* for BLKGETSIZE64 */ +#endif #include #endif #include @@ -130,6 +132,7 @@ void usage(FILE *out) */ "\t\t--comment=: arbitrary user string (%d bytes)\n" "\t\t--mountfsoptions= : permanent mount options\n" + "\t\t--network=[,<...>] : network(s) to restrict this ost/mdt to\n" #ifndef TUNEFS "\t\t--backfstype= : backing fs type (ext3, ldiskfs)\n" "\t\t--device-size=#N(KB) : device size for loop devices\n" @@ -514,34 +517,29 @@ static int is_e2fsprogs_feature_supp(const char *feature) return ret; } -static void disp_old_kernel_msg(char *feature) -{ - fprintf(stderr, "WARNING: ldiskfs filesystem does not support \"%s\" " - "feature.\n\n", feature); -} - static void enable_default_backfs_features(struct mkfs_opts *mop) { struct utsname uts; - int maj_high, maj_low, min; int ret; - if (IS_MDT(&mop->mo_ldd)) - strscat(mop->mo_mkfsopts, " -O dir_index,extents,dirdata", - sizeof(mop->mo_mkfsopts)); - else + if (IS_OST(&mop->mo_ldd)) strscat(mop->mo_mkfsopts, " -O dir_index,extents", - sizeof(mop->mo_mkfsopts)); - + sizeof(mop->mo_mkfsopts)); + else if (IS_MDT(&mop->mo_ldd)) + strscat(mop->mo_mkfsopts, " -O dir_index,dirdata", + sizeof(mop->mo_mkfsopts)); + else + strscat(mop->mo_mkfsopts, " -O dir_index", + sizeof(mop->mo_mkfsopts)); /* Upstream e2fsprogs called our uninit_groups feature uninit_bg, * check for both of them when testing e2fsprogs features. */ - if (is_e2fsprogs_feature_supp("uninit_groups") == 0) - strscat(mop->mo_mkfsopts, ",uninit_groups", - sizeof(mop->mo_mkfsopts)); - else if (is_e2fsprogs_feature_supp("uninit_bg") == 0) + if (is_e2fsprogs_feature_supp("uninit_bg") == 0) strscat(mop->mo_mkfsopts, ",uninit_bg", sizeof(mop->mo_mkfsopts)); + else if (is_e2fsprogs_feature_supp("uninit_groups") == 0) + strscat(mop->mo_mkfsopts, ",uninit_groups", + sizeof(mop->mo_mkfsopts)); else disp_old_e2fsprogs_msg("uninit_bg", 1); @@ -549,22 +547,14 @@ static void enable_default_backfs_features(struct mkfs_opts *mop) if (ret) return; - sscanf(uts.release, "%d.%d.%d", &maj_high, &maj_low, &min); - printf("%d %d %d\n", maj_high, maj_low, min); - /* Multiple mount protection is enabled only if failover node is * specified and if kernel version is higher than 2.6.9 */ if (failover) { - if (KERNEL_VERSION(maj_high, maj_low, min) >= - KERNEL_VERSION(2,6,9)) { - if (is_e2fsprogs_feature_supp("mmp") == 0) - strscat(mop->mo_mkfsopts, ",mmp", - sizeof(mop->mo_mkfsopts)); - else - disp_old_e2fsprogs_msg("mmp", 1); - } else { - disp_old_kernel_msg("mmp"); - } + if (is_e2fsprogs_feature_supp("mmp") == 0) + strscat(mop->mo_mkfsopts, ",mmp", + sizeof(mop->mo_mkfsopts)); + else + disp_old_e2fsprogs_msg("mmp", 1); } } /* Build fs according to type */ @@ -597,6 +587,11 @@ int make_lustre_backfs(struct mkfs_opts *mop) return EINVAL; } block_count = mop->mo_device_sz / (L_BLOCK_SIZE >> 10); + /* If the LUN size is just over 2^32 blocks, limit the + * filesystem size to 2^32-1 blocks to avoid problems with + * ldiskfs/mkfs not handling this size. Bug 22906 */ + if (block_count > 0xffffffffULL && block_count < 0x100002000ULL) + block_count = 0xffffffffULL; } if ((mop->mo_ldd.ldd_mount_type == LDD_MT_EXT3) || @@ -1224,6 +1219,7 @@ int parse_opts(int argc, char *const argv[], struct mkfs_opts *mop, {"verbose", 0, 0, 'v'}, {"writeconf", 0, 0, 'w'}, {"upgrade_to_18", 0, 0, 'U'}, + {"network", 1, 0, 't'}, {0, 0, 0, 0} }; char *optstring = "b:c:C:d:ef:Ghi:k:L:m:MnNo:Op:Pqru:vw"; @@ -1379,6 +1375,22 @@ int parse_opts(int argc, char *const argv[], struct mkfs_opts *mop, case 'r': mop->mo_flags |= MO_FORCEFORMAT; break; + case 't': + if (!IS_MDT(&mop->mo_ldd) && !IS_OST(&mop->mo_ldd)) { + badopt(long_opt[longidx].name, "MDT,OST"); + return 1; + } + + if (!optarg) + return 1; + + rc = add_param(mop->mo_ldd.ldd_params, + PARAM_NETWORK, optarg); + if (rc != 0) + return rc; + /* Must update the mgs logs */ + mop->mo_ldd.ldd_flags |= LDD_F_UPDATE; + break; case 'u': strscpy(mop->mo_ldd.ldd_userdata, optarg, sizeof(mop->mo_ldd.ldd_userdata));