Whamcloud - gitweb
LU-419 mkfs: fix default ext4 filesystem tuneables
authorAndreas Dilger <adilger@whamcloud.com>
Wed, 22 Jun 2011 04:21:28 +0000 (22:21 -0600)
committerOleg Drokin <green@whamcloud.com>
Tue, 28 Jun 2011 04:42:34 +0000 (21:42 -0700)
Enable the "64bit" feature flag for filesystems over 16TB (2^32
blocks, really).  Otherwise, the user needs to specify "-t ext4"
explicitly for such filesystems, or otherwise specify all of the
mke2fs features explicitly to format huge filesystems.

Porting the LU-255 patch to b1_8, I also wanted to make sure that
the new default inode ratio for OSTs was not too aggressive.  While
Lustre filesystems generally have average file sizes over 1MB, in
some limited number of cases the user filesystem statistics sent to
lustre-discuss had filesystems with an ratio of 600kB/inode region.

While the average FILE size may be > 1MB/file, if the default LOV
striping is 2 or 4 stripes/file then there may be a large number of
zero-length inodes on the OST that will be allocated and need space.

Reduce the default inode ratio to previously changed in commit
eb012d4a10208b26c2d3e795a90f1bb07dde6d91 from 1MB/inode down to
512kB/inode for filesystems between 4TB and 16TB, and only go up to
1MB/inode for filesystems over 16TB.  Since there are no existing
filesystems that large, there is no firm expectation for how many
inodes should be created for such filesystems, so this is safer.

Change-Id: I92139755468c5f58830849ebd44171951f8460e4
Signed-off-by: Andreas Dilger <adilger@whamcloud.com>
Reviewed-on: http://review.whamcloud.com/996
Tested-by: Hudson
Reviewed-by: Yu Jian <yujian@whamcloud.com>
Reviewed-by: Oleg Drokin <green@whamcloud.com>
lustre/utils/mkfs_lustre.c

index b0062cb..e49e9bd 100644 (file)
@@ -555,9 +555,14 @@ static void enable_default_ext4_features(struct mkfs_opts *mop)
         if (is_e2fsprogs_feature_supp("-O huge_file") == 0)
                 strscat(mop->mo_mkfsopts,",huge_file",sizeof(mop->mo_mkfsopts));
 
         if (is_e2fsprogs_feature_supp("-O huge_file") == 0)
                 strscat(mop->mo_mkfsopts,",huge_file",sizeof(mop->mo_mkfsopts));
 
+        /* Enable large block addresses if the LUN is over 2^32 blocks. */
+        if (mop->mo_device_sz / (L_BLOCK_SIZE >> 10) >= 0x100002000ULL &&
+                    is_e2fsprogs_feature_supp("-O 64bit") == 0)
+                strscat(mop->mo_mkfsopts, ",64bit", sizeof(mop->mo_mkfsopts));
+
         /* Cluster inode/block bitmaps and inode table for more efficient IO.
         /* Cluster inode/block bitmaps and inode table for more efficient IO.
-         * Align the flex groups on a 1MB boundary for better performance.
-         * This -O feature needs to go last, since it adds an extra option. */
+         * Align the flex groups on a 1MB boundary for better performance. */
+        /* This -O feature needs to go last, since it adds the "-G" option. */
         if (is_e2fsprogs_feature_supp("-O flex_bg") == 0) {
                 char tmp_buf[64];
 
         if (is_e2fsprogs_feature_supp("-O flex_bg") == 0) {
                 char tmp_buf[64];
 
@@ -570,6 +575,7 @@ static void enable_default_ext4_features(struct mkfs_opts *mop)
                                 sizeof(mop->mo_mkfsopts));
                 }
         }
                                 sizeof(mop->mo_mkfsopts));
                 }
         }
+        /* Don't add any more "-O" options here, see last comment above */
 #endif
 }
 
 #endif
 }
 
@@ -686,20 +692,22 @@ int make_lustre_backfs(struct mkfs_opts *mop)
                          * filesystems can be much more aggressive than even
                          * this, but it is impossible to know in advance. */
                         if (IS_OST(&mop->mo_ldd)) {
                          * filesystems can be much more aggressive than even
                          * this, but it is impossible to know in advance. */
                         if (IS_OST(&mop->mo_ldd)) {
-                                /* OST > 8TB assume average file size 1MB */
-                                if (device_sz >= (8ULL << 30))
+                                /* OST > 16TB assume average file size 1MB */
+                                if (device_sz > (16ULL << 30))
                                         bytes_per_inode = 1024 * 1024;
                                         bytes_per_inode = 1024 * 1024;
+                                /* OST > 4TB assume average file size 512kB */
+                                else if (device_sz > (4ULL << 30))
+                                        bytes_per_inode = 512 * 1024;
                                 /* OST > 1TB assume average file size 256kB */
                                 /* OST > 1TB assume average file size 256kB */
-                                else if (device_sz >= (1ULL << 30))
+                                else if (device_sz > (1ULL << 30))
                                         bytes_per_inode = 256 * 1024;
                                         bytes_per_inode = 256 * 1024;
-                                /* OST > 100GB assume average file size 64kB,
+                                /* OST > 10GB assume average file size 64kB,
                                  * plus a bit so that inodes will fit into a
                                  * 256x flex_bg without overflowing */
                                  * plus a bit so that inodes will fit into a
                                  * 256x flex_bg without overflowing */
-                                else if (device_sz >= (10ULL << 20))
+                                else if (device_sz > (10ULL << 20))
                                         bytes_per_inode = 69905;
                         }
 
                                         bytes_per_inode = 69905;
                         }
 
-
                         if (bytes_per_inode > 0) {
                                 sprintf(buf, " -i %ld", bytes_per_inode);
                                 strscat(mop->mo_mkfsopts, buf,
                         if (bytes_per_inode > 0) {
                                 sprintf(buf, " -i %ld", bytes_per_inode);
                                 strscat(mop->mo_mkfsopts, buf,