1 diff -u -r linux-stage.orig/fs/ext4/ext4.h linux-stage/fs/ext4/ext4.h
2 --- linux-stage.orig/fs/ext4/ext4.h 2012-12-31 15:07:27.000000000 -0500
3 +++ linux-stage/fs/ext4/ext4.h 2012-12-31 15:14:03.000000000 -0500
5 #define EXT4_MOUNT_POSIX_ACL 0x08000 /* POSIX Access Control Lists */
6 #define EXT4_MOUNT_NO_AUTO_DA_ALLOC 0x10000 /* No auto delalloc mapping */
7 #define EXT4_MOUNT_BARRIER 0x20000 /* Use block barriers */
8 +#define EXT4_MOUNT_EXTENTS 0x40000 /* Extents support */
9 #define EXT4_MOUNT_QUOTA 0x80000 /* Some quota option set */
10 #define EXT4_MOUNT_USRQUOTA 0x100000 /* "old" user quota */
11 #define EXT4_MOUNT_GRPQUOTA 0x200000 /* "old" group quota */
12 diff -u -r linux-stage.orig/fs/ext4/ext4_jbd2.h linux-stage/fs/ext4/ext4_jbd2.h
13 --- linux-stage.orig/fs/ext4/ext4_jbd2.h 2012-12-31 15:07:27.000000000 -0500
14 +++ linux-stage/fs/ext4/ext4_jbd2.h 2012-12-31 15:07:34.000000000 -0500
17 #define EXT4_SINGLEDATA_TRANS_BLOCKS(sb) \
18 (EXT4_HAS_INCOMPAT_FEATURE(sb, EXT4_FEATURE_INCOMPAT_EXTENTS) \
20 + || test_opt(sb, EXTENTS) ? 27U : 8U)
22 #define ext4_journal_dirty_metadata(handle, bh) \
23 ext4_handle_dirty_metadata(handle, NULL, bh)
24 diff -u -r linux-stage.orig/fs/ext4/extents.c linux-stage/fs/ext4/extents.c
25 --- linux-stage.orig/fs/ext4/extents.c 2012-12-31 15:07:27.000000000 -0500
26 +++ linux-stage/fs/ext4/extents.c 2012-12-31 15:07:34.000000000 -0500
28 * possible initialization would be here
31 - if (EXT4_HAS_INCOMPAT_FEATURE(sb, EXT4_FEATURE_INCOMPAT_EXTENTS)) {
32 + if (test_opt(sb, EXTENTS)) {
33 #if defined(AGGRESSIVE_TEST) || defined(CHECK_BINSEARCH) || defined(EXTENTS_STATS)
34 printk(KERN_INFO "EXT4-fs: file extents enabled");
35 #ifdef AGGRESSIVE_TEST
38 void ext4_ext_release(struct super_block *sb)
40 - if (!EXT4_HAS_INCOMPAT_FEATURE(sb, EXT4_FEATURE_INCOMPAT_EXTENTS))
41 + if (!test_opt(sb, EXTENTS))
45 diff -u -r linux-stage.orig/fs/ext4/ialloc.c linux-stage/fs/ext4/ialloc.c
46 --- linux-stage.orig/fs/ext4/ialloc.c 2012-12-31 15:07:27.000000000 -0500
47 +++ linux-stage/fs/ext4/ialloc.c 2012-12-31 15:07:34.000000000 -0500
52 - if (EXT4_HAS_INCOMPAT_FEATURE(sb, EXT4_FEATURE_INCOMPAT_EXTENTS)) {
53 + if (test_opt(sb, EXTENTS)) {
54 /* set extent flag only for directory, file and normal symlink*/
55 if (S_ISDIR(mode) || S_ISREG(mode) || S_ISLNK(mode)) {
56 ext4_set_inode_flag(inode, EXT4_INODE_EXTENTS);
57 diff -u -r linux-stage.orig/fs/ext4/migrate.c linux-stage/fs/ext4/migrate.c
58 --- linux-stage.orig/fs/ext4/migrate.c 2012-12-31 15:07:27.000000000 -0500
59 +++ linux-stage/fs/ext4/migrate.c 2012-12-31 15:07:34.000000000 -0500
61 unsigned long max_entries;
65 - * If the filesystem does not support extents, or the inode
66 - * already is extent-based, error out.
68 - if (!EXT4_HAS_INCOMPAT_FEATURE(inode->i_sb,
69 - EXT4_FEATURE_INCOMPAT_EXTENTS) ||
70 - (ext4_test_inode_flag(inode, EXT4_INODE_EXTENTS)))
71 + if (!test_opt(inode->i_sb, EXTENTS))
73 + * if mounted with noextents we don't allow the migrate
77 if (S_ISLNK(inode->i_mode) && inode->i_blocks == 0)
78 diff -u -r linux-stage.orig/fs/ext4/super.c linux-stage/fs/ext4/super.c
79 --- linux-stage.orig/fs/ext4/super.c 2012-12-31 15:07:27.000000000 -0500
80 +++ linux-stage/fs/ext4/super.c 2012-12-31 15:15:49.000000000 -0500
82 seq_puts(seq, ",journal_async_commit");
83 else if (test_opt(sb, JOURNAL_CHECKSUM))
84 seq_puts(seq, ",journal_checksum");
85 + if (!test_opt(sb, EXTENTS))
86 + seq_puts(seq, ",noextents");
87 if (test_opt(sb, I_VERSION))
88 seq_puts(seq, ",i_version");
89 if (!test_opt(sb, DELALLOC) &&
91 Opt_inode_readahead_blks, Opt_journal_ioprio,
92 Opt_dioread_nolock, Opt_dioread_lock,
93 Opt_mballoc, Opt_bigendian_extents, Opt_force_over_128tb,
94 + Opt_extents, Opt_noextents,
95 Opt_discard, Opt_nodiscard, Opt_init_itable, Opt_noinit_itable,
99 {Opt_bigendian_extents, "bigendian_extents"},
100 {Opt_force_over_128tb, "force_over_128tb"},
101 {Opt_mballoc, "mballoc"},
102 + {Opt_extents, "extents"},
103 + {Opt_noextents, "noextents"},
104 {Opt_discard, "discard"},
105 {Opt_nodiscard, "nodiscard"},
106 {Opt_init_itable, "init_itable=%u"},
107 @@ -1472,6 +1477,7 @@
111 + ext4_fsblk_t last_block;
113 static int parse_options(char *options, struct super_block *sb,
114 unsigned long *journal_devnum,
115 @@ -1887,6 +1893,32 @@
116 case Opt_force_over_128tb:
117 force_over_128tb = 1;
120 + if (!EXT4_HAS_INCOMPAT_FEATURE(sb,
121 + EXT4_FEATURE_INCOMPAT_EXTENTS)) {
122 + ext4_warning(sb, "extents feature not enabled "
123 + "on this filesystem, use tune2fs");
126 + set_opt(sb, EXTENTS);
128 + case Opt_noextents:
130 + * When e2fsprogs support resizing an already existing
131 + * ext4 file system to greater than 2**32 we need to
132 + * add support to block allocator to handle growing
133 + * already existing block mapped inode so that blocks
134 + * allocated for them fall within 2**32
136 + last_block = ext4_blocks_count(sbi->s_es) - 1;
137 + if (last_block > 0xffffffffULL) {
138 + printk(KERN_ERR "EXT4-fs: Filesystem too "
139 + "large to mount with "
140 + "-o noextents options\n");
143 + clear_opt(sb, EXTENTS);
146 ext4_msg(sb, KERN_ERR,
147 "Unrecognized mount option \"%s\" "
148 @@ -3206,6 +3238,14 @@
149 set_opt(sb, BARRIER);
152 + * turn on extents feature by default in ext4 filesystem
153 + * only if feature flag already set by mkfs or tune2fs.
154 + * Use -o noextents to turn it off
156 + if (EXT4_HAS_INCOMPAT_FEATURE(sb, EXT4_FEATURE_INCOMPAT_EXTENTS))
157 + set_opt(sb, EXTENTS);
160 * enable delayed allocation by default
161 * Use -o nodelalloc to turn it off