Whamcloud - gitweb
LU-11304 misc: update all url links to whamcloud
[fs/lustre-release.git] / lustre / utils / libmount_utils_ldiskfs.c
index b82b764..ede2207 100644 (file)
@@ -23,7 +23,7 @@
  * Copyright (c) 2007, 2010, Oracle and/or its affiliates. All rights reserved.
  * Use is subject to license terms.
  *
- * Copyright (c) 2012, 2016, Intel Corporation.
+ * Copyright (c) 2012, 2017, Intel Corporation.
  */
 /*
  * This file is part of Lustre, http://www.lustre.org/
@@ -57,6 +57,7 @@
 #include <sys/stat.h>
 #include <sys/mount.h>
 #include <sys/utsname.h>
+#include <sys/sysmacros.h>
 
 #include <string.h>
 #include <getopt.h>
@@ -191,7 +192,7 @@ static int is_feature_enabled(const char *feature, const char *devpath)
 int ldiskfs_write_ldd(struct mkfs_opts *mop)
 {
        char mntpt[] = "/tmp/mntXXXXXX";
-       char filepnm[128];
+       char filepnm[192];
        char *dev;
        FILE *filep;
        int ret = 0;
@@ -387,7 +388,7 @@ static void disp_old_e2fsprogs_msg(const char *feature, int make_backfs)
                E2FSPROGS, feature);
 #if !(HAVE_LDISKFSPROGS)
        fprintf(stderr, "Please install the latest version of e2fsprogs from\n"
-               "https://downloads.hpdd.intel.com/public/e2fsprogs/latest/\n"
+               "https://downloads.whamcloud.com/public/e2fsprogs/latest/\n"
                "to enable this feature.\n");
 #endif
        if (make_backfs)
@@ -541,6 +542,13 @@ static void append_unique(char *buf, char *prefix, char *key, char *val,
 static int enable_default_ext4_features(struct mkfs_opts *mop, char *anchor,
                                        size_t maxbuflen, int user_spec)
 {
+       int enable_64bit = 0;
+
+       /* Enable large block addresses if the LUN is over 2^32 blocks. */
+       if ((mop->mo_device_kb / (L_BLOCK_SIZE >> 10) > UINT32_MAX) &&
+            is_e2fsprogs_feature_supp("-O 64bit") == 0)
+               enable_64bit = 1;
+
        if (IS_OST(&mop->mo_ldd)) {
                append_unique(anchor, user_spec ? "," : " -O ",
                              "extents", NULL, maxbuflen);
@@ -549,7 +557,10 @@ static int enable_default_ext4_features(struct mkfs_opts *mop, char *anchor,
                append_unique(anchor, user_spec ? "," : " -O ",
                              "dirdata", NULL, maxbuflen);
                append_unique(anchor, ",", "uninit_bg", NULL, maxbuflen);
-               append_unique(anchor, ",", "^extents", NULL, maxbuflen);
+               if (enable_64bit)
+                       append_unique(anchor, ",", "extents", NULL, maxbuflen);
+               else
+                       append_unique(anchor, ",", "^extents", NULL, maxbuflen);
        } else {
                append_unique(anchor, user_spec ? "," : " -O ",
                              "uninit_bg", NULL, maxbuflen);
@@ -586,9 +597,7 @@ static int enable_default_ext4_features(struct mkfs_opts *mop, char *anchor,
        if (is_e2fsprogs_feature_supp("-O huge_file") == 0)
                append_unique(anchor, ",", "huge_file", NULL, maxbuflen);
 
-       /* Enable large block addresses if the LUN is over 2^32 blocks. */
-       if (mop->mo_device_kb / (L_BLOCK_SIZE >> 10) >= 0x100002000ULL &&
-           is_e2fsprogs_feature_supp("-O 64bit") == 0)
+       if (enable_64bit)
                append_unique(anchor, ",", "64bit", NULL, maxbuflen);
 
        /* Cluster inode/block bitmaps and inode table for more efficient IO.
@@ -815,6 +824,7 @@ int ldiskfs_make_lustre(struct mkfs_opts *mop)
                                sprintf(buf, " -i %ld", bytes_per_inode);
                                strscat(mop->mo_mkfsopts, buf,
                                        sizeof(mop->mo_mkfsopts));
+                               mop->mo_inode_size = bytes_per_inode;
                        }
                }