Whamcloud - gitweb
git://git.whamcloud.com
/
tools
/
e2fsprogs.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
61ef247
)
tune2fs, debugfs, libext2fs: Add support for ext4 default mount options
author
Theodore Ts'o
<tytso@mit.edu>
Sat, 18 Sep 2010 23:38:22 +0000
(19:38 -0400)
committer
Theodore Ts'o
<tytso@mit.edu>
Sat, 18 Sep 2010 23:38:22 +0000
(19:38 -0400)
Add support for 2.6.35's new default mount options which can be
specified in the superblock.
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
debugfs/set_fields.c
patch
|
blob
|
history
lib/e2p/ls.c
patch
|
blob
|
history
lib/e2p/mntopts.c
patch
|
blob
|
history
lib/ext2fs/ext2_fs.h
patch
|
blob
|
history
lib/ext2fs/tst_super_size.c
patch
|
blob
|
history
misc/tune2fs.8.in
patch
|
blob
|
history
misc/tune2fs.c
patch
|
blob
|
history
diff --git
a/debugfs/set_fields.c
b/debugfs/set_fields.c
index
6e71fe8
..
db1a99b
100644
(file)
--- a/
debugfs/set_fields.c
+++ b/
debugfs/set_fields.c
@@
-139,6
+139,7
@@
static struct field_set_info super_fields[] = {
{ "snapshot_r_blocks_count", &set_sb.s_snapshot_r_blocks_count, 8,
parse_uint },
{ "snapshot_list", &set_sb.s_snapshot_list, 4, parse_uint },
+ { "mount_opts", &set_sb.s_mount_opts, 64, parse_string },
{ 0, 0, 0, 0 }
};
diff --git
a/lib/e2p/ls.c
b/lib/e2p/ls.c
index
f2a04ff
..
5ef8098
100644
(file)
--- a/
lib/e2p/ls.c
+++ b/
lib/e2p/ls.c
@@
-211,6
+211,8
@@
void list_super2(struct ext2_super_block * sb, FILE *f)
print_features(sb, f);
print_super_flags(sb, f);
print_mntopts(sb, f);
+ if (sb->s_mount_opts[0])
+ fprintf(f, "Mount options: %s\n", sb->s_mount_opts);
fprintf(f, "Filesystem state: ");
print_fs_state (f, sb->s_state);
fprintf(f, "\n");
diff --git
a/lib/e2p/mntopts.c
b/lib/e2p/mntopts.c
index
bffcb41
..
ebab7fd
100644
(file)
--- a/
lib/e2p/mntopts.c
+++ b/
lib/e2p/mntopts.c
@@
-31,6
+31,10
@@
static struct mntopt mntopt_list[] = {
{ EXT3_DEFM_JMODE_DATA, "journal_data" },
{ EXT3_DEFM_JMODE_ORDERED, "journal_data_ordered" },
{ EXT3_DEFM_JMODE_WBACK, "journal_data_writeback" },
+ { EXT4_DEFM_NOBARRIER, "nobarrier" },
+ { EXT4_DEFM_BLOCK_VALIDITY, "block_validity" },
+ { EXT4_DEFM_DISCARD, "discard"},
+ { EXT4_DEFM_NODELALLOC, "nodelalloc"},
{ 0, 0 },
};
diff --git
a/lib/ext2fs/ext2_fs.h
b/lib/ext2fs/ext2_fs.h
index
a2bca3d
..
afd33a9
100644
(file)
--- a/
lib/ext2fs/ext2_fs.h
+++ b/
lib/ext2fs/ext2_fs.h
@@
-612,8
+612,9
@@
struct ext2_super_block {
__u32 s_last_error_line; /* line number where error happened */
__u64 s_last_error_block; /* block involved of last error */
__u8 s_last_error_func[32]; /* function where the error happened */
-#define EXT4_S_ERR_END ext4_offsetof(struct ext2_super_block, s_error_count)
- __u32 s_reserved[128]; /* Padding to the end of the block */
+#define EXT4_S_ERR_END ext4_offsetof(struct ext2_super_block, s_mount_opts)
+ __u8 s_mount_opts[64];
+ __u32 s_reserved[112]; /* Padding to the end of the block */
};
#define EXT4_S_ERR_LEN (EXT4_S_ERR_END - EXT4_S_ERR_START)
@@
-710,6
+711,10
@@
struct ext2_super_block {
#define EXT3_DEFM_JMODE_DATA 0x0020
#define EXT3_DEFM_JMODE_ORDERED 0x0040
#define EXT3_DEFM_JMODE_WBACK 0x0060
+#define EXT4_DEFM_NOBARRIER 0x0100
+#define EXT4_DEFM_BLOCK_VALIDITY 0x0200
+#define EXT4_DEFM_DISCARD 0x0400
+#define EXT4_DEFM_NODELALLOC 0x0800
/*
* Structure of a directory entry
diff --git
a/lib/ext2fs/tst_super_size.c
b/lib/ext2fs/tst_super_size.c
index
606479c
..
eb9114f
100644
(file)
--- a/
lib/ext2fs/tst_super_size.c
+++ b/
lib/ext2fs/tst_super_size.c
@@
-122,6
+122,7
@@
void check_superblock_fields()
check_field(s_last_error_line);
check_field(s_last_error_block);
check_field(s_last_error_func);
+ check_field(s_mount_opts);
check_field(s_reserved);
printf("Ending offset is %d\n\n", cur_offset);
#endif
diff --git
a/misc/tune2fs.8.in
b/misc/tune2fs.8.in
index
62934f7
..
dffe76d
100644
(file)
--- a/
misc/tune2fs.8.in
+++ b/
misc/tune2fs.8.in
@@
-187,6
+187,26
@@
directories. Valid algorithms accepted are:
and
.IR tea .
.TP
+.BI mount_opts= mount_option_string
+Set a set of default mount options which will be used when the file
+system is mounted. Unlike the bitmask-based default mount options which
+can be specified with the
+.B -o
+option,
+.I mount_option_string
+is an arbitrary string with a maximum length of 63 bytes, which is
+stored in the superblock.
+.IP
+The ext4 file system driver will first apply
+the bitmask-based default options, and then parse the
+.IR mount_option_string ,
+before parsing the mount options passed from the
+.BR mount (8)
+program.
+.IP
+This superblock setting is only honored in 2.6.35+ kernels;
+and not at all by the ext2 and ext3 file system drivers.
+.TP
.B test_fs
Set a flag in the filesystem superblock indicating that it may be
mounted using experimental kernel code, such as the ext4dev filesystem.
@@
-419,6
+439,35
@@
When the filesystem is mounted with journalling enabled, data may be
written into the main filesystem after its metadata has been committed
to the journal. This may increase throughput, however, it may allow old
data to appear in files after a crash and journal recovery.
+.TP
+.B nobarrier
+The file system will be mounted with barrier operations in the journal
+disabled. (This option is currently only supported by the ext4 file
+system driver in 2.6.35+ kernels.)
+.TP
+.B block_validity
+The file system will be mounted with the block_validity option enabled,
+which causes extra checks to be performed after reading or writing from
+the file system. This prevents corrupted metadata blocks from causing
+file system damage by overwriting parts of the inode table or block
+group descriptors. This comes at the cost of increased memory and CPU
+overhead, so it is enabled only for debugging purposes. (This option is
+currently only supported by the ext4 file system driver in 2.6.35+
+kernels.)
+.TP
+.B discard
+The file system will be mouinted with the discard mount option. This will
+cause the file system driver to attempt to use the trim/discard feature
+of some storage devices (such as SSD's and thin-provisioned drives
+available in some enterprise storage arrays) to inform the storage
+device that blocks belonging to deleted files can be reused for other
+purposes. (This option is currently only supported by the ext4 file
+system driver in 2.6.35+ kernels.)
+.TP
+.B nodelalloc
+The file system will be mounted with the nodelalloc mount option. This
+will disable the delayed allocation feature. (This option is currently
+only supported by the ext4 file system driver in 2.6.35+ kernels.)
.RE
.TP
.BR \-O " [^]\fIfeature\fR[,...]"
diff --git
a/misc/tune2fs.c
b/misc/tune2fs.c
index
4be8542
..
e5722a5
100644
(file)
--- a/
misc/tune2fs.c
+++ b/
misc/tune2fs.c
@@
-979,6
+979,18
@@
static void parse_extended_opts(ext2_filsys fs, const char *opts)
"to %s (%d)\n"),
arg, hash_alg);
ext2fs_mark_super_dirty(fs);
+ } else if (strcmp(token, "mount-options")) {
+ if (!arg) {
+ r_usage++;
+ continue;
+ }
+ if (strlen(arg) >= sizeof(fs->super->s_mount_opts)) {
+ fprintf(stderr,
+ "Extended mount options too long\n");
+ continue;
+ }
+ strcpy(fs->super->s_mount_opts, arg);
+ ext2fs_mark_super_dirty(fs);
} else
r_usage++;
}