1 Index: linux-stage/fs/ext4/ext4.h
2 ===================================================================
3 --- linux-stage.orig/fs/ext4/ext4.h 2011-03-14 15:57:13.613674482 +0800
4 +++ linux-stage/fs/ext4/ext4.h 2011-03-14 15:57:22.031906980 +0800
6 #define EXT4_MOUNT_QUOTA 0x80000 /* Some quota option set */
7 #define EXT4_MOUNT_USRQUOTA 0x100000 /* "old" user quota */
8 #define EXT4_MOUNT_GRPQUOTA 0x200000 /* "old" group quota */
9 +#define EXT4_MOUNT_EXTENTS 0x400000 /* Extents support */
10 #define EXT4_MOUNT_JOURNAL_CHECKSUM 0x800000 /* Journal checksums */
11 #define EXT4_MOUNT_JOURNAL_ASYNC_COMMIT 0x1000000 /* Journal Async Commit */
12 #define EXT4_MOUNT_I_VERSION 0x2000000 /* i_version support */
13 Index: linux-stage/fs/ext4/ext4_jbd2.h
14 ===================================================================
15 --- linux-stage.orig/fs/ext4/ext4_jbd2.h 2011-03-14 15:57:12.000000000 +0800
16 +++ linux-stage/fs/ext4/ext4_jbd2.h 2011-03-14 15:58:55.957499110 +0800
19 #define EXT4_SINGLEDATA_TRANS_BLOCKS(sb) \
20 (EXT4_HAS_INCOMPAT_FEATURE(sb, EXT4_FEATURE_INCOMPAT_EXTENTS) \
22 + || test_opt(sb, EXTENTS) ? 27U : 8U)
24 #define ext4_journal_dirty_metadata(handle, bh) \
25 ext4_handle_dirty_metadata(handle, NULL, bh)
26 Index: linux-stage/fs/ext4/extents.c
27 ===================================================================
28 --- linux-stage.orig/fs/ext4/extents.c 2011-03-14 15:57:12.000000000 +0800
29 +++ linux-stage/fs/ext4/extents.c 2011-03-14 16:14:14.246265207 +0800
31 * possible initialization would be here
34 - if (EXT4_HAS_INCOMPAT_FEATURE(sb, EXT4_FEATURE_INCOMPAT_EXTENTS)) {
35 + if (test_opt(sb, EXTENTS)) {
36 #if defined(AGGRESSIVE_TEST) || defined(CHECK_BINSEARCH) || defined(EXTENTS_STATS)
37 printk(KERN_INFO "EXT4-fs: file extents enabled");
38 #ifdef AGGRESSIVE_TEST
41 void ext4_ext_release(struct super_block *sb)
43 - if (!EXT4_HAS_INCOMPAT_FEATURE(sb, EXT4_FEATURE_INCOMPAT_EXTENTS))
44 + if (!test_opt(sb, EXTENTS))
48 Index: linux-stage/fs/ext4/ialloc.c
49 ===================================================================
50 --- linux-stage.orig/fs/ext4/ialloc.c 2011-03-14 15:57:13.000000000 +0800
51 +++ linux-stage/fs/ext4/ialloc.c 2011-03-14 16:02:03.334308846 +0800
56 - if (EXT4_HAS_INCOMPAT_FEATURE(sb, EXT4_FEATURE_INCOMPAT_EXTENTS)) {
57 + if (test_opt(sb, EXTENTS)) {
58 /* set extent flag only for directory, file and normal symlink*/
59 if (S_ISDIR(mode) || S_ISREG(mode) || S_ISLNK(mode)) {
60 EXT4_I(inode)->i_flags |= EXT4_EXTENTS_FL;
61 Index: linux-stage/fs/ext4/migrate.c
62 ===================================================================
63 --- linux-stage.orig/fs/ext4/migrate.c 2011-03-14 15:36:15.000000000 +0800
64 +++ linux-stage/fs/ext4/migrate.c 2011-03-14 16:05:39.083369164 +0800
66 unsigned long max_entries;
70 - * If the filesystem does not support extents, or the inode
71 - * already is extent-based, error out.
73 - if (!EXT4_HAS_INCOMPAT_FEATURE(inode->i_sb,
74 - EXT4_FEATURE_INCOMPAT_EXTENTS) ||
75 - (EXT4_I(inode)->i_flags & EXT4_EXTENTS_FL))
76 + if (!test_opt(inode->i_sb, EXTENTS))
78 + * if mounted with noextents we don't allow the migrate
82 + if ((EXT4_I(inode)->i_flags & EXT4_EXTENTS_FL))
85 if (S_ISLNK(inode->i_mode) && inode->i_blocks == 0)
86 Index: linux-stage/fs/ext4/super.c
87 ===================================================================
88 --- linux-stage.orig/fs/ext4/super.c 2011-03-14 15:57:18.000000000 +0800
89 +++ linux-stage/fs/ext4/super.c 2011-03-14 16:11:58.234626200 +0800
91 seq_puts(seq, ",journal_async_commit");
92 if (test_opt(sb, NOBH))
93 seq_puts(seq, ",nobh");
94 + if (!test_opt(sb, EXTENTS))
95 + seq_puts(seq, ",noextents");
96 if (test_opt(sb, I_VERSION))
97 seq_puts(seq, ",i_version");
98 if (!test_opt(sb, DELALLOC))
100 Opt_inode_readahead_blks, Opt_journal_ioprio,
101 Opt_discard, Opt_nodiscard,
102 Opt_mballoc, Opt_bigendian_extents, Opt_force_over_16tb,
103 + Opt_extents, Opt_noextents,
106 static const match_table_t tokens = {
107 @@ -1571,6 +1574,8 @@
108 {Opt_mballoc, "mballoc"},
109 {Opt_discard, "discard"},
110 {Opt_nodiscard, "nodiscard"},
111 + {Opt_extents, "extents"},
112 + {Opt_noextents, "noextents"},
116 @@ -1613,6 +1618,7 @@
120 + ext4_fsblk_t last_block;
124 @@ -2017,6 +2023,32 @@
125 case Opt_force_over_16tb:
129 + if (!EXT4_HAS_INCOMPAT_FEATURE(sb,
130 + EXT4_FEATURE_INCOMPAT_EXTENTS)) {
131 + ext4_warning(sb, "extents feature not enabled "
132 + "on this filesystem, use tune2fs");
135 + set_opt(sbi->s_mount_opt, EXTENTS);
137 + case Opt_noextents:
139 + * When e2fsprogs support resizing an already existing
140 + * ext4 file system to greater than 2**32 we need to
141 + * add support to block allocator to handle growing
142 + * already existing block mapped inode so that blocks
143 + * allocated for them fall within 2**32
145 + last_block = ext4_blocks_count(sbi->s_es) - 1;
146 + if (last_block > 0xffffffffULL) {
147 + printk(KERN_ERR "EXT4-fs: Filesystem too "
148 + "large to mount with "
149 + "-o noextents options\n");
152 + clear_opt(sbi->s_mount_opt, EXTENTS);
155 ext4_msg(sb, KERN_ERR,
156 "Unrecognized mount option \"%s\" "
157 @@ -2879,6 +2911,17 @@
158 set_opt(sbi->s_mount_opt, BARRIER);
161 + * turn on extents feature by default in ext4 filesystem
162 + * only if feature flag already set by mkfs or tune2fs.
163 + * Use -o noextents to turn it off
165 + if (EXT4_HAS_INCOMPAT_FEATURE(sb, EXT4_FEATURE_INCOMPAT_EXTENTS))
166 + set_opt(sbi->s_mount_opt, EXTENTS);
168 + ext4_warning(sb, "extents feature not enabled on this filesystem, "
172 * enable delayed allocation by default
173 * Use -o nodelalloc to turn it off