-Index: linux-2.6.32-431.17.1.el6.x86_64/fs/ext4/ext4.h
+Index: linux-stage/fs/ext4/ext4.h
===================================================================
---- linux-2.6.32-431.17.1.el6.x86_64.orig/fs/ext4/ext4.h
-+++ linux-2.6.32-431.17.1.el6.x86_64/fs/ext4/ext4.h
-@@ -874,7 +874,8 @@ struct ext4_inode_info {
+--- linux-stage.orig/fs/ext4/ext4.h 2011-03-14 16:16:45.000000000 +0800
++++ linux-stage/fs/ext4/ext4.h 2011-03-14 16:17:08.732676431 +0800
+@@ -758,7 +758,8 @@
/*
* Mount flags
*/
#define EXT4_MOUNT_GRPID 0x00004 /* Create files with directory's group */
#define EXT4_MOUNT_DEBUG 0x00008 /* Some debugging messages */
#define EXT4_MOUNT_ERRORS_CONT 0x00010 /* Continue on errors */
-Index: linux-2.6.32-431.17.1.el6.x86_64/fs/ext4/super.c
+Index: linux-stage/fs/ext4/super.c
===================================================================
---- linux-2.6.32-431.17.1.el6.x86_64.orig/fs/ext4/super.c
-+++ linux-2.6.32-431.17.1.el6.x86_64/fs/ext4/super.c
-@@ -1216,6 +1216,7 @@ enum {
- Opt_block_validity, Opt_noblock_validity,
+--- linux-stage.orig/fs/ext4/super.c 2011-03-14 16:16:45.000000000 +0800
++++ linux-stage/fs/ext4/super.c 2011-03-14 16:18:13.831956469 +0800
+@@ -1502,6 +1502,7 @@
Opt_inode_readahead_blks, Opt_journal_ioprio,
Opt_mballoc, Opt_bigendian_extents, Opt_force_over_128tb,
+ Opt_extents, Opt_noextents,
+ Opt_no_mbcache,
Opt_discard, Opt_nodiscard,
- Opt_init_itable, Opt_noinit_itable,
+ Opt_init_inode_table, Opt_noinit_inode_table,
};
-@@ -1291,6 +1292,7 @@ static const match_table_t tokens = {
- {Opt_bigendian_extents, "bigendian_extents"},
- {Opt_force_over_128tb, "force_over_128tb"},
+@@ -1574,6 +1575,7 @@
+ {Opt_noauto_da_alloc, "noauto_da_alloc"},
+ {Opt_bigendian_extents, "bigendian_extents"},
{Opt_mballoc, "mballoc"},
+ {Opt_no_mbcache, "no_mbcache"},
+ {Opt_extents, "extents"},
+ {Opt_noextents, "noextents"},
{Opt_discard, "discard"},
- {Opt_nodiscard, "nodiscard"},
- {Opt_init_itable, "init_itable=%u"},
-@@ -1763,6 +1765,9 @@ set_qf_format:
- case Opt_force_over_128tb:
- force_over_128tb = 1;
+@@ -2049,6 +2051,9 @@
+ }
+ clear_opt(sbi->s_mount_opt, EXTENTS);
break;
+ case Opt_no_mbcache:
+ set_opt(sbi->s_mount_opt, NO_MBCACHE);
default:
ext4_msg(sb, KERN_ERR,
"Unrecognized mount option \"%s\" "
-Index: linux-2.6.32-431.17.1.el6.x86_64/fs/ext4/xattr.c
+Index: linux-stage/fs/ext4/xattr.c
===================================================================
---- linux-2.6.32-431.17.1.el6.x86_64.orig/fs/ext4/xattr.c
-+++ linux-2.6.32-431.17.1.el6.x86_64/fs/ext4/xattr.c
+--- linux-stage.orig/fs/ext4/xattr.c 2011-03-14 16:16:43.000000000 +0800
++++ linux-stage/fs/ext4/xattr.c 2011-03-14 16:17:08.806677883 +0800
@@ -86,7 +86,8 @@
# define ea_bdebug(f...)
#endif
static struct buffer_head *ext4_xattr_cache_find(struct inode *,
struct ext4_xattr_header *,
struct mb_cache_entry **);
-@@ -333,7 +334,7 @@ bad_block:
+@@ -234,7 +235,7 @@
error = -EIO;
goto cleanup;
}
- ext4_xattr_cache_insert(bh);
+ ext4_xattr_cache_insert(inode->i_sb, bh);
entry = BFIRST(bh);
- error = ext4_xattr_find_entry(&entry, name_index, name, bh->b_size, 1,
- inode);
-@@ -492,7 +493,7 @@ ext4_xattr_block_list(struct inode *inod
+ error = ext4_xattr_find_entry(&entry, name_index, name, bh->b_size, 1);
+ if (error == -EIO)
+@@ -376,7 +377,7 @@
error = -EIO;
goto cleanup;
}
error = ext4_xattr_list_entries(inode, BFIRST(bh), buffer, buffer_size);
cleanup:
-@@ -589,7 +590,9 @@ ext4_xattr_release_block(handle_t *handl
+@@ -473,7 +474,9 @@
struct mb_cache_entry *ce = NULL;
int error = 0;
error = ext4_journal_get_write_access(handle, bh);
if (error)
goto out;
-@@ -988,8 +991,10 @@ ext4_xattr_block_set(handle_t *handle, s
- #define header(x) ((struct ext4_xattr_header *)(x))
-
+@@ -700,8 +703,10 @@
+ if (i->value && i->value_len > sb->s_blocksize)
+ return -ENOSPC;
if (s->base) {
- ce = mb_cache_entry_get(ext4_xattr_cache, bs->bh->b_bdev,
- bs->bh->b_blocknr);
error = ext4_journal_get_write_access(handle, bs->bh);
if (error)
goto cleanup;
-@@ -1006,7 +1011,7 @@ ext4_xattr_block_set(handle_t *handle, s
+@@ -718,7 +723,7 @@
if (!IS_LAST_ENTRY(s->first))
ext4_xattr_rehash(header(s->base),
s->here);
}
unlock_buffer(bs->bh);
if (error == -EIO)
-@@ -1089,7 +1094,8 @@ inserted:
+@@ -801,7 +806,8 @@
if (error)
goto cleanup_dquot;
}
ce = NULL;
} else if (bs->bh && s->base == bs->bh->b_data) {
/* We were modifying this block in-place. */
-@@ -1140,7 +1146,7 @@ getblk_failed:
+@@ -845,7 +851,7 @@
memcpy(new_bh->b_data, s->base, new_bh->b_size);
set_buffer_uptodate(new_bh);
unlock_buffer(new_bh);
error = ext4_handle_dirty_metadata(handle,
inode, new_bh);
if (error)
-@@ -1758,12 +1764,15 @@ ext4_xattr_put_super(struct super_block
+@@ -1403,12 +1409,15 @@
* Returns 0, or a negative error number on failure.
*/
static void
ce = mb_cache_entry_alloc(ext4_xattr_cache, GFP_NOFS);
if (!ce) {
ea_bdebug(bh, "out of memory");
-@@ -1836,6 +1845,8 @@ ext4_xattr_cache_find(struct inode *inod
+@@ -1482,6 +1491,8 @@
__u32 hash = le32_to_cpu(header->h_hash);
struct mb_cache_entry *ce;
--- /dev/null
+Index: linux-stage/fs/ext4/ext4.h
+===================================================================
+--- linux-stage.orig/fs/ext4/ext4.h 2011-05-20 11:01:37.000000000 +0300
++++ linux-stage/fs/ext4/ext4.h 2011-05-20 11:01:44.000000000 +0300
+@@ -859,6 +859,7 @@ struct ext4_inode_info {
+ #define EXT4_MOUNT_QUOTA 0x80000 /* Some quota option set */
+ #define EXT4_MOUNT_USRQUOTA 0x100000 /* "old" user quota */
+ #define EXT4_MOUNT_GRPQUOTA 0x200000 /* "old" group quota */
++#define EXT4_MOUNT_EXTENTS 0x400000 /* Extents support */
+ #define EXT4_MOUNT_JOURNAL_CHECKSUM 0x800000 /* Journal checksums */
+ #define EXT4_MOUNT_JOURNAL_ASYNC_COMMIT 0x1000000 /* Journal Async Commit */
+ #define EXT4_MOUNT_I_VERSION 0x2000000 /* i_version support */
+Index: linux-stage/fs/ext4/ext4_jbd2.h
+===================================================================
+--- linux-stage.orig/fs/ext4/ext4_jbd2.h 2011-05-20 11:00:01.000000000 +0300
++++ linux-stage/fs/ext4/ext4_jbd2.h 2011-05-20 11:01:44.000000000 +0300
+@@ -33,7 +33,7 @@
+
+ #define EXT4_SINGLEDATA_TRANS_BLOCKS(sb) \
+ (EXT4_HAS_INCOMPAT_FEATURE(sb, EXT4_FEATURE_INCOMPAT_EXTENTS) \
+- ? 27U : 8U)
++ || test_opt(sb, EXTENTS) ? 27U : 8U)
+
+ #define ext4_journal_dirty_metadata(handle, bh) \
+ ext4_handle_dirty_metadata(handle, NULL, bh)
+Index: linux-stage/fs/ext4/extents.c
+===================================================================
+--- linux-stage.orig/fs/ext4/extents.c 2011-05-20 11:00:01.000000000 +0300
++++ linux-stage/fs/ext4/extents.c 2011-05-20 11:01:44.000000000 +0300
+@@ -2555,7 +2555,7 @@ void ext4_ext_init(struct super_block *s
+ * possible initialization would be here
+ */
+
+- if (EXT4_HAS_INCOMPAT_FEATURE(sb, EXT4_FEATURE_INCOMPAT_EXTENTS)) {
++ if (test_opt(sb, EXTENTS)) {
+ #if defined(AGGRESSIVE_TEST) || defined(CHECK_BINSEARCH) || defined(EXTENTS_STATS)
+ printk(KERN_INFO "EXT4-fs: file extents enabled");
+ #ifdef AGGRESSIVE_TEST
+@@ -2582,7 +2582,7 @@ void ext4_ext_init(struct super_block *s
+ */
+ void ext4_ext_release(struct super_block *sb)
+ {
+- if (!EXT4_HAS_INCOMPAT_FEATURE(sb, EXT4_FEATURE_INCOMPAT_EXTENTS))
++ if (!test_opt(sb, EXTENTS))
+ return;
+
+ #ifdef EXTENTS_STATS
+Index: linux-stage/fs/ext4/ialloc.c
+===================================================================
+--- linux-stage.orig/fs/ext4/ialloc.c 2011-05-20 11:01:36.000000000 +0300
++++ linux-stage/fs/ext4/ialloc.c 2011-05-20 11:01:44.000000000 +0300
+@@ -1049,7 +1049,7 @@ got:
+ if (err)
+ goto fail_free_drop;
+
+- if (EXT4_HAS_INCOMPAT_FEATURE(sb, EXT4_FEATURE_INCOMPAT_EXTENTS)) {
++ if (test_opt(sb, EXTENTS)) {
+ /* set extent flag only for directory, file and normal symlink*/
+ if (S_ISDIR(mode) || S_ISREG(mode) || S_ISLNK(mode)) {
+ ext4_set_inode_flag(inode, EXT4_INODE_EXTENTS);
+Index: linux-stage/fs/ext4/migrate.c
+===================================================================
+--- linux-stage.orig/fs/ext4/migrate.c 2011-05-20 10:59:29.000000000 +0300
++++ linux-stage/fs/ext4/migrate.c 2011-05-20 11:03:22.000000000 +0300
+@@ -459,13 +459,10 @@ int ext4_ext_migrate(struct inode *inode
+ unsigned long max_entries;
+ __u32 goal;
+
+- /*
+- * If the filesystem does not support extents, or the inode
+- * already is extent-based, error out.
+- */
+- if (!EXT4_HAS_INCOMPAT_FEATURE(inode->i_sb,
+- EXT4_FEATURE_INCOMPAT_EXTENTS) ||
+- (ext4_test_inode_flag(inode, EXT4_INODE_EXTENTS)))
++ if (!test_opt(inode->i_sb, EXTENTS))
++ /*
++ * if mounted with noextents we don't allow the migrate
++ */
+ return -EINVAL;
+
+ if (S_ISLNK(inode->i_mode) && inode->i_blocks == 0)
+Index: linux-stage/fs/ext4/super.c
+===================================================================
+--- linux-stage.orig/fs/ext4/super.c 2011-05-20 11:01:37.000000000 +0300
++++ linux-stage/fs/ext4/super.c 2011-05-20 11:01:44.000000000 +0300
+@@ -945,6 +945,8 @@ static int ext4_show_options(struct seq_
+ seq_puts(seq, ",journal_async_commit");
+ if (test_opt(sb, NOBH))
+ seq_puts(seq, ",nobh");
++ if (!test_opt(sb, EXTENTS))
++ seq_puts(seq, ",noextents");
+ if (test_opt(sb, I_VERSION))
+ seq_puts(seq, ",i_version");
+ if (!test_opt(sb, DELALLOC))
+@@ -1515,6 +1517,7 @@ enum {
+ Opt_stripe, Opt_delalloc, Opt_nodelalloc,
+ Opt_inode_readahead_blks, Opt_journal_ioprio,
+ Opt_mballoc, Opt_bigendian_extents, Opt_force_over_128tb,
++ Opt_extents, Opt_noextents,
+ Opt_discard, Opt_nodiscard,
+ Opt_init_inode_table, Opt_noinit_inode_table,
+ };
+@@ -1589,6 +1592,8 @@ static const match_table_t tokens = {
+ {Opt_noauto_da_alloc, "noauto_da_alloc"},
+ {Opt_bigendian_extents, "bigendian_extents"},
+ {Opt_mballoc, "mballoc"},
++ {Opt_extents, "extents"},
++ {Opt_noextents, "noextents"},
+ {Opt_discard, "discard"},
+ {Opt_nodiscard, "nodiscard"},
+ {Opt_init_inode_table, "init_itable=%u"},
+@@ -1631,6 +1636,7 @@ static int parse_options(char *options,
+ int qtype, qfmt;
+ char *qname;
+ #endif
++ ext4_fsblk_t last_block;
+
+ if (!options)
+ return 1;
+@@ -2039,6 +2045,32 @@ set_qf_format:
+ case Opt_force_over_128tb:
+ force_over_128tb = 1;
+ break;
++ case Opt_extents:
++ if (!EXT4_HAS_INCOMPAT_FEATURE(sb,
++ EXT4_FEATURE_INCOMPAT_EXTENTS)) {
++ ext4_warning(sb, "extents feature not enabled "
++ "on this filesystem, use tune2fs");
++ return 0;
++ }
++ set_opt(sbi->s_mount_opt, EXTENTS);
++ break;
++ case Opt_noextents:
++ /*
++ * When e2fsprogs support resizing an already existing
++ * ext4 file system to greater than 2**32 we need to
++ * add support to block allocator to handle growing
++ * already existing block mapped inode so that blocks
++ * allocated for them fall within 2**32
++ */
++ last_block = ext4_blocks_count(sbi->s_es) - 1;
++ if (last_block > 0xffffffffULL) {
++ printk(KERN_ERR "EXT4-fs: Filesystem too "
++ "large to mount with "
++ "-o noextents options\n");
++ return 0;
++ }
++ clear_opt(sbi->s_mount_opt, EXTENTS);
++ break;
+ default:
+ ext4_msg(sb, KERN_ERR,
+ "Unrecognized mount option \"%s\" "
+@@ -2901,6 +2933,14 @@ static int ext4_fill_super(struct super_
+ set_opt(sbi->s_mount_opt, BARRIER);
+
+ /*
++ * turn on extents feature by default in ext4 filesystem
++ * only if feature flag already set by mkfs or tune2fs.
++ * Use -o noextents to turn it off
++ */
++ if (EXT4_HAS_INCOMPAT_FEATURE(sb, EXT4_FEATURE_INCOMPAT_EXTENTS))
++ set_opt(sbi->s_mount_opt, EXTENTS);
++
++ /*
+ * enable delayed allocation by default
+ * Use -o nodelalloc to turn it off
+ */
-Index: linux-3.0.101-0.5/fs/ext4/ext4.h
-===================================================================
---- linux-3.0.101-0.5.orig/fs/ext4/ext4.h
-+++ linux-3.0.101-0.5/fs/ext4/ext4.h
-@@ -893,7 +893,8 @@ struct ext4_inode_info {
+diff -ru linux-stage.orig/fs/ext4/ext4.h linux-stage/fs/ext4/ext4.h
+--- linux-stage.orig/fs/ext4/ext4.h 2012-12-31 15:58:19.000000000 -0500
++++ linux-stage/fs/ext4/ext4.h 2012-12-31 15:58:42.000000000 -0500
+@@ -894,7 +894,8 @@
/*
* Mount flags
*/
#define EXT4_MOUNT_GRPID 0x00004 /* Create files with directory's group */
#define EXT4_MOUNT_DEBUG 0x00008 /* Some debugging messages */
#define EXT4_MOUNT_ERRORS_CONT 0x00010 /* Continue on errors */
-Index: linux-3.0.101-0.5/fs/ext4/super.c
-===================================================================
---- linux-3.0.101-0.5.orig/fs/ext4/super.c
-+++ linux-3.0.101-0.5/fs/ext4/super.c
-@@ -1369,6 +1369,7 @@ enum {
- Opt_inode_readahead_blks, Opt_journal_ioprio,
+diff -ru linux-stage.orig/fs/ext4/super.c linux-stage/fs/ext4/super.c
+--- linux-stage.orig/fs/ext4/super.c 2012-12-31 15:58:19.000000000 -0500
++++ linux-stage/fs/ext4/super.c 2012-12-31 15:59:19.000000000 -0500
+@@ -1306,6 +1306,7 @@
Opt_dioread_nolock, Opt_dioread_lock,
Opt_mballoc, Opt_bigendian_extents, Opt_force_over_128tb,
+ Opt_extents, Opt_noextents,
+ Opt_no_mbcache,
Opt_discard, Opt_nodiscard, Opt_init_itable, Opt_noinit_itable,
};
-
-@@ -1447,6 +1448,7 @@ static const match_table_t tokens = {
+
+@@ -1383,6 +1384,7 @@
{Opt_bigendian_extents, "bigendian_extents"},
{Opt_force_over_128tb, "force_over_128tb"},
{Opt_mballoc, "mballoc"},
+ {Opt_no_mbcache, "no_mbcache"},
+ {Opt_extents, "extents"},
+ {Opt_noextents, "noextents"},
{Opt_discard, "discard"},
- {Opt_nodiscard, "nodiscard"},
- {Opt_init_itable, "init_itable=%u"},
-@@ -1957,6 +1959,9 @@ set_qf_format:
- case Opt_force_over_128tb:
- force_over_128tb = 1;
+@@ -1919,6 +1921,9 @@
+ }
+ clear_opt(sb, EXTENTS);
break;
+ case Opt_no_mbcache:
+ set_opt(sb, NO_MBCACHE);
default:
ext4_msg(sb, KERN_ERR,
"Unrecognized mount option \"%s\" "
-Index: linux-3.0.101-0.5/fs/ext4/xattr.c
-===================================================================
---- linux-3.0.101-0.5.orig/fs/ext4/xattr.c
-+++ linux-3.0.101-0.5/fs/ext4/xattr.c
+diff -ru linux-stage.orig/fs/ext4/xattr.c linux-stage/fs/ext4/xattr.c
+--- linux-stage.orig/fs/ext4/xattr.c 2012-12-31 15:58:19.000000000 -0500
++++ linux-stage/fs/ext4/xattr.c 2012-12-31 16:46:21.000000000 -0500
@@ -86,7 +86,8 @@
# define ea_bdebug(f...)
#endif
-
+
-static void ext4_xattr_cache_insert(struct buffer_head *);
+static void ext4_xattr_cache_insert(struct super_block *,
+ struct buffer_head *);
static struct buffer_head *ext4_xattr_cache_find(struct inode *,
struct ext4_xattr_header *,
struct mb_cache_entry **);
-@@ -332,7 +333,7 @@ bad_block:
+@@ -332,7 +333,7 @@
error = -EIO;
goto cleanup;
}
entry = BFIRST(bh);
error = ext4_xattr_find_entry(&entry, name_index, name, bh->b_size, 1,
inode);
-@@ -492,7 +493,7 @@ ext4_xattr_block_list(struct dentry *den
+@@ -492,7 +493,7 @@
error = -EIO;
goto cleanup;
}
- ext4_xattr_cache_insert(bh);
+ ext4_xattr_cache_insert(inode->i_sb, bh);
error = ext4_xattr_list_entries(dentry, BFIRST(bh), buffer, buffer_size);
-
+
cleanup:
-@@ -589,7 +590,9 @@ ext4_xattr_release_block(handle_t *handl
+@@ -589,7 +590,9 @@
struct mb_cache_entry *ce = NULL;
int error = 0;
-
+
- ce = mb_cache_entry_get(ext4_xattr_cache, bh->b_bdev, bh->b_blocknr);
+ if (!test_opt(inode->i_sb, NO_MBCACHE))
+ ce = mb_cache_entry_get(ext4_xattr_cache, bh->b_bdev,
error = ext4_journal_get_write_access(handle, bh);
if (error)
goto out;
-@@ -992,8 +995,10 @@ ext4_xattr_block_set(handle_t *handle, s
+@@ -989,8 +992,10 @@
#define header(x) ((struct ext4_xattr_header *)(x))
-
+
if (s->base) {
- ce = mb_cache_entry_get(ext4_xattr_cache, bs->bh->b_bdev,
- bs->bh->b_blocknr);
error = ext4_journal_get_write_access(handle, bs->bh);
if (error)
goto cleanup;
-@@ -1010,7 +1015,7 @@ ext4_xattr_block_set(handle_t *handle, s
+@@ -1007,7 +1012,7 @@
if (!IS_LAST_ENTRY(s->first))
ext4_xattr_rehash(header(s->base),
s->here);
}
unlock_buffer(bs->bh);
if (error == -EIO)
-@@ -1093,7 +1098,8 @@ inserted:
+@@ -1090,7 +1095,8 @@
if (error)
goto cleanup_dquot;
}
ce = NULL;
} else if (bs->bh && s->base == bs->bh->b_data) {
/* We were modifying this block in-place. */
-@@ -1144,7 +1150,7 @@ getblk_failed:
+@@ -1141,7 +1147,7 @@
memcpy(new_bh->b_data, s->base, new_bh->b_size);
set_buffer_uptodate(new_bh);
unlock_buffer(new_bh);
error = ext4_handle_dirty_metadata(handle,
inode, new_bh);
if (error)
-@@ -1766,12 +1772,15 @@ ext4_xattr_put_super(struct super_block
+@@ -1761,12 +1767,15 @@
* Returns 0, or a negative error number on failure.
*/
static void
__u32 hash = le32_to_cpu(BHDR(bh)->h_hash);
struct mb_cache_entry *ce;
int error;
-
+
+ if (test_opt(sb, NO_MBCACHE))
+ return;
+
ce = mb_cache_entry_alloc(ext4_xattr_cache, GFP_NOFS);
if (!ce) {
ea_bdebug(bh, "out of memory");
-@@ -1844,6 +1853,8 @@ ext4_xattr_cache_find(struct inode *inod
+@@ -1839,6 +1848,8 @@
__u32 hash = le32_to_cpu(header->h_hash);
struct mb_cache_entry *ce;
-
+
+ if (test_opt(inode->i_sb, NO_MBCACHE))
+ return NULL;
if (!header->h_hash)
--- /dev/null
+diff -u -r linux-stage.orig/fs/ext4/ext4.h linux-stage/fs/ext4/ext4.h
+--- linux-stage.orig/fs/ext4/ext4.h 2012-12-31 15:07:27.000000000 -0500
++++ linux-stage/fs/ext4/ext4.h 2012-12-31 15:14:03.000000000 -0500
+@@ -912,6 +912,7 @@
+ #define EXT4_MOUNT_POSIX_ACL 0x08000 /* POSIX Access Control Lists */
+ #define EXT4_MOUNT_NO_AUTO_DA_ALLOC 0x10000 /* No auto delalloc mapping */
+ #define EXT4_MOUNT_BARRIER 0x20000 /* Use block barriers */
++#define EXT4_MOUNT_EXTENTS 0x40000 /* Extents support */
+ #define EXT4_MOUNT_QUOTA 0x80000 /* Some quota option set */
+ #define EXT4_MOUNT_USRQUOTA 0x100000 /* "old" user quota */
+ #define EXT4_MOUNT_GRPQUOTA 0x200000 /* "old" group quota */
+diff -u -r linux-stage.orig/fs/ext4/ext4_jbd2.h linux-stage/fs/ext4/ext4_jbd2.h
+--- linux-stage.orig/fs/ext4/ext4_jbd2.h 2012-12-31 15:07:27.000000000 -0500
++++ linux-stage/fs/ext4/ext4_jbd2.h 2012-12-31 15:07:34.000000000 -0500
+@@ -33,7 +33,7 @@
+
+ #define EXT4_SINGLEDATA_TRANS_BLOCKS(sb) \
+ (EXT4_HAS_INCOMPAT_FEATURE(sb, EXT4_FEATURE_INCOMPAT_EXTENTS) \
+- ? 27U : 8U)
++ || test_opt(sb, EXTENTS) ? 27U : 8U)
+
+ #define ext4_journal_dirty_metadata(handle, bh) \
+ ext4_handle_dirty_metadata(handle, NULL, bh)
+diff -u -r linux-stage.orig/fs/ext4/extents.c linux-stage/fs/ext4/extents.c
+--- linux-stage.orig/fs/ext4/extents.c 2012-12-31 15:07:27.000000000 -0500
++++ linux-stage/fs/ext4/extents.c 2012-12-31 15:07:34.000000000 -0500
+@@ -2733,7 +2733,7 @@
+ * possible initialization would be here
+ */
+
+- if (EXT4_HAS_INCOMPAT_FEATURE(sb, EXT4_FEATURE_INCOMPAT_EXTENTS)) {
++ if (test_opt(sb, EXTENTS)) {
+ #if defined(AGGRESSIVE_TEST) || defined(CHECK_BINSEARCH) || defined(EXTENTS_STATS)
+ printk(KERN_INFO "EXT4-fs: file extents enabled");
+ #ifdef AGGRESSIVE_TEST
+@@ -2760,7 +2760,7 @@
+ */
+ void ext4_ext_release(struct super_block *sb)
+ {
+- if (!EXT4_HAS_INCOMPAT_FEATURE(sb, EXT4_FEATURE_INCOMPAT_EXTENTS))
++ if (!test_opt(sb, EXTENTS))
+ return;
+
+ #ifdef EXTENTS_STATS
+diff -u -r linux-stage.orig/fs/ext4/ialloc.c linux-stage/fs/ext4/ialloc.c
+--- linux-stage.orig/fs/ext4/ialloc.c 2012-12-31 15:07:27.000000000 -0500
++++ linux-stage/fs/ext4/ialloc.c 2012-12-31 15:07:34.000000000 -0500
+@@ -1057,7 +1057,7 @@
+ if (err)
+ goto fail_free_drop;
+
+- if (EXT4_HAS_INCOMPAT_FEATURE(sb, EXT4_FEATURE_INCOMPAT_EXTENTS)) {
++ if (test_opt(sb, EXTENTS)) {
+ /* set extent flag only for directory, file and normal symlink*/
+ if (S_ISDIR(mode) || S_ISREG(mode) || S_ISLNK(mode)) {
+ ext4_set_inode_flag(inode, EXT4_INODE_EXTENTS);
+diff -u -r linux-stage.orig/fs/ext4/migrate.c linux-stage/fs/ext4/migrate.c
+--- linux-stage.orig/fs/ext4/migrate.c 2012-12-31 15:07:27.000000000 -0500
++++ linux-stage/fs/ext4/migrate.c 2012-12-31 15:07:34.000000000 -0500
+@@ -469,13 +469,10 @@
+ unsigned long max_entries;
+ __u32 goal;
+
+- /*
+- * If the filesystem does not support extents, or the inode
+- * already is extent-based, error out.
+- */
+- if (!EXT4_HAS_INCOMPAT_FEATURE(inode->i_sb,
+- EXT4_FEATURE_INCOMPAT_EXTENTS) ||
+- (ext4_test_inode_flag(inode, EXT4_INODE_EXTENTS)))
++ if (!test_opt(inode->i_sb, EXTENTS))
++ /*
++ * if mounted with noextents we don't allow the migrate
++ */
+ return -EINVAL;
+
+ if (S_ISLNK(inode->i_mode) && inode->i_blocks == 0)
+diff -u -r linux-stage.orig/fs/ext4/super.c linux-stage/fs/ext4/super.c
+--- linux-stage.orig/fs/ext4/super.c 2012-12-31 15:07:27.000000000 -0500
++++ linux-stage/fs/ext4/super.c 2012-12-31 15:15:49.000000000 -0500
+@@ -1078,6 +1078,8 @@
+ seq_puts(seq, ",journal_async_commit");
+ else if (test_opt(sb, JOURNAL_CHECKSUM))
+ seq_puts(seq, ",journal_checksum");
++ if (!test_opt(sb, EXTENTS))
++ seq_puts(seq, ",noextents");
+ if (test_opt(sb, I_VERSION))
+ seq_puts(seq, ",i_version");
+ if (!test_opt(sb, DELALLOC) &&
+@@ -1303,6 +1305,7 @@
+ Opt_inode_readahead_blks, Opt_journal_ioprio,
+ Opt_dioread_nolock, Opt_dioread_lock,
+ Opt_mballoc, Opt_bigendian_extents, Opt_force_over_128tb,
++ Opt_extents, Opt_noextents,
+ Opt_discard, Opt_nodiscard, Opt_init_itable, Opt_noinit_itable,
+ };
+
+@@ -1380,6 +1383,8 @@
+ {Opt_bigendian_extents, "bigendian_extents"},
+ {Opt_force_over_128tb, "force_over_128tb"},
+ {Opt_mballoc, "mballoc"},
++ {Opt_extents, "extents"},
++ {Opt_noextents, "noextents"},
+ {Opt_discard, "discard"},
+ {Opt_nodiscard, "nodiscard"},
+ {Opt_init_itable, "init_itable=%u"},
+@@ -1472,6 +1477,7 @@
+ return 1;
+ }
+ #endif
++ ext4_fsblk_t last_block;
+
+ static int parse_options(char *options, struct super_block *sb,
+ unsigned long *journal_devnum,
+@@ -1887,6 +1893,32 @@
+ case Opt_force_over_128tb:
+ force_over_128tb = 1;
+ break;
++ case Opt_extents:
++ if (!EXT4_HAS_INCOMPAT_FEATURE(sb,
++ EXT4_FEATURE_INCOMPAT_EXTENTS)) {
++ ext4_warning(sb, "extents feature not enabled "
++ "on this filesystem, use tune2fs");
++ return 0;
++ }
++ set_opt(sb, EXTENTS);
++ break;
++ case Opt_noextents:
++ /*
++ * When e2fsprogs support resizing an already existing
++ * ext4 file system to greater than 2**32 we need to
++ * add support to block allocator to handle growing
++ * already existing block mapped inode so that blocks
++ * allocated for them fall within 2**32
++ */
++ last_block = ext4_blocks_count(sbi->s_es) - 1;
++ if (last_block > 0xffffffffULL) {
++ printk(KERN_ERR "EXT4-fs: Filesystem too "
++ "large to mount with "
++ "-o noextents options\n");
++ return 0;
++ }
++ clear_opt(sb, EXTENTS);
++ break;
+ default:
+ ext4_msg(sb, KERN_ERR,
+ "Unrecognized mount option \"%s\" "
+@@ -3206,6 +3238,14 @@
+ set_opt(sb, BARRIER);
+
+ /*
++ * turn on extents feature by default in ext4 filesystem
++ * only if feature flag already set by mkfs or tune2fs.
++ * Use -o noextents to turn it off
++ */
++ if (EXT4_HAS_INCOMPAT_FEATURE(sb, EXT4_FEATURE_INCOMPAT_EXTENTS))
++ set_opt(sb, EXTENTS);
++
++ /*
+ * enable delayed allocation by default
+ * Use -o nodelalloc to turn it off
+ */
rhel6.3/ext4-osd-iam-exports.patch
rhel6.3/ext4-hash-indexed-dir-dotdot-update.patch
rhel6.3/ext4-kill-dx_root.patch
+rhel6.3/ext4-extents-mount-option.patch
rhel6.3/ext4-fiemap-2.6.patch
rhel6.4/ext4-mballoc-pa_free-mismatch.patch
rhel6.3/ext4-data-in-dirent.patch
rhel6.3/ext4-osd-iam-exports.patch
rhel6.3/ext4-hash-indexed-dir-dotdot-update.patch
rhel6.3/ext4-kill-dx_root.patch
+rhel6.3/ext4-extents-mount-option.patch
rhel6.3/ext4-fiemap-2.6.patch
rhel6.4/ext4-mballoc-pa_free-mismatch.patch
rhel6.3/ext4-data-in-dirent.patch
rhel6.3/ext4-osd-iam-exports.patch
rhel6.3/ext4-hash-indexed-dir-dotdot-update.patch
rhel6.3/ext4-kill-dx_root.patch
+rhel6.3/ext4-extents-mount-option.patch
rhel6.3/ext4-fiemap-2.6.patch
rhel6.3/ext4-mballoc-pa_free-mismatch.patch
rhel6.3/ext4-data-in-dirent.patch
rhel6.3/ext4-osd-iam-exports.patch
rhel6.3/ext4-hash-indexed-dir-dotdot-update.patch
rhel6.3/ext4-kill-dx_root.patch
+rhel6.3/ext4-extents-mount-option.patch
rhel6.3/ext4-fiemap-2.6.patch
rhel6.3/ext4-mballoc-pa_free-mismatch.patch
rhel6.3/ext4-data-in-dirent.patch
rhel6.3/ext4-osd-iam-exports.patch
rhel6.3/ext4-hash-indexed-dir-dotdot-update.patch
sles11sp2/ext4-kill-dx_root.patch
+sles11sp2/ext4-extents-mount-option.patch
rhel6.3/ext4-fiemap-2.6.patch
sles11sp2/ext4-mballoc-pa_free-mismatch.patch
sles11sp2/ext4-data-in-dirent.patch
{
int rc;
- if (ldiskfs_test_inode_flag(inode, LDISKFS_INODE_EXTENTS)) {
+ if (LDISKFS_I(inode)->i_flags & LDISKFS_EXTENTS_FL) {
rc = osd_ldiskfs_map_ext_inode_pages(inode, page, pages,
blocks, create);
return rc;
* 5 is max tree depth: inode + 4 index blocks
* with blockmaps, depth is 3 at most
*/
- if (ldiskfs_test_inode_flag(inode, LDISKFS_INODE_EXTENTS)) {
+ if (LDISKFS_I(inode)->i_flags & LDISKFS_EXTENTS_FL) {
/*
* many concurrent threads may grow tree by the time
* our transaction starts. so, consider 2 is a min depth
struct inode *inode)
{
if (inode != NULL) {
- if (ldiskfs_test_inode_flag(inode, LDISKFS_INODE_EXTENTS))
+ if (LDISKFS_I(inode)->i_flags & LDISKFS_EXTENTS_FL)
return 1;
- } else if (LDISKFS_HAS_INCOMPAT_FEATURE(sb,
- LDISKFS_FEATURE_INCOMPAT_EXTENTS))
+ } else if (test_opt(sb, EXTENTS)) {
return 1;
+ }
return 0;
}