mirror of https://github.com/vitalif/e2fsprogs
mke2fs,tune2fs: Enable huge_file, dir_nlink, and extra_isize features
Also change mke2fs.conf to enable huge_file,dir_nlink,extra_isize, and uninit_bg by default for ext4 filesystems, and enable extra_isize in the library as well. Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>bitmap-optimize
parent
eafba6c310
commit
2be8fe4397
|
@ -535,6 +535,7 @@ typedef struct ext2_icount *ext2_icount_t;
|
||||||
EXT4_FEATURE_RO_COMPAT_HUGE_FILE|\
|
EXT4_FEATURE_RO_COMPAT_HUGE_FILE|\
|
||||||
EXT2_FEATURE_RO_COMPAT_LARGE_FILE|\
|
EXT2_FEATURE_RO_COMPAT_LARGE_FILE|\
|
||||||
EXT4_FEATURE_RO_COMPAT_DIR_NLINK|\
|
EXT4_FEATURE_RO_COMPAT_DIR_NLINK|\
|
||||||
|
EXT4_FEATURE_RO_COMPAT_EXTRA_ISIZE|\
|
||||||
EXT4_FEATURE_RO_COMPAT_GDT_CSUM)
|
EXT4_FEATURE_RO_COMPAT_GDT_CSUM)
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -542,7 +543,7 @@ typedef struct ext2_icount *ext2_icount_t;
|
||||||
* to ext2fs_openfs()
|
* to ext2fs_openfs()
|
||||||
*/
|
*/
|
||||||
#define EXT2_LIB_SOFTSUPP_INCOMPAT (0)
|
#define EXT2_LIB_SOFTSUPP_INCOMPAT (0)
|
||||||
#define EXT2_LIB_SOFTSUPP_RO_COMPAT (EXT4_FEATURE_RO_COMPAT_EXTRA_ISIZE)
|
#define EXT2_LIB_SOFTSUPP_RO_COMPAT (0)
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* function prototypes
|
* function prototypes
|
||||||
|
|
|
@ -839,6 +839,9 @@ static __u32 ok_features[3] = {
|
||||||
EXT4_FEATURE_INCOMPAT_FLEX_BG,
|
EXT4_FEATURE_INCOMPAT_FLEX_BG,
|
||||||
/* R/O compat */
|
/* R/O compat */
|
||||||
EXT2_FEATURE_RO_COMPAT_LARGE_FILE|
|
EXT2_FEATURE_RO_COMPAT_LARGE_FILE|
|
||||||
|
EXT4_FEATURE_RO_COMPAT_HUGE_FILE|
|
||||||
|
EXT4_FEATURE_RO_COMPAT_DIR_NLINK|
|
||||||
|
EXT4_FEATURE_RO_COMPAT_EXTRA_ISIZE|
|
||||||
EXT2_FEATURE_RO_COMPAT_SPARSE_SUPER|
|
EXT2_FEATURE_RO_COMPAT_SPARSE_SUPER|
|
||||||
EXT4_FEATURE_RO_COMPAT_GDT_CSUM
|
EXT4_FEATURE_RO_COMPAT_GDT_CSUM
|
||||||
};
|
};
|
||||||
|
|
|
@ -9,11 +9,11 @@
|
||||||
features = has_journal
|
features = has_journal
|
||||||
}
|
}
|
||||||
ext4 = {
|
ext4 = {
|
||||||
features = has_journal,extents,flex_bg
|
features = has_journal,extents,huge_file,flex_bg,uninit_bg,dir_nlink,extra_isize
|
||||||
inode_size = 256
|
inode_size = 256
|
||||||
}
|
}
|
||||||
ext4dev = {
|
ext4dev = {
|
||||||
features = has_journal,extents,flex_bg
|
features = has_journal,extents,huge_file,flex_bg,uninit_bg,dir_nlink,extra_isize
|
||||||
inode_size = 256
|
inode_size = 256
|
||||||
options = test_fs=1
|
options = test_fs=1
|
||||||
}
|
}
|
||||||
|
|
|
@ -57,16 +57,6 @@ extern int optind;
|
||||||
#include "../version.h"
|
#include "../version.h"
|
||||||
#include "nls-enable.h"
|
#include "nls-enable.h"
|
||||||
|
|
||||||
/*
|
|
||||||
* Tune2fs supports these features in addition to the standard features.
|
|
||||||
*/
|
|
||||||
#define EXT2_TUNE2FS_INCOMPAT (EXT3_FEATURE_INCOMPAT_EXTENTS)
|
|
||||||
#define EXT2_TUNE2FS_RO_COMPAT (EXT4_FEATURE_RO_COMPAT_HUGE_FILE|\
|
|
||||||
EXT4_FEATURE_RO_COMPAT_GDT_CSUM| \
|
|
||||||
EXT4_FEATURE_RO_COMPAT_DIR_NLINK| \
|
|
||||||
EXT4_FEATURE_RO_COMPAT_EXTRA_ISIZE)
|
|
||||||
|
|
||||||
|
|
||||||
const char * program_name = "tune2fs";
|
const char * program_name = "tune2fs";
|
||||||
char * device_name;
|
char * device_name;
|
||||||
char * new_label, *new_last_mounted, *new_UUID;
|
char * new_label, *new_last_mounted, *new_UUID;
|
||||||
|
@ -131,6 +121,9 @@ static __u32 ok_features[3] = {
|
||||||
EXT4_FEATURE_INCOMPAT_FLEX_BG,
|
EXT4_FEATURE_INCOMPAT_FLEX_BG,
|
||||||
/* R/O compat */
|
/* R/O compat */
|
||||||
EXT2_FEATURE_RO_COMPAT_LARGE_FILE |
|
EXT2_FEATURE_RO_COMPAT_LARGE_FILE |
|
||||||
|
EXT4_FEATURE_RO_COMPAT_HUGE_FILE|
|
||||||
|
EXT4_FEATURE_RO_COMPAT_DIR_NLINK|
|
||||||
|
EXT4_FEATURE_RO_COMPAT_EXTRA_ISIZE|
|
||||||
EXT4_FEATURE_RO_COMPAT_GDT_CSUM |
|
EXT4_FEATURE_RO_COMPAT_GDT_CSUM |
|
||||||
EXT2_FEATURE_RO_COMPAT_SPARSE_SUPER
|
EXT2_FEATURE_RO_COMPAT_SPARSE_SUPER
|
||||||
};
|
};
|
||||||
|
@ -145,6 +138,9 @@ static __u32 clear_ok_features[3] = {
|
||||||
EXT4_FEATURE_INCOMPAT_FLEX_BG,
|
EXT4_FEATURE_INCOMPAT_FLEX_BG,
|
||||||
/* R/O compat */
|
/* R/O compat */
|
||||||
EXT2_FEATURE_RO_COMPAT_LARGE_FILE |
|
EXT2_FEATURE_RO_COMPAT_LARGE_FILE |
|
||||||
|
EXT4_FEATURE_RO_COMPAT_HUGE_FILE|
|
||||||
|
EXT4_FEATURE_RO_COMPAT_DIR_NLINK|
|
||||||
|
EXT4_FEATURE_RO_COMPAT_EXTRA_ISIZE|
|
||||||
EXT4_FEATURE_RO_COMPAT_GDT_CSUM
|
EXT4_FEATURE_RO_COMPAT_GDT_CSUM
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -369,7 +365,7 @@ static void update_feature_set(ext2_filsys fs, char *features)
|
||||||
if (FEATURE_OFF(E2P_FEATURE_COMPAT, EXT3_FEATURE_COMPAT_HAS_JOURNAL)) {
|
if (FEATURE_OFF(E2P_FEATURE_COMPAT, EXT3_FEATURE_COMPAT_HAS_JOURNAL)) {
|
||||||
if ((mount_flags & EXT2_MF_MOUNTED) &&
|
if ((mount_flags & EXT2_MF_MOUNTED) &&
|
||||||
!(mount_flags & EXT2_MF_READONLY)) {
|
!(mount_flags & EXT2_MF_READONLY)) {
|
||||||
fputs(_("The has_journal flag may only be "
|
fputs(_("The has_journal feature may only be "
|
||||||
"cleared when the filesystem is\n"
|
"cleared when the filesystem is\n"
|
||||||
"unmounted or mounted "
|
"unmounted or mounted "
|
||||||
"read-only.\n"), stderr);
|
"read-only.\n"), stderr);
|
||||||
|
@ -418,6 +414,18 @@ static void update_feature_set(ext2_filsys fs, char *features)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (FEATURE_OFF(E2P_FEATURE_RO_INCOMPAT,
|
||||||
|
EXT4_FEATURE_RO_COMPAT_HUGE_FILE)) {
|
||||||
|
if ((mount_flags & EXT2_MF_MOUNTED) &&
|
||||||
|
!(mount_flags & EXT2_MF_READONLY)) {
|
||||||
|
fputs(_("The huge_file feature may only be "
|
||||||
|
"cleared when the filesystem is\n"
|
||||||
|
"unmounted or mounted "
|
||||||
|
"read-only.\n"), stderr);
|
||||||
|
exit(1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (sb->s_rev_level == EXT2_GOOD_OLD_REV &&
|
if (sb->s_rev_level == EXT2_GOOD_OLD_REV &&
|
||||||
(sb->s_feature_compat || sb->s_feature_ro_compat ||
|
(sb->s_feature_compat || sb->s_feature_ro_compat ||
|
||||||
sb->s_feature_incompat))
|
sb->s_feature_incompat))
|
||||||
|
@ -427,6 +435,8 @@ static void update_feature_set(ext2_filsys fs, char *features)
|
||||||
EXT2_FEATURE_RO_COMPAT_SPARSE_SUPER) ||
|
EXT2_FEATURE_RO_COMPAT_SPARSE_SUPER) ||
|
||||||
FEATURE_CHANGED(E2P_FEATURE_RO_INCOMPAT,
|
FEATURE_CHANGED(E2P_FEATURE_RO_INCOMPAT,
|
||||||
EXT4_FEATURE_RO_COMPAT_GDT_CSUM) ||
|
EXT4_FEATURE_RO_COMPAT_GDT_CSUM) ||
|
||||||
|
FEATURE_OFF(E2P_FEATURE_RO_INCOMPAT,
|
||||||
|
EXT4_FEATURE_RO_COMPAT_HUGE_FILE) ||
|
||||||
FEATURE_CHANGED(E2P_FEATURE_INCOMPAT,
|
FEATURE_CHANGED(E2P_FEATURE_INCOMPAT,
|
||||||
EXT2_FEATURE_INCOMPAT_FILETYPE) ||
|
EXT2_FEATURE_INCOMPAT_FILETYPE) ||
|
||||||
FEATURE_CHANGED(E2P_FEATURE_COMPAT,
|
FEATURE_CHANGED(E2P_FEATURE_COMPAT,
|
||||||
|
@ -435,6 +445,8 @@ static void update_feature_set(ext2_filsys fs, char *features)
|
||||||
EXT2_FEATURE_RO_COMPAT_LARGE_FILE)) {
|
EXT2_FEATURE_RO_COMPAT_LARGE_FILE)) {
|
||||||
sb->s_state &= ~EXT2_VALID_FS;
|
sb->s_state &= ~EXT2_VALID_FS;
|
||||||
printf("\n%s\n", _(please_fsck));
|
printf("\n%s\n", _(please_fsck));
|
||||||
|
if (mount_flags & EXT2_MF_READONLY)
|
||||||
|
printf(_("(and reboot afterwards!)\n"));
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((old_features[E2P_FEATURE_COMPAT] != sb->s_feature_compat) ||
|
if ((old_features[E2P_FEATURE_COMPAT] != sb->s_feature_compat) ||
|
||||||
|
@ -535,7 +547,7 @@ static void parse_e2label_options(int argc, char ** argv)
|
||||||
argv[1]);
|
argv[1]);
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
open_flag = EXT2_FLAG_SOFTSUPP_FEATURES | EXT2_FLAG_JOURNAL_DEV_OK;
|
open_flag = EXT2_FLAG_JOURNAL_DEV_OK;
|
||||||
if (argc == 3) {
|
if (argc == 3) {
|
||||||
open_flag |= EXT2_FLAG_RW;
|
open_flag |= EXT2_FLAG_RW;
|
||||||
L_flag = 1;
|
L_flag = 1;
|
||||||
|
@ -581,7 +593,7 @@ static void parse_tune2fs_options(int argc, char **argv)
|
||||||
struct group * gr;
|
struct group * gr;
|
||||||
struct passwd * pw;
|
struct passwd * pw;
|
||||||
|
|
||||||
open_flag = EXT2_FLAG_SOFTSUPP_FEATURES;
|
open_flag = 0;
|
||||||
|
|
||||||
printf("tune2fs %s (%s)\n", E2FSPROGS_VERSION, E2FSPROGS_DATE);
|
printf("tune2fs %s (%s)\n", E2FSPROGS_VERSION, E2FSPROGS_DATE);
|
||||||
while ((c = getopt(argc, argv, "c:e:fg:i:jlm:o:r:s:u:C:E:I:J:L:M:O:T:U:")) != EOF)
|
while ((c = getopt(argc, argv, "c:e:fg:i:jlm:o:r:s:u:C:E:I:J:L:M:O:T:U:")) != EOF)
|
||||||
|
@ -841,12 +853,6 @@ void do_findfs(int argc, char **argv)
|
||||||
exit(0);
|
exit(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
* Note! If any extended options are incompatible with the
|
|
||||||
* intersection of the SOFTSUPP features and those features explicitly
|
|
||||||
* enabled for tune2fs, there needs to be an explicit test for them
|
|
||||||
* here.
|
|
||||||
*/
|
|
||||||
static void parse_extended_opts(ext2_filsys fs, const char *opts)
|
static void parse_extended_opts(ext2_filsys fs, const char *opts)
|
||||||
{
|
{
|
||||||
char *buf, *token, *next, *p, *arg;
|
char *buf, *token, *next, *p, *arg;
|
||||||
|
@ -1443,13 +1449,7 @@ int main (int argc, char ** argv)
|
||||||
}
|
}
|
||||||
sb = fs->super;
|
sb = fs->super;
|
||||||
fs->flags &= ~EXT2_FLAG_MASTER_SB_ONLY;
|
fs->flags &= ~EXT2_FLAG_MASTER_SB_ONLY;
|
||||||
if ((sb->s_feature_incompat & !EXT2_TUNE2FS_INCOMPAT) ||
|
|
||||||
(sb->s_feature_ro_compat & !EXT2_TUNE2FS_RO_COMPAT)) {
|
|
||||||
fprintf(stderr,
|
|
||||||
_("Filesystem %s has unsupported features enabled.\n"),
|
|
||||||
device_name);
|
|
||||||
exit(1);
|
|
||||||
}
|
|
||||||
if (print_label) {
|
if (print_label) {
|
||||||
/* For e2label emulation */
|
/* For e2label emulation */
|
||||||
printf("%.*s\n", (int) sizeof(sb->s_volume_name),
|
printf("%.*s\n", (int) sizeof(sb->s_volume_name),
|
||||||
|
@ -1457,6 +1457,7 @@ int main (int argc, char ** argv)
|
||||||
remove_error_table(&et_ext2_error_table);
|
remove_error_table(&et_ext2_error_table);
|
||||||
exit(0);
|
exit(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
retval = ext2fs_check_if_mounted(device_name, &mount_flags);
|
retval = ext2fs_check_if_mounted(device_name, &mount_flags);
|
||||||
if (retval) {
|
if (retval) {
|
||||||
com_err("ext2fs_check_if_mount", retval,
|
com_err("ext2fs_check_if_mount", retval,
|
||||||
|
|
Loading…
Reference in New Issue