$(filter %.c,$(ldiskfs_patched_sources)): sources $(ldiskfs_linux_headers) $(filter %.h,$(ldiskfs_patched_sources))
+# Convert LDISKFS_SUPER_MAGIC back to EXT4_SUPER_MAGIC so that the ldiskfs
+# code can use the existing kernel headers instead of defining this itself.
ldiskfs_sed_flags = \
-e "s/dx_hash_info/ext4_dx_hash_info/g" \
-e "s/DX_HASH/EXT4_DX_HASH/g" \
- -e "s/EXT4/LDISKFS/g" -e "s/ext4/ldiskfs/g"
+ -e "s/EXT4/LDISKFS/g" -e "s/ext4/ldiskfs/g" \
+ -e "s/LDISKFS_SUPER_MAGIC/EXT4_SUPER_MAGIC/g"
%.c: linux-stage/fs/ext4/%.c
sed $(strip $(ldiskfs_sed_flags)) $< > $@
+++ /dev/null
-Index: linux-stage/fs/ext4/super.c
-===================================================================
---- linux-stage.orig/fs/ext4/super.c 2011-03-11 15:27:08.000000000 +0800
-+++ linux-stage/fs/ext4/super.c 2011-03-11 15:29:41.023089829 +0800
-@@ -72,6 +72,8 @@
- static int ext4_freeze(struct super_block *sb);
-
-
-+static int bigendian_extents;
-+
- ext4_fsblk_t ext4_block_bitmap(struct super_block *sb,
- struct ext4_group_desc *bg)
- {
-@@ -1492,7 +1494,7 @@
- Opt_stripe, Opt_delalloc, Opt_nodelalloc,
- Opt_block_validity, Opt_noblock_validity,
- Opt_inode_readahead_blks, Opt_journal_ioprio,
-- Opt_mballoc,
-+ Opt_mballoc, Opt_bigendian_extents,
- Opt_discard, Opt_nodiscard,
- Opt_init_inode_table, Opt_noinit_inode_table,
- };
-@@ -1559,6 +1561,7 @@
- {Opt_auto_da_alloc, "auto_da_alloc=%u"},
- {Opt_auto_da_alloc, "auto_da_alloc"},
- {Opt_noauto_da_alloc, "noauto_da_alloc"},
-+ {Opt_bigendian_extents, "bigendian_extents"},
- {Opt_mballoc, "mballoc"},
- {Opt_discard, "discard"},
- {Opt_nodiscard, "nodiscard"},
-@@ -1996,6 +1999,9 @@
- break;
- case Opt_mballoc:
- break;
-+ case Opt_bigendian_extents:
-+ bigendian_extents = 1;
-+ break;
- case Opt_discard:
- set_opt(sbi->s_mount_opt, DISCARD);
- break;
-@@ -3073,6 +3079,16 @@
- goto failed_mount;
- }
-
-+#ifdef __BIG_ENDIAN
-+ if (bigendian_extents == 0) {
-+ printk(KERN_ERR "EXT4-fs: extents feature is not guaranteed to "
-+ "work on big-endian systems. Use \"bigendian_extents\" "
-+ "mount option to override.\n");
-+ goto failed_mount;
-+ }
-+#endif
-+
-+
- #ifdef CONFIG_PROC_FS
- if (ext4_proc_root)
- sbi->s_proc = proc_mkdir(sb->s_id, ext4_proc_root);
make use of dentry->d_fsdata to pass fid to ext4. so no
changes in ext4_add_entry() interface required.
---- a/fs/ext4/dir.c
-+++ b/fs/ext4/dir.c
+Index: linux-2.6.32-504.3.3.el6.x86_64/fs/ext4/dir.c
+===================================================================
+--- linux-2.6.32-504.3.3.el6.x86_64.orig/fs/ext4/dir.c
++++ linux-2.6.32-504.3.3.el6.x86_64/fs/ext4/dir.c
@@ -37,11 +37,18 @@ static int ext4_dx_readdir(struct file *
static unsigned char get_dtype(struct super_block *sb, int filetype)
break;
i += ext4_rec_len_from_disk(de->rec_len,
sb->s_blocksize);
-@@ -457,12 +464,17 @@ int ext4_htree_store_dirent(struct file
+@@ -410,12 +417,17 @@ int ext4_htree_store_dirent(struct file
struct fname *fname, *new_fn;
struct dir_private_info *info;
int len;
new_fn = kzalloc(len, GFP_KERNEL);
if (!new_fn)
return -ENOMEM;
-@@ -471,7 +483,7 @@ int ext4_htree_store_dirent(struct file
+@@ -424,7 +436,7 @@ int ext4_htree_store_dirent(struct file
new_fn->inode = le32_to_cpu(dirent->inode);
new_fn->name_len = dirent->name_len;
new_fn->file_type = dirent->file_type;
new_fn->name[dirent->name_len] = 0;
while (*p) {
-Index: linux-stage/fs/ext4/ext4.h
+Index: linux-2.6.32-504.3.3.el6.x86_64/fs/ext4/ext4.h
===================================================================
---- linux-stage.orig/fs/ext4/ext4.h
-+++ linux-stage/fs/ext4/ext4.h
-@@ -843,6 +843,7 @@ struct ext4_inode_info {
+--- linux-2.6.32-504.3.3.el6.x86_64.orig/fs/ext4/ext4.h
++++ linux-2.6.32-504.3.3.el6.x86_64/fs/ext4/ext4.h
+@@ -881,6 +881,7 @@ struct ext4_inode_info {
#define EXT4_MOUNT_ERRORS_PANIC 0x00040 /* Panic on errors */
#define EXT4_MOUNT_MINIX_DF 0x00080 /* Mimics the Minix statfs */
#define EXT4_MOUNT_NOLOAD 0x00100 /* Don't use existing journal*/
#define EXT4_MOUNT_DATA_FLAGS 0x00C00 /* Mode for data writes: */
#define EXT4_MOUNT_JOURNAL_DATA 0x00400 /* Write data to journal */
#define EXT4_MOUNT_ORDERED_DATA 0x00800 /* Flush data before commit */
-@@ -1294,6 +1295,7 @@ EXT4_INODE_BIT_FNS(state, state_flags)
+@@ -1337,6 +1338,7 @@ EXT4_INODE_BIT_FNS(state, state_flags)
#define EXT4_FEATURE_INCOMPAT_64BIT 0x0080
#define EXT4_FEATURE_INCOMPAT_MMP 0x0100
#define EXT4_FEATURE_INCOMPAT_FLEX_BG 0x0200
#define EXT4_FEATURE_COMPAT_SUPP EXT2_FEATURE_COMPAT_EXT_ATTR
#define EXT4_FEATURE_INCOMPAT_SUPP (EXT4_FEATURE_INCOMPAT_FILETYPE| \
-@@ -1302,7 +1303,9 @@ EXT4_INODE_BIT_FNS(state, state_flags)
+@@ -1345,7 +1347,9 @@ EXT4_INODE_BIT_FNS(state, state_flags)
EXT4_FEATURE_INCOMPAT_EXTENTS| \
EXT4_FEATURE_INCOMPAT_64BIT| \
EXT4_FEATURE_INCOMPAT_FLEX_BG| \
#define EXT4_FEATURE_RO_COMPAT_SUPP (EXT4_FEATURE_RO_COMPAT_SPARSE_SUPER| \
EXT4_FEATURE_RO_COMPAT_LARGE_FILE| \
EXT4_FEATURE_RO_COMPAT_GDT_CSUM| \
-@@ -1388,6 +1391,43 @@ struct ext4_dir_entry_2 {
+@@ -1431,6 +1435,43 @@ struct ext4_dir_entry_2 {
#define EXT4_FT_SYMLINK 7
#define EXT4_FT_MAX 8
/*
* EXT4_DIR_PAD defines the directory entries boundaries
-@@ -1396,8 +1436,11 @@ struct ext4_dir_entry_2 {
+@@ -1439,8 +1480,11 @@ struct ext4_dir_entry_2 {
*/
#define EXT4_DIR_PAD 4
#define EXT4_DIR_ROUND (EXT4_DIR_PAD - 1)
#define EXT4_MAX_REC_LEN ((1<<16)-1)
static inline unsigned int
-@@ -1791,7 +1834,7 @@ extern struct buffer_head * ext4_find_en
+@@ -1841,7 +1885,7 @@ extern struct buffer_head * ext4_find_en
struct ext4_dir_entry_2 ** res_dir);
#define ll_ext4_find_entry(inode, dentry, res_dir) ext4_find_entry(inode, &(dentry)->d_name, res_dir)
extern int ext4_add_dot_dotdot(handle_t *handle, struct inode *dir,
extern struct buffer_head *ext4_append(handle_t *handle,
struct inode *inode,
ext4_lblk_t *block, int *err);
-@@ -2143,6 +2186,28 @@ extern wait_queue_head_t aio_wq[];
+@@ -2198,6 +2242,28 @@ extern wait_queue_head_t aio_wq[];
#define to_aio_wq(v) (&aio_wq[((unsigned long)v) % WQ_HASH_SZ])
extern void ext4_aio_wait(struct inode *inode);
#endif /* __KERNEL__ */
#endif /* _EXT4_H */
---- a/fs/ext4/namei.c
-+++ b/fs/ext4/namei.c
+Index: linux-2.6.32-504.3.3.el6.x86_64/fs/ext4/namei.c
+===================================================================
+--- linux-2.6.32-504.3.3.el6.x86_64.orig/fs/ext4/namei.c
++++ linux-2.6.32-504.3.3.el6.x86_64/fs/ext4/namei.c
@@ -169,7 +169,8 @@ static unsigned dx_get_count(struct dx_e
static unsigned dx_get_limit(struct dx_entry *entries);
static void dx_set_count(struct dx_entry *entries, unsigned value);
out_journal:
if (journal) {
-@@ -1991,12 +2053,13 @@ retry:
+@@ -1993,12 +2055,13 @@ retry:
/* Initialize @inode as a subdirectory of @dir, and add the
* "." and ".." entries into the first directory block. */
int ext4_add_dot_dotdot(handle_t *handle, struct inode * dir,
if (IS_ERR(handle))
return PTR_ERR(handle);
-@@ -2017,17 +2080,32 @@ int ext4_add_dot_dotdot(handle_t *handle
+@@ -2019,17 +2082,32 @@ int ext4_add_dot_dotdot(handle_t *handle
de = (struct ext4_dir_entry_2 *) dir_block->b_data;
de->inode = cpu_to_le32(inode->i_ino);
de->name_len = 1;
inode->i_nlink = 2;
BUFFER_TRACE(dir_block, "call ext4_handle_dirty_metadata");
err = ext4_handle_dirty_metadata(handle, inode, dir_block);
-@@ -2066,7 +2144,7 @@ retry:
+@@ -2068,7 +2146,7 @@ retry:
if (IS_ERR(inode))
goto out_stop;
if (err)
goto out_clear_inode;
-@@ -2105,7 +2183,7 @@ static int empty_dir(struct inode *inode
+@@ -2107,7 +2185,7 @@ static int empty_dir(struct inode *inode
int err = 0;
sb = inode->i_sb;
!(bh = ext4_bread(NULL, inode, 0, 0, &err))) {
if (err)
ext4_error(inode->i_sb,
-diff -ur a/fs/ext4/super.c b/fs/ext4/super.c
---- a/fs/ext4/super.c 2014-01-02 11:40:34.000000000 -0500
-+++ b/fs/ext4/super.c 2014-01-02 11:46:45.000000000 -0500
-@@ -1191,7 +1191,7 @@
- Opt_usrjquota, Opt_grpjquota, Opt_offusrjquota, Opt_offgrpjquota,
- Opt_jqfmt_vfsold, Opt_jqfmt_vfsv0, Opt_jqfmt_vfsv1, Opt_quota,
- Opt_noquota, Opt_ignore, Opt_barrier, Opt_nobarrier, Opt_err,
-- Opt_iopen, Opt_noiopen, Opt_iopen_nopriv,
-+ Opt_iopen, Opt_noiopen, Opt_iopen_nopriv, Opt_dirdata,
- Opt_resize, Opt_usrquota, Opt_grpquota, Opt_i_version,
- Opt_stripe, Opt_delalloc, Opt_nodelalloc,
- Opt_block_validity, Opt_noblock_validity,
-@@ -1253,6 +1253,7 @@
- {Opt_iopen, "iopen"},
- {Opt_noiopen, "noiopen"},
- {Opt_iopen_nopriv, "iopen_nopriv"},
+Index: linux-2.6.32-504.3.3.el6.x86_64/fs/ext4/super.c
+===================================================================
+--- linux-2.6.32-504.3.3.el6.x86_64.orig/fs/ext4/super.c
++++ linux-2.6.32-504.3.3.el6.x86_64/fs/ext4/super.c
+@@ -1203,6 +1203,7 @@ enum {
+ Opt_usrjquota, Opt_grpjquota, Opt_offusrjquota, Opt_offgrpjquota,
+ Opt_jqfmt_vfsold, Opt_jqfmt_vfsv0, Opt_jqfmt_vfsv1, Opt_quota,
+ Opt_noquota, Opt_ignore, Opt_barrier, Opt_nobarrier, Opt_err,
++ Opt_dirdata,
+ Opt_resize, Opt_usrquota, Opt_grpquota, Opt_i_version,
+ Opt_stripe, Opt_delalloc, Opt_nodelalloc,
+ Opt_block_validity, Opt_noblock_validity,
+@@ -1259,6 +1260,7 @@ static const match_table_t tokens = {
+ {Opt_noquota, "noquota"},
+ {Opt_quota, "quota"},
+ {Opt_usrquota, "usrquota"},
+ {Opt_dirdata, "dirdata"},
- {Opt_barrier, "barrier=%u"},
- {Opt_barrier, "barrier"},
- {Opt_nobarrier, "nobarrier"},
-@@ -1631,6 +1632,9 @@
- case Opt_noiopen:
- case Opt_iopen_nopriv:
- break;
+ {Opt_barrier, "barrier=%u"},
+ {Opt_barrier, "barrier"},
+ {Opt_nobarrier, "nobarrier"},
+@@ -1634,6 +1636,9 @@ set_qf_format:
+ else
+ clear_opt(sbi->s_mount_opt, BARRIER);
+ break;
+ case Opt_dirdata:
+ set_opt(sbi->s_mount_opt, DIRDATA);
+ break;
- case Opt_ignore:
- break;
- case Opt_resize:
+ case Opt_ignore:
+ break;
+ case Opt_resize:
-Index: linux-stage/fs/ext4/ext4.h
+Index: linux-2.6.32-504.3.3.el6.x86_64/fs/ext4/ext4.h
===================================================================
---- 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 @@
+--- linux-2.6.32-504.3.3.el6.x86_64.orig/fs/ext4/ext4.h
++++ linux-2.6.32-504.3.3.el6.x86_64/fs/ext4/ext4.h
+@@ -873,7 +873,8 @@ struct ext4_inode_info {
/*
* 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-stage/fs/ext4/super.c
+Index: linux-2.6.32-504.3.3.el6.x86_64/fs/ext4/super.c
===================================================================
---- 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 @@
+--- linux-2.6.32-504.3.3.el6.x86_64.orig/fs/ext4/super.c
++++ linux-2.6.32-504.3.3.el6.x86_64/fs/ext4/super.c
+@@ -1252,6 +1252,7 @@ enum {
+ Opt_stripe, Opt_delalloc, Opt_nodelalloc,
+ Opt_block_validity, Opt_noblock_validity,
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_inode_table, Opt_noinit_inode_table,
+ Opt_discard, Opt_nodiscard, Opt_init_itable, Opt_noinit_itable,
};
-@@ -1574,6 +1575,7 @@
- {Opt_noauto_da_alloc, "noauto_da_alloc"},
- {Opt_bigendian_extents, "bigendian_extents"},
- {Opt_mballoc, "mballoc"},
+
+@@ -1320,6 +1321,7 @@ static const match_table_t tokens = {
+ {Opt_auto_da_alloc, "auto_da_alloc=%u"},
+ {Opt_auto_da_alloc, "auto_da_alloc"},
+ {Opt_noauto_da_alloc, "noauto_da_alloc"},
+ {Opt_no_mbcache, "no_mbcache"},
- {Opt_extents, "extents"},
- {Opt_noextents, "noextents"},
{Opt_discard, "discard"},
-@@ -2049,6 +2051,9 @@
- }
- clear_opt(sbi->s_mount_opt, EXTENTS);
+ {Opt_nodiscard, "nodiscard"},
+ {Opt_init_itable, "init_itable=%u"},
+@@ -1780,6 +1782,9 @@ set_qf_format:
+ case Opt_noinit_itable:
+ clear_opt(sbi->s_mount_opt, INIT_INODE_TABLE);
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-stage/fs/ext4/xattr.c
+Index: linux-2.6.32-504.3.3.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
+--- linux-2.6.32-504.3.3.el6.x86_64.orig/fs/ext4/xattr.c
++++ linux-2.6.32-504.3.3.el6.x86_64/fs/ext4/xattr.c
@@ -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 **);
-@@ -234,7 +235,7 @@
+@@ -333,7 +334,7 @@ bad_block:
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);
- if (error == -EIO)
-@@ -376,7 +377,7 @@
+ 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 = -EIO;
goto cleanup;
}
error = ext4_xattr_list_entries(inode, BFIRST(bh), buffer, buffer_size);
cleanup:
-@@ -473,7 +474,9 @@
+@@ -589,7 +590,9 @@ ext4_xattr_release_block(handle_t *handl
struct mb_cache_entry *ce = NULL;
int error = 0;
error = ext4_journal_get_write_access(handle, bh);
if (error)
goto out;
-@@ -700,8 +703,10 @@
- if (i->value && i->value_len > sb->s_blocksize)
- return -ENOSPC;
+@@ -988,8 +991,10 @@ ext4_xattr_block_set(handle_t *handle, s
+ #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;
-@@ -718,7 +723,7 @@
+@@ -1006,7 +1011,7 @@ ext4_xattr_block_set(handle_t *handle, s
if (!IS_LAST_ENTRY(s->first))
ext4_xattr_rehash(header(s->base),
s->here);
}
unlock_buffer(bs->bh);
if (error == -EIO)
-@@ -801,7 +806,8 @@
+@@ -1089,7 +1094,8 @@ inserted:
if (error)
goto cleanup_dquot;
}
ce = NULL;
} else if (bs->bh && s->base == bs->bh->b_data) {
/* We were modifying this block in-place. */
-@@ -845,7 +851,7 @@
+@@ -1140,7 +1146,7 @@ getblk_failed:
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)
-@@ -1403,12 +1409,15 @@
+@@ -1857,12 +1863,15 @@ ext4_xattr_put_super(struct super_block
* 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");
-@@ -1482,6 +1491,8 @@
+@@ -1935,6 +1944,8 @@ ext4_xattr_cache_find(struct inode *inod
__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
- */
+++ /dev/null
-Index: linux-stage/fs/ext4/super.c
-===================================================================
---- linux-stage.orig/fs/ext4/super.c 2011-03-11 15:35:15.680343230 +0800
-+++ linux-stage/fs/ext4/super.c 2011-03-11 15:44:45.037632078 +0800
-@@ -55,6 +55,8 @@
- struct proc_dir_entry *ext4_proc_root;
- static struct kset *ext4_kset;
-
-+static int force_over_128tb;
-+
- static int ext4_load_journal(struct super_block *, struct ext4_super_block *,
- unsigned long journal_devnum);
- static int ext4_commit_super(struct super_block *sb, int sync);
-@@ -1494,7 +1496,7 @@
- Opt_stripe, Opt_delalloc, Opt_nodelalloc,
- Opt_block_validity, Opt_noblock_validity,
- Opt_inode_readahead_blks, Opt_journal_ioprio,
-- Opt_mballoc, Opt_bigendian_extents,
-+ Opt_mballoc, Opt_bigendian_extents, Opt_force_over_128tb,
- Opt_discard, Opt_nodiscard,
- Opt_init_inode_table, Opt_noinit_inode_table,
- };
-@@ -1562,6 +1564,7 @@
- {Opt_auto_da_alloc, "auto_da_alloc"},
- {Opt_noauto_da_alloc, "noauto_da_alloc"},
- {Opt_bigendian_extents, "bigendian_extents"},
-+ {Opt_force_over_128tb, "force_over_128tb"},
- {Opt_mballoc, "mballoc"},
- {Opt_discard, "discard"},
- {Opt_nodiscard, "nodiscard"},
-@@ -2008,6 +2011,9 @@
- break;
- case Opt_mballoc:
- break;
-+ case Opt_force_over_128tb:
-+ force_over_128tb = 1;
-+ break;
- default:
- ext4_msg(sb, KERN_ERR,
- "Unrecognized mount option \"%s\" "
-@@ -3031,6 +3037,16 @@
- goto failed_mount;
- }
-
-+ if (ext4_blocks_count(es) > (8ULL << 32)) {
-+ if (force_over_128tb == 0) {
-+ printk(KERN_ERR "EXT4-fs does not support filesystems "
-+ "greater than 128TB and can cause data corruption."
-+ "Use \"force_over_128tb\" mount option to override."
-+ "\n");
-+ goto failed_mount;
-+ }
-+ }
-+
- if (EXT4_BLOCKS_PER_GROUP(sb) == 0)
- goto cantfind_ext4;
-
-Index: linux-stage/fs/ext4/ext4_jbd2.h
+commit 18aadd47f88464928b5ce57791c2e8f9f2aaece0 (v3.3-rc2-7-g18aadd4)
+Author: Bobi Jam <bobijam@whamcloud.com>
+Date: Mon Feb 20 17:53:02 2012 -0500
+
+ext4: expand commit callback and use it for mballoc
+
+The per-commit callback was used by mballoc code to manage free space
+bitmaps after deleted blocks have been released. This patch expands
+it to support multiple different callbacks, to allow other things to
+be done after the commit has been completed.
+
+Signed-off-by: Bobi Jam <bobijam@whamcloud.com>
+Signed-off-by: Andreas Dilger <adilger@whamcloud.com>
+Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
+
+Index: linux-2.6.32-504.3.3.el6.x86_64/fs/ext4/ext4_jbd2.h
===================================================================
---- linux-stage.orig/fs/ext4/ext4_jbd2.h
-+++ linux-stage/fs/ext4/ext4_jbd2.h
-@@ -106,6 +106,80 @@
+--- linux-2.6.32-504.3.3.el6.x86_64.orig/fs/ext4/ext4_jbd2.h
++++ linux-2.6.32-504.3.3.el6.x86_64/fs/ext4/ext4_jbd2.h
+@@ -104,6 +104,80 @@
#define EXT4_MAXQUOTAS_INIT_BLOCKS(sb) (MAXQUOTAS*EXT4_QUOTA_INIT_BLOCKS(sb))
#define EXT4_MAXQUOTAS_DEL_BLOCKS(sb) (MAXQUOTAS*EXT4_QUOTA_DEL_BLOCKS(sb))
int
ext4_mark_iloc_dirty(handle_t *handle,
struct inode *inode,
-Index: linux-stage/fs/ext4/mballoc.h
+Index: linux-2.6.32-504.3.3.el6.x86_64/fs/ext4/mballoc.h
===================================================================
---- linux-stage.orig/fs/ext4/mballoc.h
-+++ linux-stage/fs/ext4/mballoc.h
+--- linux-2.6.32-504.3.3.el6.x86_64.orig/fs/ext4/mballoc.h
++++ linux-2.6.32-504.3.3.el6.x86_64/fs/ext4/mballoc.h
@@ -96,23 +96,24 @@ extern u8 mb_enable_debug;
*/
#define MB_DEFAULT_GROUP_PREALLOC 512
};
struct ext4_prealloc_space {
-Index: linux-stage/fs/ext4/mballoc.c
+Index: linux-2.6.32-504.3.3.el6.x86_64/fs/ext4/mballoc.c
===================================================================
---- linux-stage.orig/fs/ext4/mballoc.c
-+++ linux-stage/fs/ext4/mballoc.c
+--- linux-2.6.32-504.3.3.el6.x86_64.orig/fs/ext4/mballoc.c
++++ linux-2.6.32-504.3.3.el6.x86_64/fs/ext4/mballoc.c
@@ -21,6 +21,7 @@
* mballoc.c contains the multiblocks allocation routines
*/
static inline void *mb_correct_addr_and_bit(int *bit, void *addr)
{
-@@ -2592,8 +2593,6 @@ int ext4_mb_init(struct super_block *sb,
+@@ -2581,8 +2582,6 @@ int ext4_mb_init(struct super_block *sb,
}
}
return 0;
}
-@@ -2693,58 +2692,54 @@ static inline int ext4_issue_discard(str
+@@ -2684,58 +2683,54 @@ static inline int ext4_issue_discard(str
* This function is called by the jbd2 layer once the commit has finished,
* so we know we can free the blocks that were released with that commit.
*/
int err, count = 0, count2 = 0;
- struct ext4_free_data *entry;
- struct list_head *l, *ltmp;
--
+
- list_for_each_safe(l, ltmp, &txn->t_private_list) {
- entry = list_entry(l, struct ext4_free_data, list);
-
-- mb_debug(1, "gonna free %u blocks in group %u (0x%p):",
-- entry->count, entry->group, entry);
+ mb_debug(1, "gonna free %u blocks in group %u (0x%p):",
+ entry->efd_count, entry->efd_group, entry);
-- if (test_opt(sb, DISCARD))
-- ext4_issue_discard(sb, entry->group,
-- entry->start_blk, entry->count);
+- mb_debug(1, "gonna free %u blocks in group %u (0x%p):",
+- entry->count, entry->group, entry);
+ if (test_opt(sb, DISCARD))
+ ext4_issue_discard(sb, entry->efd_group,
+ entry->efd_start_blk, entry->efd_count);
++
++ err = ext4_mb_load_buddy(sb, entry->efd_group, &e4b);
++ /* we expect to find existing buddy because it's pinned */
++ BUG_ON(err != 0);
++
++ db = e4b.bd_info;
++ /* there are blocks to put in buddy to make them really free */
++ count += entry->efd_count;
++ count2++;
++ ext4_lock_group(sb, entry->efd_group);
++ /* Take it out of per group rb tree */
++ rb_erase(&entry->efd_node, &(db->bb_free_root));
++ mb_free_blocks(NULL, &e4b, entry->efd_start_blk, entry->efd_count);
+- if (test_opt(sb, DISCARD))
+- ext4_issue_discard(sb, entry->group,
+- entry->start_blk, entry->count);
+-
- err = ext4_mb_load_buddy(sb, entry->group, &e4b);
- /* we expect to find existing buddy because it's pinned */
- BUG_ON(err != 0);
- /* Take it out of per group rb tree */
- rb_erase(&entry->node, &(db->bb_free_root));
- mb_free_blocks(NULL, &e4b, entry->start_blk, entry->count);
--
++ /*
++ * Clear the trimmed flag for the group so that the next
++ * ext4_trim_fs can trim it.
++ * If the volume is mounted with -o discard, online discard
++ * is supported and the free blocks will be trimmed online.
++ */
++ if (!test_opt(sb, DISCARD))
++ EXT4_MB_GRP_CLEAR_TRIMMED(db);
+
- /*
- * Clear the trimmed flag for the group so that the next
- * ext4_trim_fs can trim it.
- * If the volume is mounted with -o discard, online discard
- * is supported and the free blocks will be trimmed online.
-- */
++ if (!db->bb_free_root.rb_node) {
++ /* No more items in the per group rb tree
++ * balance refcounts from ext4_mb_free_metadata()
+ */
- if (!test_opt(sb, DISCARD))
- EXT4_MB_GRP_CLEAR_TRIMMED(db);
-
- ext4_unlock_group(sb, entry->group);
- kmem_cache_free(ext4_free_ext_cachep, entry);
- ext4_mb_release_desc(&e4b);
-+ err = ext4_mb_load_buddy(sb, entry->efd_group, &e4b);
-+ /* we expect to find existing buddy because it's pinned */
-+ BUG_ON(err != 0);
-+
-+ db = e4b.bd_info;
-+ /* there are blocks to put in buddy to make them really free */
-+ count += entry->efd_count;
-+ count2++;
-+ ext4_lock_group(sb, entry->efd_group);
-+ /* Take it out of per group rb tree */
-+ rb_erase(&entry->efd_node, &(db->bb_free_root));
-+ mb_free_blocks(NULL, &e4b, entry->efd_start_blk, entry->efd_count);
-+
-+ /*
-+ * Clear the trimmed flag for the group so that the next
-+ * ext4_trim_fs can trim it.
-+ * If the volume is mounted with -o discard, online discard
-+ * is supported and the free blocks will be trimmed online.
-+ */
-+ if (!test_opt(sb, DISCARD))
-+ EXT4_MB_GRP_CLEAR_TRIMMED(db);
-+
-+ if (!db->bb_free_root.rb_node) {
-+ /* No more items in the per group rb tree
-+ * balance refcounts from ext4_mb_free_metadata()
-+ */
+ page_cache_release(e4b.bd_buddy_page);
+ page_cache_release(e4b.bd_bitmap_page);
}
mb_debug(1, "freed %u blocks in %u structures\n", count, count2);
}
-@@ -2794,22 +2789,22 @@ int __init init_ext4_mballoc(void)
+@@ -2787,22 +2782,22 @@ int __init init_ext4_mballoc(void)
kmem_cache_create("ext4_alloc_context",
sizeof(struct ext4_allocation_context),
0, SLAB_RECLAIM_ACCOUNT, NULL);
}
void exit_ext4_mballoc(void)
-@@ -2821,7 +2816,7 @@ void exit_ext4_mballoc(void)
+@@ -2814,7 +2809,7 @@ void exit_ext4_mballoc(void)
rcu_barrier();
kmem_cache_destroy(ext4_pspace_cachep);
kmem_cache_destroy(ext4_ac_cachep);
ext4_remove_debugfs_entry();
}
-@@ -3362,8 +3357,8 @@ static void ext4_mb_generate_from_freeli
+@@ -3355,8 +3350,8 @@ static void ext4_mb_generate_from_freeli
n = rb_first(&(grp->bb_free_root));
while (n) {
n = rb_next(n);
}
return;
-@@ -4623,11 +4618,11 @@ out3:
+@@ -4606,11 +4601,11 @@ out:
* AND the blocks are associated with the same group.
*/
static int can_merge(struct ext4_free_data *entry1,
return 1;
return 0;
}
-@@ -4640,7 +4635,6 @@ ext4_mb_free_metadata(handle_t *handle,
+@@ -4623,7 +4618,6 @@ ext4_mb_free_metadata(handle_t *handle,
struct ext4_free_data *entry;
struct ext4_group_info *db = e4b->bd_info;
struct super_block *sb = e4b->bd_sb;
struct rb_node **n = &db->bb_free_root.rb_node, *node;
struct rb_node *parent = NULL, *new_node;
-@@ -4648,8 +4642,8 @@ ext4_mb_free_metadata(handle_t *handle,
+@@ -4631,8 +4625,8 @@ ext4_mb_free_metadata(handle_t *handle,
BUG_ON(e4b->bd_bitmap_page == NULL);
BUG_ON(e4b->bd_buddy_page == NULL);
if (!*n) {
/* first free block exent. We need to
-@@ -4662,15 +4656,15 @@ ext4_mb_free_metadata(handle_t *handle,
+@@ -4645,15 +4639,15 @@ ext4_mb_free_metadata(handle_t *handle,
}
while (*n) {
parent = *n;
return 0;
}
}
-@@ -4681,34 +4675,29 @@ ext4_mb_free_metadata(handle_t *handle,
+@@ -4664,34 +4658,29 @@ ext4_mb_free_metadata(handle_t *handle,
/* Now try to see the extent can be merged to left and right */
node = rb_prev(new_node);
if (node) {
return 0;
}
-@@ -4836,11 +4825,11 @@ do_more:
+@@ -4825,11 +4814,11 @@ do_more:
* blocks being freed are metadata. these blocks shouldn't
* be used until this transaction is committed
*/
ext4_lock_group(sb, block_group);
mb_clear_bits(bitmap_bh->b_data, bit, count);
-Index: linux-stage/fs/ext4/super.c
+Index: linux-2.6.32-504.3.3.el6.x86_64/fs/ext4/super.c
===================================================================
---- linux-stage.orig/fs/ext4/super.c
-+++ linux-stage/fs/ext4/super.c
-@@ -301,6 +301,23 @@ void ext4_journal_abort_handle(const cha
+--- linux-2.6.32-504.3.3.el6.x86_64.orig/fs/ext4/super.c
++++ linux-2.6.32-504.3.3.el6.x86_64/fs/ext4/super.c
+@@ -338,6 +338,23 @@ void ext4_journal_abort_handle(const cha
EXPORT_SYMBOL(ext4_journal_abort_handle);
/* Deal with the reporting of failure conditions on a filesystem such as
* inconsistencies detected or read IO failures.
*
-@@ -3040,6 +3057,8 @@ static int ext4_fill_super(struct super_
- }
- set_task_ioprio(sbi->s_journal->j_task, journal_ioprio);
+@@ -3500,6 +3517,8 @@ static int ext4_fill_super(struct super_
+ ext4_count_dirs(sb));
+ percpu_counter_set(&sbi->s_dirtyblocks_counter, 0);
+ sbi->s_journal->j_commit_callback = ext4_journal_commit_callback;
+
no_journal:
-
if (test_opt(sb, NOBH)) {
+ if (!(test_opt(sb, DATA_FLAGS) == EXT4_MOUNT_WRITEBACK_DATA)) {
===================================================================
--- linux-stage.orig/fs/ext4/ext4.h 2011-05-20 10:59:32.000000000 +0300
+++ linux-stage/fs/ext4/ext4.h 2011-05-20 11:01:06.000000000 +0300
-@@ -1191,6 +1191,9 @@ EXT4_INODE_BIT_FNS(state, state_flags)
-
- #define NEXT_ORPHAN(inode) EXT4_I(inode)->i_dtime
-
-+/* Has been moved to linux/magic.h but we need it for Lustre */
-+#define EXT4_SUPER_MAGIC 0xEF53
-+
- /*
- * Codes for operating systems
- */
@@ -1630,6 +1633,9 @@ extern void ext4_mb_put_buddy_cache_lock
ext4_group_t, int);
extern int ext4_trim_fs(struct super_block *, struct fstrim_range *);
void ext4_block_bitmap_set(struct super_block *sb,
struct ext4_group_desc *bg, ext4_fsblk_t blk)
-@@ -1500,10 +1501,12 @@ enum {
- Opt_usrjquota, Opt_grpjquota, Opt_offusrjquota, Opt_offgrpjquota,
- Opt_jqfmt_vfsold, Opt_jqfmt_vfsv0, Opt_jqfmt_vfsv1, Opt_quota,
- Opt_noquota, Opt_ignore, Opt_barrier, Opt_nobarrier, Opt_err,
-+ Opt_iopen, Opt_noiopen, Opt_iopen_nopriv,
- Opt_resize, Opt_usrquota, Opt_grpquota, Opt_i_version,
- Opt_stripe, Opt_delalloc, Opt_nodelalloc,
- Opt_block_validity, Opt_noblock_validity,
- Opt_inode_readahead_blks, Opt_journal_ioprio,
-+ Opt_mballoc,
- Opt_discard, Opt_nodiscard,
- Opt_init_inode_table, Opt_noinit_inode_table,
- };
-@@ -1556,6 +1559,9 @@ static const match_table_t tokens = {
- {Opt_noquota, "noquota"},
- {Opt_quota, "quota"},
- {Opt_usrquota, "usrquota"},
-+ {Opt_iopen, "iopen"},
-+ {Opt_noiopen, "noiopen"},
-+ {Opt_iopen_nopriv, "iopen_nopriv"},
- {Opt_barrier, "barrier=%u"},
- {Opt_barrier, "barrier"},
- {Opt_nobarrier, "nobarrier"},
-@@ -1571,6 +1577,7 @@ static const match_table_t tokens = {
- {Opt_auto_da_alloc, "auto_da_alloc=%u"},
- {Opt_auto_da_alloc, "auto_da_alloc"},
- {Opt_noauto_da_alloc, "noauto_da_alloc"},
-+ {Opt_mballoc, "mballoc"},
- {Opt_discard, "discard"},
- {Opt_nodiscard, "nodiscard"},
- {Opt_err, NULL},
-@@ -1928,6 +1935,10 @@ set_qf_format:
- else
- clear_opt(sbi->s_mount_opt, BARRIER);
- break;
-+ case Opt_iopen:
-+ case Opt_noiopen:
-+ case Opt_iopen_nopriv:
-+ break;
- case Opt_ignore:
- break;
- case Opt_resize:
-@@ -2011,6 +2022,8 @@ set_qf_format:
- case Opt_nodiscard:
- clear_opt(sbi->s_mount_opt, DISCARD);
- break;
-+ case Opt_mballoc:
-+ break;
- default:
- ext4_msg(sb, KERN_ERR,
- "Unrecognized mount option \"%s\" "
diff -urpN linux-stage.orig/fs/ext4/super.c linux-stage/fs/ext4/super.c
--- linux-stage.orig/fs/ext4/super.c 2013-05-13 09:35:17.628478645 -0400
+++ linux-stage/fs/ext4/super.c 2013-05-13 09:46:08.062358974 -0400
-@@ -1268,8 +1268,8 @@ enum {
- Opt_mballoc, Opt_bigendian_extents, Opt_force_over_128tb,
+@@ -1268,6 +1268,7 @@ enum {
Opt_extents, Opt_noextents,
Opt_no_mbcache,
-- Opt_discard, Opt_nodiscard,
-- Opt_init_itable, Opt_noinit_itable,
-+ Opt_discard, Opt_nodiscard, Opt_init_itable, Opt_noinit_itable,
+ Opt_discard, Opt_nodiscard, Opt_init_itable, Opt_noinit_itable,
+ Opt_max_dir_size_kb,
};
===================================================================
--- linux-stage.orig/fs/ext4/ext4.h
+++ linux-stage/fs/ext4/ext4.h
-@@ -1256,6 +1256,9 @@ EXT4_INODE_BIT_FNS(state, state_flags)
-
- #define NEXT_ORPHAN(inode) EXT4_I(inode)->i_dtime
-
-+/* Has been moved to linux/magic.h but we need it for Lustre */
-+#define EXT4_SUPER_MAGIC 0xEF53
-+
- /*
- * Codes for operating systems
- */
@@ -1757,6 +1760,9 @@ extern void ext4_add_groupblocks(handle_
ext4_fsblk_t block, unsigned long count);
extern int ext4_trim_fs(struct super_block *, struct fstrim_range *);
void ext4_block_bitmap_set(struct super_block *sb,
struct ext4_group_desc *bg, ext4_fsblk_t blk)
-@@ -1176,11 +1177,14 @@ enum {
- Opt_usrjquota, Opt_grpjquota, Opt_offusrjquota, Opt_offgrpjquota,
- Opt_jqfmt_vfsold, Opt_jqfmt_vfsv0, Opt_jqfmt_vfsv1, Opt_quota,
- Opt_noquota, Opt_ignore, Opt_barrier, Opt_nobarrier, Opt_err,
-+ Opt_iopen, Opt_noiopen, Opt_iopen_nopriv,
- Opt_resize, Opt_usrquota, Opt_grpquota, Opt_i_version,
- Opt_stripe, Opt_delalloc, Opt_nodelalloc,
- Opt_block_validity, Opt_noblock_validity,
- Opt_inode_readahead_blks, Opt_journal_ioprio,
-- Opt_discard, Opt_nodiscard, Opt_init_itable, Opt_noinit_itable,
-+ Opt_mballoc,
-+ Opt_discard, Opt_nodiscard,
-+ Opt_init_itable, Opt_noinit_itable,
- };
-
- static const match_table_t tokens = {
-@@ -1232,6 +1236,9 @@ static const match_table_t tokens = {
- {Opt_noquota, "noquota"},
- {Opt_quota, "quota"},
- {Opt_usrquota, "usrquota"},
-+ {Opt_iopen, "iopen"},
-+ {Opt_noiopen, "noiopen"},
-+ {Opt_iopen_nopriv, "iopen_nopriv"},
- {Opt_barrier, "barrier=%u"},
- {Opt_barrier, "barrier"},
- {Opt_nobarrier, "nobarrier"},
-@@ -1247,6 +1254,7 @@ static const match_table_t tokens = {
- {Opt_auto_da_alloc, "auto_da_alloc=%u"},
- {Opt_auto_da_alloc, "auto_da_alloc"},
- {Opt_noauto_da_alloc, "noauto_da_alloc"},
-+ {Opt_mballoc, "mballoc"},
- {Opt_discard, "discard"},
- {Opt_nodiscard, "nodiscard"},
- {Opt_init_itable, "init_itable=%u"},
-@@ -1607,6 +1615,10 @@ set_qf_format:
- else
- clear_opt(sbi->s_mount_opt, BARRIER);
- break;
-+ case Opt_iopen:
-+ case Opt_noiopen:
-+ case Opt_iopen_nopriv:
-+ break;
- case Opt_ignore:
- break;
- case Opt_resize:
-@@ -1704,6 +1716,8 @@ set_qf_format:
- case Opt_noinit_itable:
- clear_opt(sbi->s_mount_opt, INIT_INODE_TABLE);
- break;
-+ case Opt_mballoc:
-+ break;
- default:
- ext4_msg(sb, KERN_ERR,
- "Unrecognized mount option \"%s\" "
+++ /dev/null
---- a/fs/ext4/super.c
-+++ b/fs/ext4/super.c
-@@ -139,6 +139,8 @@ void ext4_kvfree(void *ptr)
-
- }
-
-+static int bigendian_extents;
-+
- ext4_fsblk_t ext4_block_bitmap(struct super_block *sb,
- struct ext4_group_desc *bg)
- {
-@@ -1354,7 +1356,7 @@ enum {
- Opt_nomblk_io_submit, Opt_block_validity, Opt_noblock_validity,
- Opt_inode_readahead_blks, Opt_journal_ioprio,
- Opt_dioread_nolock, Opt_dioread_lock,
-- Opt_mballoc,
-+ Opt_mballoc, Opt_bigendian_extents,
- Opt_discard, Opt_nodiscard, Opt_init_itable, Opt_noinit_itable,
- };
-
-@@ -1429,6 +1431,7 @@ static const match_table_t tokens = {
- {Opt_noauto_da_alloc, "noauto_da_alloc"},
- {Opt_dioread_nolock, "dioread_nolock"},
- {Opt_dioread_lock, "dioread_lock"},
-+ {Opt_bigendian_extents, "bigendian_extents"},
- {Opt_mballoc, "mballoc"},
- {Opt_discard, "discard"},
- {Opt_nodiscard, "nodiscard"},
-@@ -1903,6 +1906,9 @@ set_qf_format:
- else
- set_opt(sb,NO_AUTO_DA_ALLOC);
- break;
-+ case Opt_bigendian_extents:
-+ bigendian_extents = 1;
-+ break;
- case Opt_discard:
- set_opt(sb, DISCARD);
- break;
-@@ -3497,6 +3503,16 @@ static int ext4_fill_super(struct super_
- goto failed_mount;
- }
-
-+#ifdef __BIG_ENDIAN
-+ if (bigendian_extents == 0) {
-+ printk(KERN_ERR "EXT4-fs: extents feature is not guaranteed to "
-+ "work on big-endian systems. Use \"bigendian_extents\" "
-+ "mount option to override.\n");
-+ goto failed_mount;
-+ }
-+#endif
-+
-+
- #ifdef CONFIG_PROC_FS
- if (ext4_proc_root)
- sbi->s_proc = proc_mkdir(sb->s_id, ext4_proc_root);
fs/ext4/namei.c | 117 ++++++++++++++++++++++++++++++++++++++++----------------
3 files changed, 170 insertions(+), 43 deletions(-)
-Index: linux-stage/fs/ext4/dir.c
+Index: linux-3.0.101-0.5/fs/ext4/dir.c
===================================================================
---- linux-stage.orig/fs/ext4/dir.c
-+++ linux-stage/fs/ext4/dir.c
+--- linux-3.0.101-0.5.orig/fs/ext4/dir.c
++++ linux-3.0.101-0.5/fs/ext4/dir.c
@@ -53,11 +53,18 @@ const struct file_operations ext4_dir_op
static unsigned char get_dtype(struct super_block *sb, int filetype)
new_fn->name[dirent->name_len] = 0;
while (*p) {
-Index: linux-stage/fs/ext4/ext4.h
+Index: linux-3.0.101-0.5/fs/ext4/ext4.h
===================================================================
---- linux-stage.orig/fs/ext4/ext4.h
-+++ linux-stage/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
@@ -901,6 +901,7 @@ struct ext4_inode_info {
#define EXT4_MOUNT_ERRORS_PANIC 0x00040 /* Panic on errors */
#define EXT4_MOUNT_MINIX_DF 0x00080 /* Mimics the Minix statfs */
#define EXT4_MOUNT_DATA_FLAGS 0x00C00 /* Mode for data writes: */
#define EXT4_MOUNT_JOURNAL_DATA 0x00400 /* Write data to journal */
#define EXT4_MOUNT_ORDERED_DATA 0x00800 /* Flush data before commit */
-@@ -1411,7 +1412,9 @@ static inline void ext4_clear_state_flag
+@@ -1407,7 +1408,9 @@ static inline void ext4_clear_state_flag
EXT4_FEATURE_INCOMPAT_EXTENTS| \
EXT4_FEATURE_INCOMPAT_64BIT| \
EXT4_FEATURE_INCOMPAT_FLEX_BG| \
#define EXT4_FEATURE_RO_COMPAT_SUPP (EXT4_FEATURE_RO_COMPAT_SPARSE_SUPER| \
EXT4_FEATURE_RO_COMPAT_LARGE_FILE| \
EXT4_FEATURE_RO_COMPAT_GDT_CSUM| \
-@@ -1498,6 +1501,43 @@ struct ext4_dir_entry_2 {
+@@ -1494,6 +1497,43 @@ struct ext4_dir_entry_2 {
#define EXT4_FT_SYMLINK 7
#define EXT4_FT_MAX 8
/*
* EXT4_DIR_PAD defines the directory entries boundaries
-@@ -1506,8 +1546,11 @@ struct ext4_dir_entry_2 {
+@@ -1502,8 +1542,11 @@ struct ext4_dir_entry_2 {
*/
#define EXT4_DIR_PAD 4
#define EXT4_DIR_ROUND (EXT4_DIR_PAD - 1)
#define EXT4_MAX_REC_LEN ((1<<16)-1)
/*
-@@ -1899,7 +1942,7 @@ extern struct buffer_head * ext4_find_en
+@@ -1895,7 +1938,7 @@ extern struct buffer_head * ext4_find_en
struct ext4_dir_entry_2 ** res_dir);
#define ll_ext4_find_entry(inode, dentry, res_dir) ext4_find_entry(inode, &(dentry)->d_name, res_dir)
extern int ext4_add_dot_dotdot(handle_t *handle, struct inode *dir,
extern struct buffer_head *ext4_append(handle_t *handle,
struct inode *inode,
ext4_lblk_t *block, int *err);
-@@ -2299,6 +2342,28 @@ static inline void set_bitmap_uptodate(s
+@@ -2295,6 +2338,28 @@ static inline void set_bitmap_uptodate(s
extern wait_queue_head_t ext4__ioend_wq[EXT4_WQ_HASH_SZ];
extern struct mutex ext4__aio_mutex[EXT4_WQ_HASH_SZ];
#endif /* __KERNEL__ */
#endif /* _EXT4_H */
-Index: linux-stage/fs/ext4/namei.c
+Index: linux-3.0.101-0.5/fs/ext4/namei.c
===================================================================
---- linux-stage.orig/fs/ext4/namei.c
-+++ linux-stage/fs/ext4/namei.c
+--- linux-3.0.101-0.5.orig/fs/ext4/namei.c
++++ linux-3.0.101-0.5/fs/ext4/namei.c
@@ -170,7 +170,8 @@ static unsigned dx_get_count(struct dx_e
static unsigned dx_get_limit(struct dx_entry *entries);
static void dx_set_count(struct dx_entry *entries, unsigned value);
out_journal:
if (journal) {
-@@ -2003,12 +2065,13 @@ retry:
+@@ -2004,12 +2066,13 @@ retry:
/* Initialize @inode as a subdirectory of @dir, and add the
* "." and ".." entries into the first directory block. */
int ext4_add_dot_dotdot(handle_t *handle, struct inode * dir,
if (IS_ERR(handle))
return PTR_ERR(handle);
-@@ -2029,17 +2092,32 @@ int ext4_add_dot_dotdot(handle_t *handle
+@@ -2030,17 +2093,32 @@ int ext4_add_dot_dotdot(handle_t *handle
de = (struct ext4_dir_entry_2 *) dir_block->b_data;
de->inode = cpu_to_le32(inode->i_ino);
de->name_len = 1;
inode->i_nlink = 2;
BUFFER_TRACE(dir_block, "call ext4_handle_dirty_metadata");
err = ext4_handle_dirty_metadata(handle, inode, dir_block);
-@@ -2079,7 +2157,7 @@ retry:
+@@ -2080,7 +2158,7 @@ retry:
if (IS_ERR(inode))
goto out_stop;
if (err)
goto out_clear_inode;
err = ext4_add_entry(handle, dentry, inode);
-@@ -2117,7 +2195,7 @@ static int empty_dir(struct inode *inode
+@@ -2118,7 +2196,7 @@ static int empty_dir(struct inode *inode
int err = 0;
sb = inode->i_sb;
!(bh = ext4_bread(NULL, inode, 0, 0, &err))) {
if (err)
EXT4_ERROR_INODE(inode,
-Index: linux-stage/fs/ext4/super.c
+Index: linux-3.0.101-0.5/fs/ext4/super.c
===================================================================
---- linux-stage.orig/fs/ext4/super.c
-+++ linux-stage/fs/ext4/super.c
-@@ -1363,7 +1363,7 @@ enum {
+--- linux-3.0.101-0.5.orig/fs/ext4/super.c
++++ linux-3.0.101-0.5/fs/ext4/super.c
+@@ -1357,6 +1357,7 @@ enum {
Opt_data_err_abort, Opt_data_err_ignore,
Opt_usrjquota, Opt_grpjquota, Opt_offusrjquota, Opt_offgrpjquota,
Opt_jqfmt_vfsold, Opt_jqfmt_vfsv0, Opt_jqfmt_vfsv1, Opt_quota,
-- Opt_iopen, Opt_noiopen, Opt_iopen_nopriv,
-+ Opt_iopen, Opt_noiopen, Opt_iopen_nopriv, Opt_dirdata,
++ Opt_dirdata,
Opt_noquota, Opt_ignore, Opt_barrier, Opt_nobarrier, Opt_err,
Opt_resize, Opt_usrquota, Opt_grpquota, Opt_i_version,
Opt_stripe, Opt_delalloc, Opt_nodelalloc, Opt_mblk_io_submit,
-@@ -1427,6 +1427,7 @@ static const match_table_t tokens = {
- {Opt_iopen, "iopen"},
- {Opt_noiopen, "noiopen"},
- {Opt_iopen_nopriv, "iopen_nopriv"},
+@@ -1415,6 +1416,7 @@ static const match_table_t tokens = {
+ {Opt_noquota, "noquota"},
+ {Opt_quota, "quota"},
+ {Opt_usrquota, "usrquota"},
+ {Opt_dirdata, "dirdata"},
{Opt_barrier, "barrier=%u"},
{Opt_barrier, "barrier"},
{Opt_nobarrier, "nobarrier"},
-@@ -1840,6 +1841,9 @@ set_qf_format:
- case Opt_noiopen:
- case Opt_iopen_nopriv:
+@@ -1818,6 +1820,9 @@ set_qf_format:
+ else
+ clear_opt(sb, BARRIER);
break;
+ case Opt_dirdata:
+ set_opt(sb, DIRDATA);
-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 @@
+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 {
/*
* 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 */
-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 @@
+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
+@@ -1364,6 +1364,7 @@ enum {
+ Opt_nomblk_io_submit, Opt_block_validity, Opt_noblock_validity,
+ 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_no_mbcache,
Opt_discard, Opt_nodiscard, Opt_init_itable, Opt_noinit_itable,
};
-
-@@ -1383,6 +1384,7 @@
- {Opt_bigendian_extents, "bigendian_extents"},
- {Opt_force_over_128tb, "force_over_128tb"},
- {Opt_mballoc, "mballoc"},
+
+@@ -1436,6 +1437,7 @@ static const match_table_t tokens = {
+ {Opt_noauto_da_alloc, "noauto_da_alloc"},
+ {Opt_dioread_nolock, "dioread_nolock"},
+ {Opt_dioread_lock, "dioread_lock"},
+ {Opt_no_mbcache, "no_mbcache"},
- {Opt_extents, "extents"},
- {Opt_noextents, "noextents"},
{Opt_discard, "discard"},
-@@ -1919,6 +1921,9 @@
- }
- clear_opt(sb, EXTENTS);
+ {Opt_nodiscard, "nodiscard"},
+ {Opt_init_itable, "init_itable=%u"},
+@@ -1934,6 +1936,9 @@ set_qf_format:
+ case Opt_noinit_itable:
+ clear_opt(sb, INIT_INODE_TABLE);
break;
+ case Opt_no_mbcache:
+ set_opt(sb, NO_MBCACHE);
default:
ext4_msg(sb, KERN_ERR,
"Unrecognized mount option \"%s\" "
-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
+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
@@ -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 @@
+@@ -332,7 +333,7 @@ bad_block:
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 @@
+@@ -492,7 +493,7 @@ ext4_xattr_block_list(struct dentry *den
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 @@
+@@ -589,7 +590,9 @@ ext4_xattr_release_block(handle_t *handl
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;
-@@ -989,8 +992,10 @@
+@@ -992,8 +995,10 @@ ext4_xattr_block_set(handle_t *handle, s
#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;
-@@ -1007,7 +1012,7 @@
+@@ -1010,7 +1015,7 @@ ext4_xattr_block_set(handle_t *handle, s
if (!IS_LAST_ENTRY(s->first))
ext4_xattr_rehash(header(s->base),
s->here);
}
unlock_buffer(bs->bh);
if (error == -EIO)
-@@ -1090,7 +1095,8 @@
+@@ -1093,7 +1098,8 @@ inserted:
if (error)
goto cleanup_dquot;
}
ce = NULL;
} else if (bs->bh && s->base == bs->bh->b_data) {
/* We were modifying this block in-place. */
-@@ -1141,7 +1147,7 @@
+@@ -1144,7 +1150,7 @@ getblk_failed:
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)
-@@ -1761,12 +1767,15 @@
+@@ -1865,12 +1871,15 @@ ext4_xattr_put_super(struct super_block
* 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");
-@@ -1839,6 +1848,8 @@
+@@ -1943,6 +1952,8 @@ ext4_xattr_cache_find(struct inode *inod
__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
-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
-@@ -911,6 +911,7 @@ struct ext4_inode_info {
- #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 */
-Index: linux-3.0.101-0.5/fs/ext4/ext4_jbd2.h
-===================================================================
---- linux-3.0.101-0.5.orig/fs/ext4/ext4_jbd2.h
-+++ linux-3.0.101-0.5/fs/ext4/ext4_jbd2.h
-@@ -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)
-
- /* Extended attribute operations touch at most two data buffers,
- * two bitmap buffers, and two group summaries, in addition to the inode
-Index: linux-3.0.101-0.5/fs/ext4/extents.c
-===================================================================
---- linux-3.0.101-0.5.orig/fs/ext4/extents.c
-+++ linux-3.0.101-0.5/fs/ext4/extents.c
-@@ -2751,7 +2751,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
-@@ -2778,7 +2778,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-3.0.101-0.5/fs/ext4/ialloc.c
-===================================================================
---- linux-3.0.101-0.5.orig/fs/ext4/ialloc.c
-+++ linux-3.0.101-0.5/fs/ext4/ialloc.c
-@@ -1054,7 +1054,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-3.0.101-0.5/fs/ext4/migrate.c
-===================================================================
---- linux-3.0.101-0.5.orig/fs/ext4/migrate.c
-+++ linux-3.0.101-0.5/fs/ext4/migrate.c
-@@ -469,13 +469,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-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
-@@ -1128,6 +1128,8 @@ static int ext4_show_options(struct seq_
- 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) &&
-@@ -1369,6 +1371,7 @@ enum {
- 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,
- };
-
-@@ -1446,6 +1449,8 @@ static const match_table_t tokens = {
- {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"},
-@@ -1538,6 +1543,7 @@ static int clear_qf_name(struct super_bl
- return 1;
- }
- #endif
-+ ext4_fsblk_t last_block;
-
- static int parse_options(char *options, struct super_block *sb,
- unsigned long *journal_devnum,
-@@ -1953,6 +1959,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(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\" "
-@@ -3276,6 +3308,14 @@ static int ext4_fill_super(struct super_
- 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
- */
+++ /dev/null
-diff -r -u linux-stage.orig/fs/ext4/super.c linux-stage/fs/ext4/super.c
---- linux-stage.orig/fs/ext4/super.c 2012-12-31 12:55:18.000000000 -0500
-+++ linux-stage/fs/ext4/super.c 2012-12-31 12:56:14.000000000 -0500
-@@ -59,6 +59,8 @@
- static struct mutex ext4_li_mtx;
- static struct ext4_features *ext4_feat;
-
-+static int force_over_128tb;
-+
- static int ext4_load_journal(struct super_block *, struct ext4_super_block *,
- unsigned long journal_devnum);
- static int ext4_commit_super(struct super_block *sb, int sync);
-@@ -1298,7 +1300,7 @@
- Opt_nomblk_io_submit, Opt_block_validity, Opt_noblock_validity,
- Opt_inode_readahead_blks, Opt_journal_ioprio,
- Opt_dioread_nolock, Opt_dioread_lock,
-- Opt_mballoc, Opt_bigendian_extents,
-+ Opt_mballoc, Opt_bigendian_extents, Opt_force_over_128tb,
- Opt_discard, Opt_nodiscard, Opt_init_itable, Opt_noinit_itable,
- };
-
-@@ -1374,6 +1376,7 @@
- {Opt_dioread_nolock, "dioread_nolock"},
- {Opt_dioread_lock, "dioread_lock"},
- {Opt_bigendian_extents, "bigendian_extents"},
-+ {Opt_force_over_128tb, "force_over_128tb"},
- {Opt_mballoc, "mballoc"},
- {Opt_discard, "discard"},
- {Opt_nodiscard, "nodiscard"},
-@@ -1879,6 +1882,9 @@
- break;
- case Opt_mballoc:
- break;
-+ case Opt_force_over_128tb:
-+ force_over_128tb = 1;
-+ break;
- default:
- ext4_msg(sb, KERN_ERR,
- "Unrecognized mount option \"%s\" "
-@@ -3394,6 +3400,16 @@
- goto failed_mount;
- }
-
-+ if (ext4_blocks_count(es) > (8ULL << 32)) {
-+ if (force_over_128tb == 0) {
-+ printk(KERN_ERR "EXT4-fs does not support filesystems "
-+ "greater than 128TB and can cause data corruption."
-+ "Use \"force_over_128tb\" mount option to override."
-+ "\n");
-+ goto failed_mount;
-+ }
-+ }
-+
- if (EXT4_BLOCKS_PER_GROUP(sb) == 0)
- goto cantfind_ext4;
-
--- a/fs/ext4/ext4.h
+++ b/fs/ext4/ext4.h
-@@ -1308,6 +1308,9 @@ static inline void ext4_clear_state_flag
-
- #define NEXT_ORPHAN(inode) EXT4_I(inode)->i_dtime
-
-+/* Has been moved to linux/magic.h but we need it for Lustre */
-+#define EXT4_SUPER_MAGIC 0xEF53
-+
- /*
- * Codes for operating systems
- */
@@ -1826,6 +1829,9 @@ extern void ext4_add_groupblocks(handle_
ext4_fsblk_t block, unsigned long count);
extern int ext4_trim_fs(struct super_block *, struct fstrim_range *);
* How many index/leaf blocks need to change/allocate to modify nrblocks?
*
* if nrblocks are fit in a single extent (chunk flag is 1), then
---- a/fs/ext4/super.c
-+++ b/fs/ext4/super.c
-@@ -1332,12 +1332,14 @@ enum {
- Opt_data_err_abort, Opt_data_err_ignore,
- Opt_usrjquota, Opt_grpjquota, Opt_offusrjquota, Opt_offgrpjquota,
- Opt_jqfmt_vfsold, Opt_jqfmt_vfsv0, Opt_jqfmt_vfsv1, Opt_quota,
-+ Opt_iopen, Opt_noiopen, Opt_iopen_nopriv,
- Opt_noquota, Opt_ignore, Opt_barrier, Opt_nobarrier, Opt_err,
- Opt_resize, Opt_usrquota, Opt_grpquota, Opt_i_version,
- Opt_stripe, Opt_delalloc, Opt_nodelalloc, Opt_mblk_io_submit,
- Opt_nomblk_io_submit, Opt_block_validity, Opt_noblock_validity,
- Opt_inode_readahead_blks, Opt_journal_ioprio,
- Opt_dioread_nolock, Opt_dioread_lock,
-+ Opt_mballoc,
- Opt_discard, Opt_nodiscard, Opt_init_itable, Opt_noinit_itable,
- };
-
-@@ -1390,6 +1392,9 @@ static const match_table_t tokens = {
- {Opt_noquota, "noquota"},
- {Opt_quota, "quota"},
- {Opt_usrquota, "usrquota"},
-+ {Opt_iopen, "iopen"},
-+ {Opt_noiopen, "noiopen"},
-+ {Opt_iopen_nopriv, "iopen_nopriv"},
- {Opt_barrier, "barrier=%u"},
- {Opt_barrier, "barrier"},
- {Opt_nobarrier, "nobarrier"},
-@@ -1409,6 +1414,7 @@ static const match_table_t tokens = {
- {Opt_noauto_da_alloc, "noauto_da_alloc"},
- {Opt_dioread_nolock, "dioread_nolock"},
- {Opt_dioread_lock, "dioread_lock"},
-+ {Opt_mballoc, "mballoc"},
- {Opt_discard, "discard"},
- {Opt_nodiscard, "nodiscard"},
- {Opt_init_itable, "init_itable=%u"},
-@@ -1793,6 +1799,10 @@ set_qf_format:
- else
- clear_opt(sb, BARRIER);
- break;
-+ case Opt_iopen:
-+ case Opt_noiopen:
-+ case Opt_iopen_nopriv:
-+ break;
- case Opt_ignore:
- break;
- case Opt_resize:
-@@ -1904,6 +1914,8 @@ set_qf_format:
- case Opt_noinit_itable:
- clear_opt(sb, INIT_INODE_TABLE);
- break;
-+ case Opt_mballoc:
-+ break;
- default:
- ext4_msg(sb, KERN_ERR,
- "Unrecognized mount option \"%s\" "
rhel6.4/ext4-prealloc.patch
rhel6.3/ext4-mballoc-extra-checks.patch
rhel6.4/ext4-misc.patch
-rhel6.3/ext4-big-endian-check-2.6.patch
rhel6.3/ext4-alloc-policy-2.6.patch
-rhel6.3/ext4-force_over_128tb.patch
rhel6.3/ext4-pdir-fix.patch
rhel6.3/ext4-add-more-error-checks-to-ext4_mkdir.patch
rhel6.3/ext4-osd-iop-common.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.4/ext4-mballoc-pa_free-mismatch.patch
rhel6.3/ext4-data-in-dirent.patch
rhel6.4/ext4-back-dquot-to.patch
rhel6.4/ext4-prealloc.patch
rhel6.3/ext4-mballoc-extra-checks.patch
rhel6.4/ext4-misc.patch
-rhel6.3/ext4-big-endian-check-2.6.patch
rhel6.3/ext4-alloc-policy-2.6.patch
-rhel6.3/ext4-force_over_128tb.patch
rhel6.3/ext4-pdir-fix.patch
rhel6.3/ext4-add-more-error-checks-to-ext4_mkdir.patch
rhel6.3/ext4-osd-iop-common.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.4/ext4-mballoc-pa_free-mismatch.patch
rhel6.3/ext4-data-in-dirent.patch
rhel6.4/ext4-back-dquot-to.patch
rhel6.4/ext4-prealloc.patch
rhel6.3/ext4-mballoc-extra-checks.patch
rhel6.4/ext4-misc.patch
-rhel6.3/ext4-big-endian-check-2.6.patch
rhel6.3/ext4-alloc-policy-2.6.patch
-rhel6.3/ext4-force_over_128tb.patch
rhel6.3/ext4-pdir-fix.patch
rhel6.3/ext4-add-more-error-checks-to-ext4_mkdir.patch
rhel6.3/ext4-osd-iop-common.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.4/ext4-mballoc-pa_free-mismatch.patch
rhel6.3/ext4-data-in-dirent.patch
rhel6.4/ext4-back-dquot-to.patch
rhel6.3/ext4-prealloc.patch
rhel6.3/ext4-mballoc-extra-checks.patch
rhel6.3/ext4-misc.patch
-rhel6.3/ext4-big-endian-check-2.6.patch
rhel6.3/ext4-alloc-policy-2.6.patch
-rhel6.3/ext4-force_over_128tb.patch
rhel6.3/ext4-pdir-fix.patch
rhel6.3/ext4-add-more-error-checks-to-ext4_mkdir.patch
rhel6.3/ext4-osd-iop-common.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-mballoc-pa_free-mismatch.patch
rhel6.3/ext4-data-in-dirent.patch
rhel6.4/ext4-back-dquot-to.patch
rhel6.3/ext4-prealloc.patch
rhel6.3/ext4-mballoc-extra-checks.patch
rhel6.3/ext4-misc.patch
-rhel6.3/ext4-big-endian-check-2.6.patch
rhel6.3/ext4-alloc-policy-2.6.patch
-rhel6.3/ext4-force_over_128tb.patch
rhel6.3/ext4-pdir-fix.patch
rhel6.3/ext4-add-more-error-checks-to-ext4_mkdir.patch
rhel6.3/ext4-osd-iop-common.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-mballoc-pa_free-mismatch.patch
rhel6.3/ext4-data-in-dirent.patch
rhel6.4/ext4-back-dquot-to.patch
sles11sp2/ext4-mballoc-extra-checks.patch
sles11sp2/restore-path-in-walk_extent_callback.patch
sles11sp2/ext4-misc.patch
-sles11sp2/ext4-big-endian-check-3.0.patch
rhel6.3/ext4-alloc-policy-2.6.patch
-sles11sp2/ext4-force_over_128tb.patch
rhel6.3/ext4-pdir-fix.patch
sles11sp2/ext4-osd-iop-common.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
sles11sp2/ext4-mballoc-pa_free-mismatch.patch
sles11sp2/ext4-data-in-dirent.patch
sles11sp2/ext4-large-eas.patch
sles11sp2/ext4-mballoc-extra-checks.patch
sles11sp2/restore-path-in-walk_extent_callback.patch
sles11sp2/ext4-misc.patch
-sles11sp2/ext4-big-endian-check-3.0.patch
rhel6.3/ext4-alloc-policy-2.6.patch
-sles11sp2/ext4-force_over_128tb.patch
rhel6.3/ext4-pdir-fix.patch
sles11sp2/ext4-osd-iop-common.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
sles11sp2/ext4-mballoc-pa_free-mismatch.patch
sles11sp2/ext4-data-in-dirent.patch
sles11sp2/ext4-large-eas.patch
struct osd_thread_info *info = osd_oti_get(env);
struct lu_fid *fid = &info->oti_fid;
struct inode *inode;
- int rc = 0;
+ int rc = 0, force_over_128tb = 0;
ENTRY;
if (o->od_mnt != NULL)
RETURN(-E2BIG);
strcpy(o->od_mntdev, dev);
- OBD_PAGE_ALLOC(__page, GFP_IOFS);
- if (__page == NULL)
- GOTO(out, rc = -ENOMEM);
-
str = lustre_cfg_string(cfg, 2);
s_flags = simple_strtoul(str, NULL, 0);
str = strstr(str, ":");
if (str)
lmd_flags = simple_strtoul(str + 1, NULL, 0);
opts = lustre_cfg_string(cfg, 3);
+#ifdef __BIG_ENDIAN
+ if (opts == NULL || strstr(opts, "bigendian_extents") == NULL) {
+ CERROR("%s: device %s extents feature is not guaranteed to "
+ "work on big-endian systems. Use \"bigendian_extents\" "
+ "mount option to override.\n", name, dev);
+ RETURN(-EINVAL);
+ }
+#endif
+ if (opts != NULL && strstr(opts, "force_over_128tb") != NULL)
+ force_over_128tb = 1;
+
+ OBD_PAGE_ALLOC(__page, GFP_IOFS);
+ if (__page == NULL)
+ GOTO(out, rc = -ENOMEM);
page = (unsigned long)page_address(__page);
options = (char *)page;
*options = '\0';
- if (opts == NULL)
- strcat(options, "user_xattr,acl");
- else
+ if (opts != NULL) {
+ /* strip out the options for back compatiblity */
+ static char *sout[] = {
+ "mballoc",
+ "iopen",
+ "noiopen",
+ "iopen_nopriv",
+ "extents",
+ "noextents",
+ /* strip out option we processed in osd */
+ "bigendian_extents",
+ "force_over_128tb",
+ NULL
+ };
strcat(options, opts);
+ for (rc = 0, str = options; sout[rc]; ) {
+ char *op = strstr(str, sout[rc]);
+ if (op == NULL) {
+ rc++;
+ str = options;
+ continue;
+ }
+ if (op == options || *(op - 1) == ',') {
+ str = op + strlen(sout[rc]);
+ if (*str == ',' || *str == '\0') {
+ *str == ',' ? str++ : str;
+ memmove(op, str, strlen(str) + 1);
+ }
+ }
+ for (str = op; *str != ',' && *str != '\0'; str++)
+ ;
+ }
+ } else {
+ strncat(options, "user_xattr,acl", 14);
+ }
/* Glom up mount options */
if (*options != '\0')
GOTO(out, rc);
}
+ if (ldiskfs_blocks_count(LDISKFS_SB(osd_sb(o))->s_es) > (8ULL << 32) &&
+ force_over_128tb == 0) {
+ CERROR("%s: device %s LDISKFS does not support filesystems "
+ "greater than 128TB and can cause data corruption. "
+ "Use \"force_over_128tb\" mount option to override.\n",
+ name, dev);
+ GOTO(out, rc = -EINVAL);
+ }
+
#ifdef HAVE_DEV_SET_RDONLY
if (dev_check_rdonly(o->od_mnt->mnt_sb->s_bdev)) {
CERROR("%s: underlying device %s is marked as read-only. "
if (inode != NULL) {
if (LDISKFS_I(inode)->i_flags & LDISKFS_EXTENTS_FL)
return 1;
- } else if (test_opt(sb, EXTENTS)) {
+ } else if (LDISKFS_HAS_INCOMPAT_FEATURE(sb,
+ LDISKFS_FEATURE_INCOMPAT_EXTENTS)) {
return 1;
}
return 0;