Whamcloud - gitweb
LU-12561 ldiskfs: Remove unused 2.6.x patches 50/35550/4
authorPatrick Farrell <pfarrell@whamcloud.com>
Wed, 17 Jul 2019 23:07:24 +0000 (19:07 -0400)
committerOleg Drokin <green@whamcloud.com>
Sat, 27 Jul 2019 00:21:06 +0000 (00:21 +0000)
Lustre no longer supports 2.6.x kernels, so remove the
ldiskfs patches which are no longer used after removing
RHEL6 and non-3.x SLES11 support.

Test-Parameters: trivial
Signed-off-by: Patrick Farrell <pfarrell@whamcloud.com>
Change-Id: Icc31c9704669367ece16ec0c09746611cad32ee8
Reviewed-on: https://review.whamcloud.com/35550
Tested-by: jenkins <devops@whamcloud.com>
Tested-by: Maloo <maloo@whamcloud.com>
Reviewed-by: James Simmons <jsimmons@infradead.org>
Reviewed-by: Andreas Dilger <adilger@whamcloud.com>
61 files changed:
ldiskfs/kernel_patches/patches/rhel6.3/export-ext4-2.6.patch [deleted file]
ldiskfs/kernel_patches/patches/rhel6.3/ext4-add-missing-kfree-on-error-return-path-in-add_new_gdb.patch [deleted file]
ldiskfs/kernel_patches/patches/rhel6.3/ext4-add-more-error-checks-to-ext4_mkdir.patch [deleted file]
ldiskfs/kernel_patches/patches/rhel6.3/ext4-back-dquot-to.patch [deleted file]
ldiskfs/kernel_patches/patches/rhel6.3/ext4-data-in-dirent.patch [deleted file]
ldiskfs/kernel_patches/patches/rhel6.3/ext4-disable-mb-cache.patch [deleted file]
ldiskfs/kernel_patches/patches/rhel6.3/ext4-dont-check-before-replay.patch [deleted file]
ldiskfs/kernel_patches/patches/rhel6.3/ext4-drop-inode-from-orphan-list-if-ext4_delete_inode-fails.patch [deleted file]
ldiskfs/kernel_patches/patches/rhel6.3/ext4-fix-ext4_mb_add_n_trim.patch [deleted file]
ldiskfs/kernel_patches/patches/rhel6.3/ext4-fix-mbgroups-access.patch [deleted file]
ldiskfs/kernel_patches/patches/rhel6.3/ext4-inode_info_reorganize.patch [deleted file]
ldiskfs/kernel_patches/patches/rhel6.3/ext4-introduce-ext4_kvmalloc-ext4_kzalloc-and-ext4_kvfree.patch [deleted file]
ldiskfs/kernel_patches/patches/rhel6.3/ext4-journal-callback.patch [deleted file]
ldiskfs/kernel_patches/patches/rhel6.3/ext4-kill-dx_root.patch [deleted file]
ldiskfs/kernel_patches/patches/rhel6.3/ext4-large-dir.patch [deleted file]
ldiskfs/kernel_patches/patches/rhel6.3/ext4-large-eas.patch [deleted file]
ldiskfs/kernel_patches/patches/rhel6.3/ext4-lookup-dotdot.patch [deleted file]
ldiskfs/kernel_patches/patches/rhel6.3/ext4-map_inode_page-2.6.18.patch [deleted file]
ldiskfs/kernel_patches/patches/rhel6.3/ext4-max-dir-size-options.patch [deleted file]
ldiskfs/kernel_patches/patches/rhel6.3/ext4-mballoc-extra-checks.patch [deleted file]
ldiskfs/kernel_patches/patches/rhel6.3/ext4-mballoc-pa_free-mismatch.patch [deleted file]
ldiskfs/kernel_patches/patches/rhel6.3/ext4-misc.patch [deleted file]
ldiskfs/kernel_patches/patches/rhel6.3/ext4-mmp-dont-mark-bh-dirty.patch [deleted file]
ldiskfs/kernel_patches/patches/rhel6.3/ext4-mmp.patch [deleted file]
ldiskfs/kernel_patches/patches/rhel6.3/ext4-notalloc_under_idatasem.patch [deleted file]
ldiskfs/kernel_patches/patches/rhel6.3/ext4-osd-iop-common.patch [deleted file]
ldiskfs/kernel_patches/patches/rhel6.3/ext4-prealloc.patch [deleted file]
ldiskfs/kernel_patches/patches/rhel6.3/ext4-quota-dont-update-cmtime.patch [deleted file]
ldiskfs/kernel_patches/patches/rhel6.3/ext4-quota-first-class.patch [deleted file]
ldiskfs/kernel_patches/patches/rhel6.3/ext4-quota-force-block-alloc-quotaoff.patch [deleted file]
ldiskfs/kernel_patches/patches/rhel6.3/ext4-recalc-percpu-counters-after-journal.patch [deleted file]
ldiskfs/kernel_patches/patches/rhel6.3/ext4-store-tree-generation-at-find.patch [deleted file]
ldiskfs/kernel_patches/patches/rhel6.3/ext4-use-correct-inode.patch [deleted file]
ldiskfs/kernel_patches/patches/rhel6.3/ext4-use-ext4_kvzalloc-ext4_kvmalloc-for-s_group_desc-and-s_group_info.patch [deleted file]
ldiskfs/kernel_patches/patches/rhel6.3/ext4-use-vzalloc-in-ext4_fill_flex_info.patch [deleted file]
ldiskfs/kernel_patches/patches/rhel6.4/ext4-back-dquot-to.patch [deleted file]
ldiskfs/kernel_patches/patches/rhel6.4/ext4-extra-isize.patch [deleted file]
ldiskfs/kernel_patches/patches/rhel6.4/ext4-fix-mbgroups-access.patch [deleted file]
ldiskfs/kernel_patches/patches/rhel6.4/ext4-max-dir-size-options.patch [deleted file]
ldiskfs/kernel_patches/patches/rhel6.4/ext4-mballoc-pa_free-mismatch.patch [deleted file]
ldiskfs/kernel_patches/patches/rhel6.4/ext4-misc.patch [deleted file]
ldiskfs/kernel_patches/patches/rhel6.4/ext4-mmp.patch [deleted file]
ldiskfs/kernel_patches/patches/rhel6.4/ext4-prealloc.patch [deleted file]
ldiskfs/kernel_patches/patches/rhel6.4/ext4-vmalloc.patch [deleted file]
ldiskfs/kernel_patches/patches/rhel6.5/ext4-add-new-abstraction-ext4_map_blocks.patch [deleted file]
ldiskfs/kernel_patches/patches/rhel6.5/ext4-brackets-in-ext4-remove-blocks.patch [deleted file]
ldiskfs/kernel_patches/patches/rhel6.5/ext4-quota-first-class.patch [deleted file]
ldiskfs/kernel_patches/patches/rhel6.6/ext4-add-new-abstraction-ext4_map_blocks.patch [deleted file]
ldiskfs/kernel_patches/patches/rhel6.6/ext4-corrupted-inode-block-bitmaps-handling-patches.patch [deleted file]
ldiskfs/kernel_patches/patches/rhel6.6/ext4-inode_info_reorganize.patch [deleted file]
ldiskfs/kernel_patches/patches/rhel6.6/ext4-mmp-dont-mark-bh-dirty.patch [deleted file]
ldiskfs/kernel_patches/patches/rhel6.6/ext4-remove-truncate-warning.patch [deleted file]
ldiskfs/kernel_patches/patches/rhel6.6/ext4_s_max_ext_tree_depth.patch [deleted file]
ldiskfs/kernel_patches/patches/rhel6.8/ext4-journal-callback.patch [deleted file]
ldiskfs/kernel_patches/patches/rhel6.8/ext4-pdirop.patch [deleted file]
ldiskfs/kernel_patches/patches/rhel6.9/ext4-journal-callback.patch [deleted file]
ldiskfs/kernel_patches/patches/rhel6.9/ext4-pdirop.patch [deleted file]
ldiskfs/kernel_patches/patches/rhel6.9/ext4-prealloc.patch [deleted file]
ldiskfs/kernel_patches/patches/sles11sp1/ext4-ext_generation.patch [deleted file]
ldiskfs/kernel_patches/patches/sles11sp1/ext4-max-dir-size-options.patch [deleted file]
ldiskfs/kernel_patches/patches/sles11sp1/ext4-update-sles11-rhel6.patch [deleted file]

diff --git a/ldiskfs/kernel_patches/patches/rhel6.3/export-ext4-2.6.patch b/ldiskfs/kernel_patches/patches/rhel6.3/export-ext4-2.6.patch
deleted file mode 100644 (file)
index 02dd196..0000000
+++ /dev/null
@@ -1,74 +0,0 @@
-Index: linux-stage/fs/ext4/super.c
-===================================================================
---- linux-stage.orig/fs/ext4/super.c
-+++ linux-stage/fs/ext4/super.c
-@@ -4642,6 +4646,11 @@ static void __exit exit_ext4_fs(void)
-       exit_ext4_system_zone();
- }
-+EXPORT_SYMBOL(ext4_bread);
-+EXPORT_SYMBOL(ext4_journal_start_sb);
-+EXPORT_SYMBOL(__ext4_journal_stop);
-+EXPORT_SYMBOL(ext4_force_commit);
-+
- MODULE_AUTHOR("Remy Card, Stephen Tweedie, Andrew Morton, Andreas Dilger, Theodore Ts'o and others");
- MODULE_DESCRIPTION("Fourth Extended Filesystem");
- MODULE_LICENSE("GPL");
-Index: linux-stage/fs/ext4/ext4.h
-===================================================================
---- linux-stage.orig/fs/ext4/ext4.h
-+++ linux-stage/fs/ext4/ext4.h
-@@ -1643,6 +1643,8 @@ extern unsigned ext4_init_inode_bitmap(s
-                                      struct buffer_head *bh,
-                                      ext4_group_t group,
-                                      struct ext4_group_desc *desc);
-+extern struct buffer_head *ext4_read_inode_bitmap(struct super_block *sb,
-+                                                ext4_group_t block_group);
- extern void mark_bitmap_end(int start_bit, int end_bit, char *bitmap);
- extern int ext4_init_inode_table(struct super_block *sb,
-                                ext4_group_t group, int barrier);
-Index: linux-stage/fs/ext4/ialloc.c
-===================================================================
---- linux-stage.orig/fs/ext4/ialloc.c
-+++ linux-stage/fs/ext4/ialloc.c
-@@ -97,7 +97,7 @@ unsigned ext4_init_inode_bitmap(struct s
-  *
-  * Return buffer_head of bitmap on success or NULL.
-  */
--static struct buffer_head *
-+struct buffer_head *
- ext4_read_inode_bitmap(struct super_block *sb, ext4_group_t block_group)
- {
-       struct ext4_group_desc *desc;
-@@ -161,6 +161,7 @@ ext4_read_inode_bitmap(struct super_bloc
-       }
-       return bh;
- }
-+EXPORT_SYMBOL(ext4_read_inode_bitmap);
- /*
-  * NOTE! When we get the inode, we're the only people
-Index: linux-stage/fs/ext4/balloc.c
-===================================================================
---- linux-stage.orig/fs/ext4/balloc.c
-+++ linux-stage/fs/ext4/balloc.c
-@@ -229,6 +229,7 @@ struct ext4_group_desc * ext4_get_group_
-               *bh = sbi->s_group_desc[group_desc];
-       return desc;
- }
-+EXPORT_SYMBOL(ext4_get_group_desc);
- static int ext4_valid_block_bitmap(struct super_block *sb,
-                                       struct ext4_group_desc *desc,
-Index: linux-stage/fs/ext4/inode.c
-===================================================================
---- linux-stage.orig/fs/ext4/inode.c
-+++ linux-stage/fs/ext4/inode.c
-@@ -5131,6 +5131,7 @@ out_stop:
-       ext4_journal_stop(handle);
- }
-+EXPORT_SYMBOL(ext4_truncate);
- /*
-  * ext4_get_inode_loc returns with an extra refcount against the inode's
diff --git a/ldiskfs/kernel_patches/patches/rhel6.3/ext4-add-missing-kfree-on-error-return-path-in-add_new_gdb.patch b/ldiskfs/kernel_patches/patches/rhel6.3/ext4-add-missing-kfree-on-error-return-path-in-add_new_gdb.patch
deleted file mode 100644 (file)
index 622c3dd..0000000
+++ /dev/null
@@ -1,28 +0,0 @@
-From c49bafa3842751b8955a962859f42d307673d75d Mon Sep 17 00:00:00 2001
-From: Dan Carpenter <error27@gmail.com>
-Date: Sat, 30 Jul 2011 12:58:41 -0400
-Subject: ext4: add missing kfree() on error return path in add_new_gdb()
-Git-commit: c49bafa3
-Patch-mainline: v3.1-rc1
-
-We added some more error handling in b40971426a "ext4: add error
-checking to calls to ext4_handle_dirty_metadata()".  But we need to
-call kfree() as well to avoid a memory leak.
-
-Signed-off-by: Dan Carpenter <error27@gmail.com>
-Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
-Acked-by: Jeff Mahoney <jeffm@suse.com>
----
- fs/ext4/resize.c |    1 +
- 1 file changed, 1 insertion(+)
-
---- a/fs/ext4/resize.c
-+++ b/fs/ext4/resize.c
-@@ -475,6 +475,7 @@ static int add_new_gdb(handle_t *handle,
-       return 0;
-
- exit_inode:
-+      kfree(n_group_desc);
-       /* ext4_journal_release_buffer(handle, iloc.bh); */
-       brelse(iloc.bh);
- exit_dindj:
diff --git a/ldiskfs/kernel_patches/patches/rhel6.3/ext4-add-more-error-checks-to-ext4_mkdir.patch b/ldiskfs/kernel_patches/patches/rhel6.3/ext4-add-more-error-checks-to-ext4_mkdir.patch
deleted file mode 100644 (file)
index 79d7a68..0000000
+++ /dev/null
@@ -1,75 +0,0 @@
-From dabd991f9d8e3232bb4531c920daddac8d10d313 Mon Sep 17 00:00:00 2001
-From: Namhyung Kim <namhyung@gmail.com>
-Date: Mon, 10 Jan 2011 12:11:16 -0500
-Subject: ext4: add more error checks to ext4_mkdir()
-Git-commit: dabd991f
-Patch-mainline: v2.6.38-rc1
-
-Check return value of ext4_journal_get_write_access,
-ext4_journal_dirty_metadata and ext4_mark_inode_dirty. Move brelse()
-under 'out_stop' to release bh properly in case of journal error.
-
-Upstream-Signed-off-by: Namhyung Kim <namhyung@gmail.com>
-Upstream-Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
-Upstream-Acked-by: Jeff Mahoney <jeffm@suse.com>
----
- fs/ext4/namei.c |   21 ++++++++++++++-------
- 1 files changed, 14 insertions(+), 7 deletions(-)
-
-diff --git a/fs/ext4/namei.c b/fs/ext4/namei.c
-index 96a594d..6dfc5b9 100644
---- a/fs/ext4/namei.c
-+++ b/fs/ext4/namei.c
-@@ -1789,7 +1789,7 @@ static int ext4_mkdir(struct inode *dir, struct dentry *dentry, int mode)
- {
-       handle_t *handle;
-       struct inode *inode;
--      struct buffer_head *dir_block;
-+      struct buffer_head *dir_block = NULL;
-       struct ext4_dir_entry_2 *de;
-       unsigned int blocksize = dir->i_sb->s_blocksize;
-       int err, retries = 0;
-@@ -1822,7 +1822,9 @@ retry:
-       if (!dir_block)
-               goto out_clear_inode;
-       BUFFER_TRACE(dir_block, "get_write_access");
--      ext4_journal_get_write_access(handle, dir_block);
-+      err = ext4_journal_get_write_access(handle, dir_block);
-+      if (err)
-+              goto out_clear_inode;
-       de = (struct ext4_dir_entry_2 *) dir_block->b_data;
-       de->inode = cpu_to_le32(inode->i_ino);
-       de->name_len = 1;
-@@ -1839,10 +1841,12 @@ retry:
-       ext4_set_de_type(dir->i_sb, de, S_IFDIR);
-       inode->i_nlink = 2;
-       BUFFER_TRACE(dir_block, "call ext4_handle_dirty_metadata");
--      ext4_handle_dirty_metadata(handle, inode, dir_block);
--      brelse(dir_block);
--      ext4_mark_inode_dirty(handle, inode);
--      err = ext4_add_entry(handle, dentry, inode);
-+      err = ext4_handle_dirty_metadata(handle, inode, dir_block);
-+      if (err)
-+              goto out_clear_inode;
-+      err = ext4_mark_inode_dirty(handle, inode);
-+      if (!err)
-+              err = ext4_add_entry(handle, dentry, inode);
-       if (err) {
- out_clear_inode:
-               clear_nlink(inode);
-@@ -1853,10 +1857,13 @@ out_clear_inode:
-       }
-       ext4_inc_count(handle, dir);
-       ext4_update_dx_flag(dir);
--      ext4_mark_inode_dirty(handle, dir);
-+      err = ext4_mark_inode_dirty(handle, dir);
-+      if (err)
-+              goto out_clear_inode;
-       d_instantiate(dentry, inode);
-       unlock_new_inode(inode);
- out_stop:
-+      brelse(dir_block);
-       ext4_journal_stop(handle);
-       if (err == -ENOSPC && ext4_should_retry_alloc(dir->i_sb, &retries))
-               goto retry;
-
diff --git a/ldiskfs/kernel_patches/patches/rhel6.3/ext4-back-dquot-to.patch b/ldiskfs/kernel_patches/patches/rhel6.3/ext4-back-dquot-to.patch
deleted file mode 100644 (file)
index f69a7c8..0000000
+++ /dev/null
@@ -1,60 +0,0 @@
-Index: linux-stage/fs/ext4/super.c
-===================================================================
---- linux-stage.orig/fs/ext4/super.c
-+++ linux-stage/fs/ext4/super.c
-@@ -1117,9 +1117,53 @@ static ssize_t ext4_quota_read(struct su
- static ssize_t ext4_quota_write(struct super_block *sb, int type,
-                               const char *data, size_t len, loff_t off);
-+static int ext4_dquot_initialize(struct inode *inode, int type)
-+{
-+      handle_t *handle;
-+      int ret, err;
-+
-+      if (IS_NOQUOTA(inode))
-+              return 0;
-+
-+      /* We may create quota structure so we need to reserve enough blocks */
-+      handle = ext4_journal_start(inode, 2*EXT4_QUOTA_INIT_BLOCKS(inode->i_sb));
-+      if (IS_ERR(handle))
-+              return PTR_ERR(handle);
-+      ret = dquot_initialize(inode, type);
-+      err = ext4_journal_stop(handle);
-+      if (!ret)
-+              ret = err;
-+      return ret;
-+}
-+
-+static int ext4_dquot_drop(struct inode *inode)
-+{
-+      handle_t *handle;
-+      int ret, err;
-+
-+      if (IS_NOQUOTA(inode))
-+              return 0;
-+
-+      /* We may delete quota structure so we need to reserve enough blocks */
-+      handle = ext4_journal_start(inode, 2*EXT4_QUOTA_DEL_BLOCKS(inode->i_sb));
-+      if (IS_ERR(handle)) {
-+              /*
-+               * We call dquot_drop() anyway to at least release references
-+               * to quota structures so that umount does not hang.
-+               */
-+              dquot_drop(inode);
-+              return PTR_ERR(handle);
-+      }
-+      ret = dquot_drop(inode);
-+      err = ext4_journal_stop(handle);
-+      if (!ret)
-+              ret = err;
-+      return ret;
-+}
-+
- static const struct dquot_operations ext4_quota_operations = {
--      .initialize     = dquot_initialize,
--      .drop           = dquot_drop,
-+      .initialize     = ext4_dquot_initialize,
-+      .drop           = ext4_dquot_drop,
-       .alloc_space    = dquot_alloc_space,
-       .reserve_space  = dquot_reserve_space,
-       .claim_space    = dquot_claim_space,
diff --git a/ldiskfs/kernel_patches/patches/rhel6.3/ext4-data-in-dirent.patch b/ldiskfs/kernel_patches/patches/rhel6.3/ext4-data-in-dirent.patch
deleted file mode 100644 (file)
index f167c26..0000000
+++ /dev/null
@@ -1,575 +0,0 @@
-this patch implements feature which allows ext4 fs users (e.g. Lustre)
-to store data in ext4 dirent.
-data is stored in ext4 dirent after file-name, this space is accounted
-in de->rec_len. flag EXT4_DIRENT_LUFID added to d_type if extra data
-is present.
-
-make use of dentry->d_fsdata to pass fid to ext4. so no
-changes in ext4_add_entry() interface required.
-
-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)
- {
-+      int fl_index = filetype & EXT4_FT_MASK;
-+
-       if (!EXT4_HAS_INCOMPAT_FEATURE(sb, EXT4_FEATURE_INCOMPAT_FILETYPE) ||
--          (filetype >= EXT4_FT_MAX))
-+          (fl_index >= EXT4_FT_MAX))
-               return DT_UNKNOWN;
--      return (ext4_filetype_table[filetype]);
-+      if (!test_opt(sb, DIRDATA))
-+              return (ext4_filetype_table[fl_index]);
-+
-+      return (ext4_filetype_table[fl_index]) |
-+              (filetype & EXT4_DIRENT_LUFID);
-+
- }
- /**
-@@ -73,11 +80,11 @@ int ext4_check_dir_entry(const char *fun
-       const int rlen = ext4_rec_len_from_disk(de->rec_len,
-                                               dir->i_sb->s_blocksize);
--      if (unlikely(rlen < EXT4_DIR_REC_LEN(1)))
-+      if (unlikely(rlen < __EXT4_DIR_REC_LEN(1)))
-               error_msg = "rec_len is smaller than minimal";
-       else if (unlikely(rlen % 4 != 0))
-               error_msg = "rec_len % 4 != 0";
--      else if (unlikely(rlen < EXT4_DIR_REC_LEN(de->name_len)))
-+      else if (unlikely(rlen < EXT4_DIR_REC_LEN(de)))
-               error_msg = "rec_len is too small for name_len";
-       else if (unlikely(((char *) de - bh->b_data) + rlen > dir->i_sb->s_blocksize))
-               error_msg = "directory entry across blocks";
-@@ -181,7 +188,7 @@ revalidate:
-                                * failure will be detected in the
-                                * dirent test below. */
-                               if (ext4_rec_len_from_disk(de->rec_len,
--                                      sb->s_blocksize) < EXT4_DIR_REC_LEN(1))
-+                                      sb->s_blocksize) < __EXT4_DIR_REC_LEN(1))
-                                       break;
-                               i += ext4_rec_len_from_disk(de->rec_len,
-                                                           sb->s_blocksize);
-@@ -410,12 +417,17 @@ int ext4_htree_store_dirent(struct file
-       struct fname *fname, *new_fn;
-       struct dir_private_info *info;
-       int len;
-+      int extra_data = 0;
-       info = (struct dir_private_info *) dir_file->private_data;
-       p = &info->root.rb_node;
-       /* Create and allocate the fname structure */
--      len = sizeof(struct fname) + dirent->name_len + 1;
-+      if (dirent->file_type & EXT4_DIRENT_LUFID)
-+              extra_data = ext4_get_dirent_data_len(dirent);
-+
-+      len = sizeof(struct fname) + dirent->name_len + extra_data + 1;
-+
-       new_fn = kzalloc(len, GFP_KERNEL);
-       if (!new_fn)
-               return -ENOMEM;
-@@ -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;
--      memcpy(new_fn->name, dirent->name, dirent->name_len);
-+      memcpy(new_fn->name, dirent->name, dirent->name_len + extra_data);
-       new_fn->name[dirent->name_len] = 0;
-       while (*p) {
-Index: linux-2.6.32-504.3.3.el6.x86_64/fs/ext4/ext4.h
-===================================================================
---- 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_DIRDATA            0x00200 /* Data in directory entries*/
- #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 */
-@@ -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_INCOMPAT_DIRDATA         0x1000
- #define EXT4_FEATURE_COMPAT_SUPP      EXT2_FEATURE_COMPAT_EXT_ATTR
- #define EXT4_FEATURE_INCOMPAT_SUPP    (EXT4_FEATURE_INCOMPAT_FILETYPE| \
-@@ -1345,7 +1347,9 @@ EXT4_INODE_BIT_FNS(state, state_flags)
-                                        EXT4_FEATURE_INCOMPAT_EXTENTS| \
-                                        EXT4_FEATURE_INCOMPAT_64BIT| \
-                                        EXT4_FEATURE_INCOMPAT_FLEX_BG| \
--                                       EXT4_FEATURE_INCOMPAT_MMP)
-+                                       EXT4_FEATURE_INCOMPAT_MMP| \
-+                                       EXT4_FEATURE_INCOMPAT_DIRDATA)
-+
- #define EXT4_FEATURE_RO_COMPAT_SUPP   (EXT4_FEATURE_RO_COMPAT_SPARSE_SUPER| \
-                                        EXT4_FEATURE_RO_COMPAT_LARGE_FILE| \
-                                        EXT4_FEATURE_RO_COMPAT_GDT_CSUM| \
-@@ -1431,6 +1435,43 @@ struct ext4_dir_entry_2 {
- #define EXT4_FT_SYMLINK               7
- #define EXT4_FT_MAX           8
-+#define EXT4_FT_MASK          0xf
-+
-+#if EXT4_FT_MAX > EXT4_FT_MASK
-+#error "conflicting EXT4_FT_MAX and EXT4_FT_MASK"
-+#endif
-+
-+/*
-+ * d_type has 4 unused bits, so it can hold four types data. these different
-+ * type of data (e.g. lustre data, high 32 bits of 64-bit inode number) can be
-+ * stored, in flag order, after file-name in ext4 dirent.
-+*/
-+/*
-+ * this flag is added to d_type if ext4 dirent has extra data after
-+ * filename. this data length is variable and length is stored in first byte
-+ * of data. data start after filename NUL byte.
-+ * This is used by Lustre FS.
-+  */
-+#define EXT4_DIRENT_LUFID             0x10
-+
-+#define EXT4_LUFID_MAGIC    0xAD200907UL
-+struct ext4_dentry_param {
-+      __u32  edp_magic;       /* EXT4_LUFID_MAGIC */
-+      char   edp_len;         /* size of edp_data in bytes */
-+      char   edp_data[0];     /* packed array of data */
-+} __attribute__((packed));
-+
-+static inline unsigned char *ext4_dentry_get_data(struct super_block *sb,
-+              struct ext4_dentry_param* p)
-+
-+{
-+      if (!EXT4_HAS_INCOMPAT_FEATURE(sb, EXT4_FEATURE_INCOMPAT_DIRDATA))
-+              return NULL;
-+      if (p && p->edp_magic == EXT4_LUFID_MAGIC)
-+              return &p->edp_len;
-+      else
-+              return NULL;
-+}
- /*
-  * EXT4_DIR_PAD defines the directory entries boundaries
-@@ -1439,8 +1480,11 @@ struct ext4_dir_entry_2 {
-  */
- #define EXT4_DIR_PAD                  4
- #define EXT4_DIR_ROUND                        (EXT4_DIR_PAD - 1)
--#define EXT4_DIR_REC_LEN(name_len)    (((name_len) + 8 + EXT4_DIR_ROUND) & \
-+#define __EXT4_DIR_REC_LEN(name_len)  (((name_len) + 8 + EXT4_DIR_ROUND) & \
-                                        ~EXT4_DIR_ROUND)
-+#define EXT4_DIR_REC_LEN(de)          (__EXT4_DIR_REC_LEN(de->name_len +\
-+                                      ext4_get_dirent_data_len(de)))
-+
- #define EXT4_MAX_REC_LEN              ((1<<16)-1)
- static inline unsigned int
-@@ -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,
--                             struct inode *inode);
-+                             struct inode *inode, const void *, const void *);
- extern struct buffer_head *ext4_append(handle_t *handle,
-                                      struct inode *inode,
-                                      ext4_lblk_t *block, int *err);
-@@ -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);
-+/*
-+ * Compute the total directory entry data length.
-+ * This includes the filename and an implicit NUL terminator (always present),
-+ * and optional extensions.  Each extension has a bit set in the high 4 bits of
-+ * de->file_type, and the extension length is the first byte in each entry.
-+ */
-+static inline int ext4_get_dirent_data_len(struct ext4_dir_entry_2 *de)
-+{
-+      char *len = de->name + de->name_len + 1 /* NUL terminator */;
-+      int dlen = 0;
-+      __u8 extra_data_flags = (de->file_type & ~EXT4_FT_MASK) >> 4;
-+
-+      while (extra_data_flags) {
-+              if (extra_data_flags & 1) {
-+                      dlen += *len + (dlen == 0);
-+                      len += *len;
-+              }
-+              extra_data_flags >>= 1;
-+      }
-+      return dlen;
-+}
-+
- #endif        /* __KERNEL__ */
- #endif        /* _EXT4_H */
-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);
- static void dx_set_limit(struct dx_entry *entries, unsigned value);
--static unsigned dx_root_limit(struct inode *dir, unsigned infosize);
-+static inline unsigned dx_root_limit(__u32 blocksize,
-+              struct ext4_dir_entry_2 *dot_de, unsigned infosize);
- static unsigned dx_node_limit(struct inode *dir);
- static struct dx_frame *dx_probe(const struct qstr *d_name,
-                                struct inode *dir,
-@@ -212,11 +213,12 @@ ext4_next_entry(struct ext4_dir_entry_2
-  */
- struct dx_root_info * dx_get_dx_info(struct ext4_dir_entry_2 *de)
- {
--       /* get dotdot first */
--       de = (struct ext4_dir_entry_2 *)((char *)de + EXT4_DIR_REC_LEN(1));
-+      BUG_ON(de->name_len != 1);
-+      /* get dotdot first */
-+      de = (struct ext4_dir_entry_2 *)((char *)de + EXT4_DIR_REC_LEN(de));
--       /* dx root info is after dotdot entry */
--       de = (struct ext4_dir_entry_2 *)((char *)de + EXT4_DIR_REC_LEN(2));
-+      /* dx root info is after dotdot entry */
-+      de = (struct ext4_dir_entry_2 *)((char *)de + EXT4_DIR_REC_LEN(de));
-        return (struct dx_root_info *) de;
- }
-@@ -261,16 +263,23 @@ static inline void dx_set_limit(struct d
-       ((struct dx_countlimit *) entries)->limit = cpu_to_le16(value);
- }
--static inline unsigned dx_root_limit(struct inode *dir, unsigned infosize)
-+static inline unsigned dx_root_limit(__u32 blocksize,
-+              struct ext4_dir_entry_2 *dot_de, unsigned infosize)
- {
--      unsigned entry_space = dir->i_sb->s_blocksize - EXT4_DIR_REC_LEN(1) -
--              EXT4_DIR_REC_LEN(2) - infosize;
-+      struct ext4_dir_entry_2 *dotdot_de;
-+      unsigned entry_space;
-+
-+      BUG_ON(dot_de->name_len != 1);
-+      dotdot_de = ext4_next_entry(dot_de, blocksize);
-+      entry_space = blocksize - EXT4_DIR_REC_LEN(dot_de) -
-+                       EXT4_DIR_REC_LEN(dotdot_de) - infosize;
-+
-       return entry_space / sizeof(struct dx_entry);
- }
- static inline unsigned dx_node_limit(struct inode *dir)
- {
--      unsigned entry_space = dir->i_sb->s_blocksize - EXT4_DIR_REC_LEN(0);
-+      unsigned entry_space = dir->i_sb->s_blocksize - __EXT4_DIR_REC_LEN(0);
-       return entry_space / sizeof(struct dx_entry);
- }
-@@ -317,7 +326,7 @@ static struct stats dx_show_leaf(struct
-                               printk(":%x.%u ", h.hash,
-                                      ((char *) de - base));
-                       }
--                      space += EXT4_DIR_REC_LEN(de->name_len);
-+                      space += EXT4_DIR_REC_LEN(de);
-                       names++;
-               }
-               de = ext4_next_entry(de, size);
-@@ -419,7 +428,8 @@ dx_probe(const struct qstr *d_name, stru
-       entries = (struct dx_entry *) (((char *)info) + info->info_length);
--      if (dx_get_limit(entries) != dx_root_limit(dir,
-+      if (dx_get_limit(entries) != dx_root_limit(dir->i_sb->s_blocksize,
-+                                                 (struct ext4_dir_entry_2*)bh->b_data,
-                                                  info->info_length)) {
-               ext4_warning(dir->i_sb, "dx entry: limit != root limit");
-               brelse(bh);
-@@ -608,7 +618,7 @@ static int htree_dirblock_to_tree(struct
-       de = (struct ext4_dir_entry_2 *) bh->b_data;
-       top = (struct ext4_dir_entry_2 *) ((char *) de +
-                                          dir->i_sb->s_blocksize -
--                                         EXT4_DIR_REC_LEN(0));
-+                                         __EXT4_DIR_REC_LEN(0));
-       for (; de < top; de = ext4_next_entry(de, dir->i_sb->s_blocksize)) {
-               if (!ext4_check_dir_entry("htree_dirblock_to_tree", dir, de, bh,
-                                       (block<<EXT4_BLOCK_SIZE_BITS(dir->i_sb))
-@@ -1020,7 +1030,7 @@ static struct buffer_head * ext4_dx_find
-                       goto errout;
-               de = (struct ext4_dir_entry_2 *) bh->b_data;
-               top = (struct ext4_dir_entry_2 *) ((char *) de + sb->s_blocksize -
--                                     EXT4_DIR_REC_LEN(0));
-+                                     __EXT4_DIR_REC_LEN(0));
-               for (; de < top; de = ext4_next_entry(de, sb->s_blocksize)) {
-                       int off = (block << EXT4_BLOCK_SIZE_BITS(sb))
-                                 + ((char *) de - bh->b_data);
-@@ -1181,7 +1191,7 @@ dx_move_dirents(char *from, char *to, st
-       while (count--) {
-               struct ext4_dir_entry_2 *de = (struct ext4_dir_entry_2 *) 
-                                               (from + (map->offs<<2));
--              rec_len = EXT4_DIR_REC_LEN(de->name_len);
-+              rec_len = EXT4_DIR_REC_LEN(de);
-               memcpy (to, de, rec_len);
-               ((struct ext4_dir_entry_2 *) to)->rec_len =
-                               ext4_rec_len_to_disk(rec_len, blocksize);
-@@ -1205,7 +1215,7 @@ static struct ext4_dir_entry_2* dx_pack_
-       while ((char*)de < base + blocksize) {
-               next = ext4_next_entry(de, blocksize);
-               if (de->inode && de->name_len) {
--                      rec_len = EXT4_DIR_REC_LEN(de->name_len);
-+                      rec_len = EXT4_DIR_REC_LEN(de);
-                       if (de > to)
-                               memmove(to, de, rec_len);
-                       to->rec_len = ext4_rec_len_to_disk(rec_len, blocksize);
-@@ -1334,11 +1344,28 @@ static int add_dirent_to_buf(handle_t *h
-       int             namelen = dentry->d_name.len;
-       unsigned int    offset = 0;
-       unsigned int    blocksize = dir->i_sb->s_blocksize;
--      unsigned short  reclen;
--      int             nlen, rlen, err;
-+      unsigned short  reclen, dotdot_reclen = 0;
-+      int             nlen, rlen, err, dlen = 0;
-+      bool            is_dotdot = false, write_short_dotdot = false;
-+      unsigned char   *data;
-       char            *top;
--      reclen = EXT4_DIR_REC_LEN(namelen);
-+      data = ext4_dentry_get_data(inode->i_sb, (struct ext4_dentry_param *)
-+                                              dentry->d_fsdata);
-+      if (data)
-+              dlen = (*data) + 1;
-+
-+      is_dotdot = (namelen == 2 &&
-+                   memcmp(dentry->d_name.name, "..", 2) == 0);
-+
-+      /* dotdot entries must be in the second place in a directory block,
-+       * so calculate an alternate length without the FID so they can
-+       * always be made to fit in the existing slot - LU-5626 */
-+      if (is_dotdot)
-+              dotdot_reclen = __EXT4_DIR_REC_LEN(namelen);
-+
-+      reclen = __EXT4_DIR_REC_LEN(namelen + dlen);
-+
-       if (!de) {
-               de = (struct ext4_dir_entry_2 *)bh->b_data;
-               top = bh->b_data + blocksize - reclen;
-@@ -1348,10 +1375,25 @@ static int add_dirent_to_buf(handle_t *h
-                               return -EIO;
-                       if (ext4_match(namelen, name, de))
-                               return -EEXIST;
--                      nlen = EXT4_DIR_REC_LEN(de->name_len);
-+                      nlen = EXT4_DIR_REC_LEN(de);
-                       rlen = ext4_rec_len_from_disk(de->rec_len, blocksize);
--                      if ((de->inode? rlen - nlen: rlen) >= reclen)
-+                      /* Check first for enough space for the full entry */
-+                      if ((de->inode ? rlen - nlen : rlen) >= reclen)
-                               break;
-+                      /* Then for dotdot entries, check for the smaller space
-+                       * required for just the entry, no FID */
-+                      if (is_dotdot) {
-+                              if ((de->inode ? rlen - nlen : rlen) >=
-+                                  dotdot_reclen) {
-+                                      write_short_dotdot = true;
-+                                      break;
-+                              }
-+                              /* The new ".." entry mut be written over the
-+                               * previous ".." entry, which is the first
-+                               * entry traversed by this scan.  If it doesn't
-+                               * fit, something is badly wrong, so -EIO. */
-+                              return -EIO;
-+                      }
-                       de = (struct ext4_dir_entry_2 *)((char *)de + rlen);
-                       offset += rlen;
-               }
-@@ -1366,7 +1408,7 @@ static int add_dirent_to_buf(handle_t *h
-       }
-       /* By now the buffer is marked for journaling */
--      nlen = EXT4_DIR_REC_LEN(de->name_len);
-+      nlen = EXT4_DIR_REC_LEN(de);
-       rlen = ext4_rec_len_from_disk(de->rec_len, blocksize);
-       if (de->inode) {
-               struct ext4_dir_entry_2 *de1 = (struct ext4_dir_entry_2 *)((char *)de + nlen);
-@@ -1382,6 +1424,13 @@ static int add_dirent_to_buf(handle_t *h
-               de->inode = 0;
-       de->name_len = namelen;
-       memcpy(de->name, name, namelen);
-+      /* If we're writing the short form of "dotdot", don't add the data section */
-+      if (data && !write_short_dotdot) {
-+              de->name[namelen] = 0;
-+              memcpy(&de->name[namelen + 1], data, *(char *) data);
-+              de->file_type |= EXT4_DIRENT_LUFID;
-+      }
-+
-       /*
-        * XXX shouldn't update any times until successful
-        * completion of syscall, but too many callers depend
-@@ -1480,7 +1529,8 @@ static int make_indexed_dir(handle_t *ha
-       dx_set_block(entries, 1);
-       dx_set_count(entries, 1);
--      dx_set_limit(entries, dx_root_limit(dir, sizeof(*dx_info)));
-+      dx_set_limit(entries, dx_root_limit(dir->i_sb->s_blocksize,
-+                                       dot_de, sizeof(*dx_info)));
-       /* Initialize as for dx_probe */
-       hinfo.hash_version = dx_info->hash_version;
-@@ -1523,6 +1573,8 @@ static int ext4_update_dotdot(handle_t *
-       struct buffer_head * dir_block;
-       struct ext4_dir_entry_2 * de;
-       int len, journal = 0, err = 0;
-+      int dlen = 0;
-+      char *data;
-       if (IS_ERR(handle))
-               return PTR_ERR(handle);
-@@ -1538,19 +1590,24 @@ static int ext4_update_dotdot(handle_t *
-       /* the first item must be "." */
-       assert(de->name_len == 1 && de->name[0] == '.');
-       len = le16_to_cpu(de->rec_len);
--      assert(len >= EXT4_DIR_REC_LEN(1));
--      if (len > EXT4_DIR_REC_LEN(1)) {
-+      assert(len >= __EXT4_DIR_REC_LEN(1));
-+      if (len > __EXT4_DIR_REC_LEN(1)) {
-               BUFFER_TRACE(dir_block, "get_write_access");
-               err = ext4_journal_get_write_access(handle, dir_block);
-               if (err)
-                       goto out_journal;
-               journal = 1;
--              de->rec_len = cpu_to_le16(EXT4_DIR_REC_LEN(1));
-+              de->rec_len = cpu_to_le16(EXT4_DIR_REC_LEN(de));
-       }
--      len -= EXT4_DIR_REC_LEN(1);
--      assert(len == 0 || len >= EXT4_DIR_REC_LEN(2));
-+      len -= EXT4_DIR_REC_LEN(de);
-+      data = ext4_dentry_get_data(dir->i_sb,
-+                      (struct ext4_dentry_param *) dentry->d_fsdata);
-+      if (data)
-+              dlen = *data + 1;
-+      assert(len == 0 || len >= __EXT4_DIR_REC_LEN(2 + dlen));
-+
-       de = (struct ext4_dir_entry_2 *)
-                       ((char *) de + le16_to_cpu(de->rec_len));
-       if (!journal) {
-@@ -1564,10 +1621,15 @@ static int ext4_update_dotdot(handle_t *
-       if (len > 0)
-               de->rec_len = cpu_to_le16(len);
-       else
--              assert(le16_to_cpu(de->rec_len) >= EXT4_DIR_REC_LEN(2));
-+              assert(le16_to_cpu(de->rec_len) >= __EXT4_DIR_REC_LEN(2));
-       de->name_len = 2;
-       strcpy (de->name, "..");
--      ext4_set_de_type(dir->i_sb, de, S_IFDIR);
-+      if (data != NULL && ext4_get_dirent_data_len(de) >= dlen) {
-+              de->name[2] = 0;
-+              memcpy(&de->name[2 + 1], data, *data);
-+              ext4_set_de_type(dir->i_sb, de, S_IFDIR);
-+              de->file_type |= EXT4_DIRENT_LUFID;
-+      }
- out_journal:
-       if (journal) {
-@@ -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,
--                      struct inode *inode)
-+                      struct inode *inode,
-+                        const void *data1, const void *data2)
- {
-       struct buffer_head * dir_block;
-       struct ext4_dir_entry_2 * de;
-       unsigned int blocksize = dir->i_sb->s_blocksize;
--      int err = 0;
-+      int err = 0, dot_reclen;
-       if (IS_ERR(handle))
-               return PTR_ERR(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;
--      de->rec_len = ext4_rec_len_to_disk(EXT4_DIR_REC_LEN(de->name_len),
--                                         blocksize);
-       strcpy(de->name, ".");
-       ext4_set_de_type(dir->i_sb, de, S_IFDIR);
-+      /* get packed fid data*/
-+      data1 = ext4_dentry_get_data(dir->i_sb,
-+                              (struct ext4_dentry_param *) data1);
-+      if (data1) {
-+              de->name[1] = 0;
-+              memcpy(&de->name[2], data1, *(char *) data1);
-+              de->file_type |= EXT4_DIRENT_LUFID;
-+      }
-+      de->rec_len = cpu_to_le16(EXT4_DIR_REC_LEN(de));
-+      dot_reclen = cpu_to_le16(de->rec_len);
-       de = ext4_next_entry(de, blocksize);
-       de->inode = cpu_to_le32(dir->i_ino);
--      de->rec_len = ext4_rec_len_to_disk(blocksize - EXT4_DIR_REC_LEN(1),
-+      de->rec_len = ext4_rec_len_to_disk(blocksize - dot_reclen,
-                                          blocksize);
-       de->name_len = 2;
-       strcpy(de->name, "..");
-       ext4_set_de_type(dir->i_sb, de, S_IFDIR);
-+      data2 = ext4_dentry_get_data(dir->i_sb,
-+                      (struct ext4_dentry_param *) data2);
-+      if (data2) {
-+              de->name[2] = 0;
-+              memcpy(&de->name[3], data2, *(char *) data2);
-+              de->file_type |= EXT4_DIRENT_LUFID;
-+      }
-       inode->i_nlink = 2;
-       BUFFER_TRACE(dir_block, "call ext4_handle_dirty_metadata");
-       err = ext4_handle_dirty_metadata(handle, inode, dir_block);
-@@ -2068,7 +2146,7 @@ retry:
-       if (IS_ERR(inode))
-               goto out_stop;
--      err = ext4_add_dot_dotdot(handle, dir, inode);
-+      err = ext4_add_dot_dotdot(handle, dir, inode, NULL, NULL);
-       if (err)
-               goto out_clear_inode;
-@@ -2107,7 +2185,7 @@ static int empty_dir(struct inode *inode
-       int err = 0;
-       sb = inode->i_sb;
--      if (inode->i_size < EXT4_DIR_REC_LEN(1) + EXT4_DIR_REC_LEN(2) ||
-+      if (inode->i_size < __EXT4_DIR_REC_LEN(1) + __EXT4_DIR_REC_LEN(2) ||
-           !(bh = ext4_bread(NULL, inode, 0, 0, &err))) {
-               if (err)
-                       ext4_error(inode->i_sb,
-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"},
-@@ -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:
diff --git a/ldiskfs/kernel_patches/patches/rhel6.3/ext4-disable-mb-cache.patch b/ldiskfs/kernel_patches/patches/rhel6.3/ext4-disable-mb-cache.patch
deleted file mode 100644 (file)
index b38db4f..0000000
+++ /dev/null
@@ -1,154 +0,0 @@
-Index: linux-2.6.32-504.3.3.el6.x86_64/fs/ext4/ext4.h
-===================================================================
---- 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_OLDALLOC           0x00002  /* Don't use the new Orlov allocator */
-+#define EXT4_MOUNT_NO_MBCACHE         0x00001 /* Disable mbcache */
-+#define EXT4_MOUNT_OLDALLOC           0x00002 /* Don't use the new Orlov allocator */
- #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-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
-@@ -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_no_mbcache,
-       Opt_discard, Opt_nodiscard, Opt_init_itable, Opt_noinit_itable,
- };
-@@ -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_discard, "discard"},
-       {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);
-+                      break;
-               default:
-                       ext4_msg(sb, KERN_ERR,
-                              "Unrecognized mount option \"%s\" "
-Index: linux-2.6.32-504.3.3.el6.x86_64/fs/ext4/xattr.c
-===================================================================
---- 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 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 **);
-@@ -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,
-                                     inode);
-@@ -492,7 +493,7 @@ ext4_xattr_block_list(struct inode *inod
-               error = -EIO;
-               goto cleanup;
-       }
--      ext4_xattr_cache_insert(bh);
-+      ext4_xattr_cache_insert(inode->i_sb, bh);
-       error = ext4_xattr_list_entries(inode, BFIRST(bh), buffer, buffer_size);
- cleanup:
-@@ -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,
-+                                      bh->b_blocknr);
-       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))
-       if (s->base) {
--              ce = mb_cache_entry_get(ext4_xattr_cache, bs->bh->b_bdev,
--                                      bs->bh->b_blocknr);
-+              if (!test_opt(inode->i_sb, NO_MBCACHE))
-+                      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
-                               if (!IS_LAST_ENTRY(s->first))
-                                       ext4_xattr_rehash(header(s->base),
-                                                         s->here);
--                              ext4_xattr_cache_insert(bs->bh);
-+                              ext4_xattr_cache_insert(sb, bs->bh);
-                       }
-                       unlock_buffer(bs->bh);
-                       if (error == -EIO)
-@@ -1089,7 +1094,8 @@ inserted:
-                               if (error)
-                                       goto cleanup_dquot;
-                       }
--                      mb_cache_entry_release(ce);
-+                      if (ce)
-+                              mb_cache_entry_release(ce);
-                       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:
-                       memcpy(new_bh->b_data, s->base, new_bh->b_size);
-                       set_buffer_uptodate(new_bh);
-                       unlock_buffer(new_bh);
--                      ext4_xattr_cache_insert(new_bh);
-+                      ext4_xattr_cache_insert(sb, new_bh);
-                       error = ext4_handle_dirty_metadata(handle,
-                                                          inode, new_bh);
-                       if (error)
-@@ -1857,12 +1863,15 @@ ext4_xattr_put_super(struct super_block
-  * Returns 0, or a negative error number on failure.
-  */
- static void
--ext4_xattr_cache_insert(struct buffer_head *bh)
-+ext4_xattr_cache_insert(struct super_block *sb, struct buffer_head *bh)
- {
-       __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");
-@@ -1935,6 +1944,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)
-               return NULL;  /* never share */
-       ea_idebug(inode, "looking for cached blocks [%x]", (int)hash);
diff --git a/ldiskfs/kernel_patches/patches/rhel6.3/ext4-dont-check-before-replay.patch b/ldiskfs/kernel_patches/patches/rhel6.3/ext4-dont-check-before-replay.patch
deleted file mode 100644 (file)
index 57bf9fe..0000000
+++ /dev/null
@@ -1,31 +0,0 @@
-Index: linux-stage/fs/ext4/super.c
-When ldiskfs run in failover mode whith read-only disk.
-Part of allocation updates are lost and ldiskfs may fail
-while mounting this is due to inconsistent state of
-group-descriptor. Group-descriptor check is added after
-journal replay.
-===================================================================
---- linux-stage/fs/ext4/super.c        2016-11-24 20:50:46.736527130 +0530
-+++ linux-stage.orig/fs/ext4/super.c   2016-11-24 20:54:14.941779453 +0530
-@@ -3429,10 +3429,6 @@
-                       goto failed_mount2;
-               }
-       }
--      if (!ext4_check_descriptors(sb, &first_not_zeroed)) {
--              ext4_msg(sb, KERN_ERR, "group descriptors corrupted!");
--              goto failed_mount2;
--      }
-       if (EXT4_HAS_INCOMPAT_FEATURE(sb, EXT4_FEATURE_INCOMPAT_FLEX_BG))
-               if (!ext4_fill_flex_info(sb)) {
-                       ext4_msg(sb, KERN_ERR,
-@@ -3609,6 +3605,10 @@
-       sbi->s_journal->j_commit_callback = ext4_journal_commit_callback;
-
- no_journal:
-+      if (!ext4_check_descriptors(sb, &first_not_zeroed)) {
-+              ext4_msg(sb, KERN_ERR, "group descriptors corrupted!");
-+              goto failed_mount_wq;
-+      }
-       if (test_opt(sb, NOBH)) {
-               if (!(test_opt(sb, DATA_FLAGS) == EXT4_MOUNT_WRITEBACK_DATA)) {
-                       ext4_msg(sb, KERN_WARNING, "Ignoring nobh option - "
diff --git a/ldiskfs/kernel_patches/patches/rhel6.3/ext4-drop-inode-from-orphan-list-if-ext4_delete_inode-fails.patch b/ldiskfs/kernel_patches/patches/rhel6.3/ext4-drop-inode-from-orphan-list-if-ext4_delete_inode-fails.patch
deleted file mode 100644 (file)
index 54fde81..0000000
+++ /dev/null
@@ -1,22 +0,0 @@
-commit 4538821993f4486c76090dfb377c60c0a0e71ba3
-Author: Theodore Ts'o <tytso@mit.edu>
-Date:   Thu Jul 29 15:06:10 2010 -0400
-
-    ext4: drop inode from orphan list if ext4_delete_inode() fails
-    
-    There were some error paths in ext4_delete_inode() which was not
-    dropping the inode from the orphan list.  This could lead to a BUG_ON
-    on umount when the orphan list is discovered to be non-empty.
-    
-Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
-Signed-off-by: Wang Shilong <wshilong@ddn.com>
---- linux-stage.orig/fs/ext4/inode.c   2014-10-20 20:13:39.689001531 +0800
-+++ linux-stage/fs/ext4/inode.c        2014-10-20 20:12:14.224997168 +0800
-@@ -279,6 +279,7 @@
-                                    "couldn't extend journal (err %d)", err);
-               stop_handle:
-                       ext4_journal_stop(handle);
-+                      ext4_orphan_del(NULL, inode);
-                       sb_end_intwrite(inode->i_sb);
-                       goto no_delete;
-               }
diff --git a/ldiskfs/kernel_patches/patches/rhel6.3/ext4-fix-ext4_mb_add_n_trim.patch b/ldiskfs/kernel_patches/patches/rhel6.3/ext4-fix-ext4_mb_add_n_trim.patch
deleted file mode 100644 (file)
index a394e18..0000000
+++ /dev/null
@@ -1,22 +0,0 @@
-Index: linux-stage/fs/ext4/mballoc.c
-===================================================================
---- linux-stage.orig/fs/ext4/mballoc.c
-+++ linux-stage/fs/ext4/mballoc.c
-@@ -4352,7 +4352,7 @@ static void ext4_mb_add_n_trim(struct ex
-               /* The max size of hash table is PREALLOC_TB_SIZE */
-               order = PREALLOC_TB_SIZE - 1;
-       /* Add the prealloc space to lg */
--      rcu_read_lock();
-+      spin_lock(&lg->lg_prealloc_lock);
-       list_for_each_entry_rcu(tmp_pa, &lg->lg_prealloc_list[order],
-                                               pa_inode_list) {
-               spin_lock(&tmp_pa->pa_lock);
-@@ -4376,7 +4376,7 @@ static void ext4_mb_add_n_trim(struct ex
-       if (!added)
-               list_add_tail_rcu(&pa->pa_inode_list,
-                                       &lg->lg_prealloc_list[order]);
--      rcu_read_unlock();
-+      spin_unlock(&lg->lg_prealloc_lock);
-
-       /* Now trim the list to be not more than 8 elements */
-       if (lg_prealloc_count > 8) {
diff --git a/ldiskfs/kernel_patches/patches/rhel6.3/ext4-fix-mbgroups-access.patch b/ldiskfs/kernel_patches/patches/rhel6.3/ext4-fix-mbgroups-access.patch
deleted file mode 100644 (file)
index e6fc5e2..0000000
+++ /dev/null
@@ -1,34 +0,0 @@
-Index: linux-stage/fs/ext4/mballoc.c
-===================================================================
---- linux-stage.orig/fs/ext4/mballoc.c 2012-11-21 11:22:19.000000000 +0200
-+++ linux-stage/fs/ext4/mballoc.c      2012-11-21 11:24:33.000000000 +0200
-@@ -2622,6 +2622,9 @@ int ext4_mb_release(struct super_block *
-       struct ext4_group_info *grinfo;
-       struct ext4_sb_info *sbi = EXT4_SB(sb);
-+      if (sbi->s_proc)
-+              remove_proc_entry("mb_groups", sbi->s_proc);
-+
-       if (sbi->s_group_info) {
-               for (i = 0; i < ngroups; i++) {
-                       grinfo = ext4_get_group_info(sb, i);
-@@ -2673,7 +2676,6 @@ int ext4_mb_release(struct super_block *
-       free_percpu(sbi->s_locality_groups);
-       if (sbi->s_proc) {
--              remove_proc_entry("mb_groups", sbi->s_proc);
-               remove_proc_entry(EXT4_MB_PREALLOC_TABLE, sbi->s_proc);
-       }
-@@ -4801,6 +4803,11 @@ do_more:
-                * be used until this transaction is committed
-                */
-               new_entry = kmem_cache_alloc(ext4_free_data_cachep, GFP_NOFS);
-+              if (!new_entry) {
-+                      ext4_mb_release_desc(&e4b);
-+                      err = -ENOMEM;
-+                      goto error_return;
-+              }
-               new_entry->efd_start_blk = bit;
-               new_entry->efd_group  = block_group;
-               new_entry->efd_count = count;
diff --git a/ldiskfs/kernel_patches/patches/rhel6.3/ext4-inode_info_reorganize.patch b/ldiskfs/kernel_patches/patches/rhel6.3/ext4-inode_info_reorganize.patch
deleted file mode 100644 (file)
index f72ea92..0000000
+++ /dev/null
@@ -1,59 +0,0 @@
-Index: linux-stage/fs/ext4/ext4.h
-===================================================================
---- linux-stage.orig/fs/ext4/ext4.h    2012-08-07 14:16:06.331203480 -0700
-+++ linux-stage/fs/ext4/ext4.h 2012-08-10 10:08:47.854206335 -0700
-@@ -713,6 +713,7 @@
-       /* following fields for parallel directory operations -bzzz */
-       struct semaphore i_append_sem;
-+      ext4_lblk_t             i_dir_start_lookup;
-       /*
-        * i_block_group is the number of the block group which contains
-        * this file's inode.  Constant across the lifetime of the inode,
-@@ -724,7 +725,6 @@
-       unsigned long   i_state_flags;          /* Dynamic state flags */
-       unsigned long   i_flags;
--      ext4_lblk_t             i_dir_start_lookup;
- #ifdef CONFIG_EXT4_FS_XATTR
-       /*
-        * Extended attributes can be read independently of the main file
-@@ -788,10 +788,12 @@
-       unsigned int i_reserved_data_blocks;
-       unsigned int i_reserved_meta_blocks;
-       unsigned int i_allocated_meta_blocks;
--      unsigned short i_delalloc_reserved_flag;
-       sector_t i_da_metadata_calc_last_lblock;
-       int i_da_metadata_calc_len;
-+      /* allocation reservation info for delalloc */
-+      unsigned short i_delalloc_reserved_flag;
-+
-       /* on-disk additional length */
-       __u16 i_extra_isize;
-@@ -807,16 +809,22 @@
-       /* current io_end structure for async DIO write*/
-       ext4_io_end_t *cur_aio_dio;
-       atomic_t i_aiodio_unwritten; /* Number of inflight conversions pending */
--      struct mutex i_aio_mutex; /* big hammer for unaligned AIO */
-       /*
-        * Transactions that contain inode's metadata needed to complete
-        * fsync and fdatasync, respectively.
-        */
-+
-       tid_t i_sync_tid;
--      tid_t i_datasync_tid;
-+
-+      struct mutex i_aio_mutex; /* big hammer for unaligned AIO */
-       __u64 i_fs_version;
-+      /*
-+       * Transactions that contain inode's metadata needed to complete
-+       * fsync and fdatasync, respectively.
-+       */
-+      tid_t i_datasync_tid;
- };
- #define HAVE_DISK_INODE_VERSION
diff --git a/ldiskfs/kernel_patches/patches/rhel6.3/ext4-introduce-ext4_kvmalloc-ext4_kzalloc-and-ext4_kvfree.patch b/ldiskfs/kernel_patches/patches/rhel6.3/ext4-introduce-ext4_kvmalloc-ext4_kzalloc-and-ext4_kvfree.patch
deleted file mode 100644 (file)
index 6bea919..0000000
+++ /dev/null
@@ -1,115 +0,0 @@
-From 9933fc0ac1ac14b795819cd63d05ea92112f690a Mon Sep 17 00:00:00 2001
-From: Theodore Ts'o <tytso@mit.edu>
-Date: Mon, 1 Aug 2011 08:45:02 -0400
-Subject: ext4: introduce ext4_kvmalloc(), ext4_kzalloc(), and ext4_kvfree()
-Git-commit: 9933fc0a
-Patch-mainline: v3.1-rc1
-
-Introduce new helper functions which try kmalloc, and then fall back
-to vmalloc if necessary, and use them for allocating and deallocating
-s_flex_groups.
-
-Upstream-Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
-Signed-off-by: Jeff Mahoney <jeffm@suse.com>
----
- fs/ext4/ext4.h  |    3 +++
- fs/ext4/super.c |   54 ++++++++++++++++++++++++++++++++++++------------------
- 2 files changed, 39 insertions(+), 18 deletions(-)
-
---- a/fs/ext4/ext4.h
-+++ b/fs/ext4/ext4.h
-@@ -1686,6 +1686,9 @@ extern int ext4_group_extend(struct supe
-                               ext4_fsblk_t n_blocks_count);
-
- /* super.c */
-+extern void *ext4_kvmalloc(size_t size, gfp_t flags);
-+extern void *ext4_kvzalloc(size_t size, gfp_t flags);
-+extern void ext4_kvfree(void *ptr);
- extern void __ext4_error(struct super_block *, const char *, const char *, ...)
-       __attribute__ ((format (printf, 3, 4)));
- #define ext4_error(sb, message...)    __ext4_error(sb, __func__, ## message)
---- a/fs/ext4/super.c
-+++ b/fs/ext4/super.c
-@@ -80,6 +80,35 @@ static void ext4_clear_request_list(void
-
- wait_queue_head_t aio_wq[WQ_HASH_SZ];
-
-+void *ext4_kvmalloc(size_t size, gfp_t flags)
-+{
-+      void *ret;
-+
-+      ret = kmalloc(size, flags | __GFP_NOWARN);
-+      if (!ret)
-+              ret = __vmalloc(size, flags, PAGE_KERNEL);
-+      return ret;
-+}
-+
-+void *ext4_kvzalloc(size_t size, gfp_t flags)
-+{
-+      void *ret;
-+
-+      ret = kzalloc(size, flags | __GFP_NOWARN);
-+      if (!ret)
-+              ret = __vmalloc(size, flags | __GFP_ZERO, PAGE_KERNEL);
-+      return ret;
-+}
-+
-+void ext4_kvfree(void *ptr)
-+{
-+      if (is_vmalloc_addr(ptr))
-+              vfree(ptr);
-+      else
-+              kfree(ptr);
-+
-+}
-+
- ext4_fsblk_t ext4_block_bitmap(struct super_block *sb,
-                              struct ext4_group_desc *bg)
- {
-@@ -677,10 +706,7 @@ static void ext4_put_super(struct super_
-       for (i = 0; i < sbi->s_gdb_count; i++)
-               brelse(sbi->s_group_desc[i]);
-       kfree(sbi->s_group_desc);
--      if (is_vmalloc_addr(sbi->s_flex_groups))
--              vfree(sbi->s_flex_groups);
--      else
--              kfree(sbi->s_flex_groups);
-+      ext4_kvfree(sbi->s_flex_groups);
-       percpu_counter_destroy(&sbi->s_freeblocks_counter);
-       percpu_counter_destroy(&sbi->s_freeinodes_counter);
-       percpu_counter_destroy(&sbi->s_dirs_counter);
-@@ -1815,15 +1841,11 @@ static int ext4_fill_flex_info(struct su
-                       ((le16_to_cpu(sbi->s_es->s_reserved_gdt_blocks) + 1) <<
-                             EXT4_DESC_PER_BLOCK_BITS(sb))) / groups_per_flex;
-       size = flex_group_count * sizeof(struct flex_groups);
--      sbi->s_flex_groups = kzalloc(size, GFP_KERNEL);
-+      sbi->s_flex_groups = ext4_kvzalloc(size, GFP_KERNEL);
-       if (sbi->s_flex_groups == NULL) {
--              sbi->s_flex_groups = vzalloc(size);
--              if (sbi->s_flex_groups == NULL) {
--                      ext4_msg(sb, KERN_ERR,
--                               "not enough memory for %u flex groups",
--                               flex_group_count);
--                      goto failed;
--              }
-+              ext4_msg(sb, KERN_ERR, "not enough memory for %u flex groups",
-+                       flex_group_count);
-+              goto failed;
-       }
-
-       for (i = 0; i < sbi->s_groups_count; i++) {
-@@ -3464,12 +3486,8 @@ failed_mount_wq:
-               sbi->s_journal = NULL;
-       }
- failed_mount3:
--      if (sbi->s_flex_groups) {
--              if (is_vmalloc_addr(sbi->s_flex_groups))
--                      vfree(sbi->s_flex_groups);
--              else
--                      kfree(sbi->s_flex_groups);
--      }
-+      if (sbi->s_flex_groups)
-+              ext4_kvfree(sbi->s_flex_groups);
-       percpu_counter_destroy(&sbi->s_freeblocks_counter);
-       percpu_counter_destroy(&sbi->s_freeinodes_counter);
-       percpu_counter_destroy(&sbi->s_dirs_counter);
diff --git a/ldiskfs/kernel_patches/patches/rhel6.3/ext4-journal-callback.patch b/ldiskfs/kernel_patches/patches/rhel6.3/ext4-journal-callback.patch
deleted file mode 100644 (file)
index 9255ebf..0000000
+++ /dev/null
@@ -1,477 +0,0 @@
-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-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))
-+/**
-+ *   struct ext4_journal_cb_entry - Base structure for callback information.
-+ *
-+ *   This struct is a 'seed' structure for a using with your own callback
-+ *   structs. If you are using callbacks you must allocate one of these
-+ *   or another struct of your own definition which has this struct
-+ *   as it's first element and pass it to ext4_journal_callback_add().
-+ */
-+struct ext4_journal_cb_entry {
-+      /* list information for other callbacks attached to the same handle */
-+      struct list_head jce_list;
-+
-+      /*  Function to call with this callback structure */
-+      void (*jce_func)(struct super_block *sb,
-+                       struct ext4_journal_cb_entry *jce, int error);
-+
-+      /* user data goes here */
-+};
-+
-+/**
-+ * ext4_journal_callback_add: add a function to call after transaction commit
-+ * @handle: active journal transaction handle to register callback on
-+ * @func: callback function to call after the transaction has committed:
-+ *        @sb: superblock of current filesystem for transaction
-+ *        @jce: returned journal callback data
-+ *        @rc: journal state at commit (0 = transaction committed properly)
-+ * @jce: journal callback data (internal and function private data struct)
-+ *
-+ * The registered function will be called in the context of the journal thread
-+ * after the transaction for which the handle was created has completed.
-+ *
-+ * No locks are held when the callback function is called, so it is safe to
-+ * call blocking functions from within the callback, but the callback should
-+ * not block or run for too long, or the filesystem will be blocked waiting for
-+ * the next transaction to commit. No journaling functions can be used, or
-+ * there is a risk of deadlock.
-+ *
-+ * There is no guaranteed calling order of multiple registered callbacks on
-+ * the same transaction.
-+ */
-+static inline void ext4_journal_callback_add(handle_t *handle,
-+                      void (*func)(struct super_block *sb,
-+                                   struct ext4_journal_cb_entry *jce,
-+                                   int rc),
-+                      struct ext4_journal_cb_entry *jce)
-+{
-+      struct ext4_sb_info *sbi =
-+                      EXT4_SB(handle->h_transaction->t_journal->j_private);
-+
-+      /* Add the jce to transaction's private list */
-+      jce->jce_func = func;
-+      spin_lock(&sbi->s_md_lock);
-+      list_add(&jce->jce_list, &handle->h_transaction->t_private_list);
-+      spin_unlock(&sbi->s_md_lock);
-+}
-+
-+/**
-+ * ext4_journal_callback_del: delete a registered callback
-+ * @handle: active journal transaction handle on which callback was registered
-+ * @jce: registered journal callback entry to unregister
-+ */
-+static inline void ext4_journal_callback_del(handle_t *handle,
-+                                           struct ext4_journal_cb_entry *jce)
-+{
-+      struct ext4_sb_info *sbi =
-+                      EXT4_SB(handle->h_transaction->t_journal->j_private);
-+
-+      spin_lock(&sbi->s_md_lock);
-+      list_del_init(&jce->jce_list);
-+      spin_unlock(&sbi->s_md_lock);
-+}
-+
-+#define HAVE_EXT4_JOURNAL_CALLBACK_ADD
-+
- int
- ext4_mark_iloc_dirty(handle_t *handle,
-                    struct inode *inode,
-Index: linux-2.6.32-504.3.3.el6.x86_64/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_free_data {
--      /* this links the free block information from group_info */
--      struct rb_node node;
-+      /* MUST be the first member */
-+      struct ext4_journal_cb_entry    efd_jce;
--      /* this links the free block information from ext4_sb_info */
--      struct list_head list;
-+      /* ext4_free_data private data starts from here */
-+
-+      /* this links the free block information from group_info */
-+      struct rb_node          efd_node;
-       /* group which free block extent belongs */
--      ext4_group_t group;
-+      ext4_group_t            efd_group;
-       /* free block extent */
--      ext4_grpblk_t start_blk;
--      ext4_grpblk_t count;
-+      ext4_grpblk_t           efd_start_blk;
-+      ext4_grpblk_t           efd_count;
-       /* transaction which freed this extent */
--      tid_t   t_tid;
-+      tid_t                   efd_tid;
- };
- struct ext4_prealloc_space {
-Index: linux-2.6.32-504.3.3.el6.x86_64/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
-  */
-+#include "ext4_jbd2.h"
- #include "mballoc.h"
- #include <linux/debugfs.h>
- #include <trace/events/ext4.h>
-@@ -336,12 +337,12 @@
-  */
- static struct kmem_cache *ext4_pspace_cachep;
- static struct kmem_cache *ext4_ac_cachep;
--static struct kmem_cache *ext4_free_ext_cachep;
-+static struct kmem_cache *ext4_free_data_cachep;
- static int ext4_mb_generate_from_pa(struct super_block *sb, void *bitmap,
-                                       ext4_group_t group);
- static void ext4_mb_generate_from_freelist(struct super_block *sb, void *bitmap,
-                                               ext4_group_t group);
--static void release_blocks_on_commit(journal_t *journal, transaction_t *txn);
-+static void ext4_free_data_callback(struct super_block *sb, struct ext4_journal_cb_entry *jce, int error);
- static inline void *mb_correct_addr_and_bit(int *bit, void *addr)
- {
-@@ -2581,8 +2582,6 @@ int ext4_mb_init(struct super_block *sb,
-               }
-       }
--      if (sbi->s_journal)
--              sbi->s_journal->j_commit_callback = release_blocks_on_commit;
-       return 0;
- }
-@@ -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.
-  */
--static void release_blocks_on_commit(journal_t *journal, transaction_t *txn)
-+static void ext4_free_data_callback(struct super_block *sb,
-+                                  struct ext4_journal_cb_entry *jce,
-+                                  int rc)
- {
--      struct super_block *sb = journal->j_private;
-+      struct ext4_free_data *entry = (struct ext4_free_data *)jce;
-       struct ext4_buddy e4b;
-       struct ext4_group_info *db;
-       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->efd_count, entry->efd_group, entry);
--              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);
--
--              db = e4b.bd_info;
--              /* there are blocks to put in buddy to make them really free */
--              count += entry->count;
--              count2++;
--              ext4_lock_group(sb, entry->group);
--              /* 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);
--
--              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);
--              }
--              ext4_unlock_group(sb, entry->group);
--              kmem_cache_free(ext4_free_ext_cachep, entry);
--              ext4_mb_release_desc(&e4b);
-+              page_cache_release(e4b.bd_buddy_page);
-+              page_cache_release(e4b.bd_bitmap_page);
-       }
-+      ext4_unlock_group(sb, entry->efd_group);
-+      kmem_cache_free(ext4_free_data_cachep, entry);
-+      ext4_mb_release_desc(&e4b);
-       mb_debug(1, "freed %u blocks in %u structures\n", count, count2);
- }
-@@ -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);
--      if (ext4_ac_cachep == NULL) {
--              kmem_cache_destroy(ext4_pspace_cachep);
--              return -ENOMEM;
--      }
-+      if (ext4_ac_cachep == NULL)
-+              goto out_err;
-+
-+      ext4_free_data_cachep =
-+              KMEM_CACHE(ext4_free_data, SLAB_RECLAIM_ACCOUNT);
-+      if (ext4_free_data_cachep == NULL)
-+              goto out1_err;
--      ext4_free_ext_cachep =
--              kmem_cache_create("ext4_free_block_extents",
--                                   sizeof(struct ext4_free_data),
--                                   0, SLAB_RECLAIM_ACCOUNT, NULL);
--      if (ext4_free_ext_cachep == NULL) {
--              kmem_cache_destroy(ext4_pspace_cachep);
--              kmem_cache_destroy(ext4_ac_cachep);
--              return -ENOMEM;
--      }
-       ext4_create_debugfs_entry();
-       return 0;
-+
-+out1_err:
-+      kmem_cache_destroy(ext4_ac_cachep);
-+out_err:
-+      kmem_cache_destroy(ext4_pspace_cachep);
-+      return -ENOMEM;
- }
- 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);
--      kmem_cache_destroy(ext4_free_ext_cachep);
-+      kmem_cache_destroy(ext4_free_data_cachep);
-       ext4_remove_debugfs_entry();
- }
-@@ -3355,8 +3350,8 @@ static void ext4_mb_generate_from_freeli
-       n = rb_first(&(grp->bb_free_root));
-       while (n) {
--              entry = rb_entry(n, struct ext4_free_data, node);
--              mb_set_bits(bitmap, entry->start_blk, entry->count);
-+              entry = rb_entry(n, struct ext4_free_data, efd_node);
-+              mb_set_bits(bitmap, entry->efd_start_blk, entry->efd_count);
-               n = rb_next(n);
-       }
-       return;
-@@ -4606,11 +4601,11 @@ out:
-  * AND the blocks are associated with the same group.
-  */
- static int can_merge(struct ext4_free_data *entry1,
--                      struct ext4_free_data *entry2)
-+                   struct ext4_free_data *entry2)
- {
--      if ((entry1->t_tid == entry2->t_tid) &&
--          (entry1->group == entry2->group) &&
--          ((entry1->start_blk + entry1->count) == entry2->start_blk))
-+      if ((entry1->efd_tid == entry2->efd_tid) &&
-+          (entry1->efd_group == entry2->efd_group) &&
-+          ((entry1->efd_start_blk + entry1->efd_count) == entry2->efd_start_blk))
-               return 1;
-       return 0;
- }
-@@ -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 ext4_sb_info *sbi = EXT4_SB(sb);
-       struct rb_node **n = &db->bb_free_root.rb_node, *node;
-       struct rb_node *parent = NULL, *new_node;
-@@ -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);
--      new_node = &new_entry->node;
--      block = new_entry->start_blk;
-+      new_node = &new_entry->efd_node;
-+      block = new_entry->efd_start_blk;
-       if (!*n) {
-               /* first free block exent. We need to
-@@ -4645,15 +4639,15 @@ ext4_mb_free_metadata(handle_t *handle,
-       }
-       while (*n) {
-               parent = *n;
--              entry = rb_entry(parent, struct ext4_free_data, node);
--              if (block < entry->start_blk)
-+              entry = rb_entry(parent, struct ext4_free_data, efd_node);
-+              if (block < entry->efd_start_blk)
-                       n = &(*n)->rb_left;
--              else if (block >= (entry->start_blk + entry->count))
-+              else if (block >= (entry->efd_start_blk + entry->efd_count))
-                       n = &(*n)->rb_right;
-               else {
-                       ext4_grp_locked_error(sb, e4b->bd_group, __func__,
-                                       "Double free of blocks %d (%d %d)",
--                                      block, entry->start_blk, entry->count);
-+                                      block, entry->efd_start_blk, entry->efd_count);
-                       return 0;
-               }
-       }
-@@ -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) {
--              entry = rb_entry(node, struct ext4_free_data, node);
-+              entry = rb_entry(node, struct ext4_free_data, efd_node);
-               if (can_merge(entry, new_entry)) {
--                      new_entry->start_blk = entry->start_blk;
--                      new_entry->count += entry->count;
-+                      new_entry->efd_start_blk = entry->efd_start_blk;
-+                      new_entry->efd_count += entry->efd_count;
-                       rb_erase(node, &(db->bb_free_root));
--                      spin_lock(&sbi->s_md_lock);
--                      list_del(&entry->list);
--                      spin_unlock(&sbi->s_md_lock);
--                      kmem_cache_free(ext4_free_ext_cachep, entry);
-+                      ext4_journal_callback_del(handle, &entry->efd_jce);
-+                      kmem_cache_free(ext4_free_data_cachep, entry);
-               }
-       }
-       node = rb_next(new_node);
-       if (node) {
--              entry = rb_entry(node, struct ext4_free_data, node);
-+              entry = rb_entry(node, struct ext4_free_data, efd_node);
-               if (can_merge(new_entry, entry)) {
--                      new_entry->count += entry->count;
-+                      new_entry->efd_count += entry->efd_count;
-                       rb_erase(node, &(db->bb_free_root));
--                      spin_lock(&sbi->s_md_lock);
--                      list_del(&entry->list);
--                      spin_unlock(&sbi->s_md_lock);
--                      kmem_cache_free(ext4_free_ext_cachep, entry);
-+                      ext4_journal_callback_del(handle, &entry->efd_jce);
-+                      kmem_cache_free(ext4_free_data_cachep, entry);
-               }
-       }
-       /* Add the extent to transaction's private list */
--      spin_lock(&sbi->s_md_lock);
--      list_add(&new_entry->list, &handle->h_transaction->t_private_list);
--      spin_unlock(&sbi->s_md_lock);
-+      ext4_journal_callback_add(handle, ext4_free_data_callback,
-+                                &new_entry->efd_jce);
-       return 0;
- }
-@@ -4825,11 +4814,11 @@ do_more:
-                * blocks being freed are metadata. these blocks shouldn't
-                * be used until this transaction is committed
-                */
--              new_entry  = kmem_cache_alloc(ext4_free_ext_cachep, GFP_NOFS);
--              new_entry->start_blk = bit;
--              new_entry->group  = block_group;
--              new_entry->count = count;
--              new_entry->t_tid = handle->h_transaction->t_tid;
-+              new_entry = kmem_cache_alloc(ext4_free_data_cachep, GFP_NOFS);
-+              new_entry->efd_start_blk = bit;
-+              new_entry->efd_group  = block_group;
-+              new_entry->efd_count = count;
-+              new_entry->efd_tid = handle->h_transaction->t_tid;
-               ext4_lock_group(sb, block_group);
-               mb_clear_bits(bitmap_bh->b_data, bit, count);
-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
-@@ -338,6 +338,18 @@ void ext4_journal_abort_handle(const cha
- EXPORT_SYMBOL(ext4_journal_abort_handle);
-+static void ext4_journal_commit_callback(journal_t *journal, transaction_t *txn)
-+{
-+      struct super_block              *sb = journal->j_private;
-+      int                             error = is_journal_aborted(journal);
-+      struct ext4_journal_cb_entry    *jce, *tmp;
-+
-+      list_for_each_entry_safe(jce, tmp, &txn->t_private_list, jce_list) {
-+              list_del_init(&jce->jce_list);
-+              jce->jce_func(sb, jce, error);
-+      }
-+}
-+
- /* Deal with the reporting of failure conditions on a filesystem such as
-  * inconsistencies detected or read IO failures.
-  *
-@@ -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)) {
diff --git a/ldiskfs/kernel_patches/patches/rhel6.3/ext4-kill-dx_root.patch b/ldiskfs/kernel_patches/patches/rhel6.3/ext4-kill-dx_root.patch
deleted file mode 100644 (file)
index 6631dde..0000000
+++ /dev/null
@@ -1,236 +0,0 @@
-removes static definition of dx_root struct. so that "." and ".." dirent can
-have extra data. This patch does not change any functionality but is required for
-ext4_data_in_dirent patch.
-Index: linux-2.6.32.i386/fs/ext4/namei.c
-===================================================================
---- linux-2.6.32.i386.orig/fs/ext4/namei.c     2010-04-16 05:35:06.000000000 +0530
-+++ linux-2.6.32.i386/fs/ext4/namei.c  2010-04-16 05:47:41.000000000 +0530
-@@ -115,22 +115,13 @@
-  * hash version mod 4 should never be 0.  Sincerely, the paranoia department.
-  */
--struct dx_root
-+struct dx_root_info
- {
--      struct fake_dirent dot;
--      char dot_name[4];
--      struct fake_dirent dotdot;
--      char dotdot_name[4];
--      struct dx_root_info
--      {
--              __le32 reserved_zero;
--              u8 hash_version;
--              u8 info_length; /* 8 */
--              u8 indirect_levels;
--              u8 unused_flags;
--      }
--      info;
--      struct dx_entry entries[0];
-+      __le32 reserved_zero;
-+      u8 hash_version;
-+      u8 info_length; /* 8 */
-+      u8 indirect_levels;
-+      u8 unused_flags;
- };
- struct dx_node
-@@ -244,6 +235,16 @@
-  * Future: use high four bits of block for coalesce-on-delete flags
-  * Mask them off for now.
-  */
-+struct dx_root_info * dx_get_dx_info(struct ext4_dir_entry_2 *de)
-+{
-+       /* get dotdot first */
-+       de = (struct ext4_dir_entry_2 *)((char *)de + EXT4_DIR_REC_LEN(1));
-+
-+       /* dx root info is after dotdot entry */
-+       de = (struct ext4_dir_entry_2 *)((char *)de + EXT4_DIR_REC_LEN(2));
-+
-+       return (struct dx_root_info *) de;
-+}
- static inline ext4_lblk_t dx_get_block(struct dx_entry *entry)
- {
-@@ -398,7 +399,7 @@
- {
-       unsigned count, indirect;
-       struct dx_entry *at, *entries, *p, *q, *m;
--      struct dx_root *root;
-+      struct dx_root_info * info;
-       struct buffer_head *bh;
-       struct dx_frame *frame = frame_in;
-       u32 hash;
-@@ -406,17 +407,18 @@
-       frame->bh = NULL;
-       if (!(bh = ext4_bread (NULL,dir, 0, 0, err)))
-               goto fail;
--      root = (struct dx_root *) bh->b_data;
--      if (root->info.hash_version != DX_HASH_TEA &&
--          root->info.hash_version != DX_HASH_HALF_MD4 &&
--          root->info.hash_version != DX_HASH_LEGACY) {
-+
-+      info = dx_get_dx_info((struct ext4_dir_entry_2*)bh->b_data);
-+      if (info->hash_version != DX_HASH_TEA &&
-+          info->hash_version != DX_HASH_HALF_MD4 &&
-+          info->hash_version != DX_HASH_LEGACY) {
-               ext4_warning(dir->i_sb, "Unrecognised inode hash code %d for directory "
--                             "#%lu", root->info.hash_version, dir->i_ino);
-+                             "#%lu", info->hash_version, dir->i_ino);
-               brelse(bh);
-               *err = ERR_BAD_DX_DIR;
-               goto fail;
-       }
--      hinfo->hash_version = root->info.hash_version;
-+      hinfo->hash_version = info->hash_version;
-       if (hinfo->hash_version <= DX_HASH_TEA)
-               hinfo->hash_version += EXT4_SB(dir->i_sb)->s_hash_unsigned;
-       hinfo->seed = EXT4_SB(dir->i_sb)->s_hash_seed;
-@@ -425,27 +427,26 @@
-               ext4fs_dirhash(d_name->name, d_name->len, hinfo);
-       hash = hinfo->hash;
--      if (root->info.unused_flags & 1) {
-+      if (info->unused_flags & 1) {
-               ext4_warning(dir->i_sb, "Unimplemented inode hash flags: %#06x",
--                           root->info.unused_flags);
-+                           info->unused_flags);
-               brelse(bh);
-               *err = ERR_BAD_DX_DIR;
-               goto fail;
-       }
--      if ((indirect = root->info.indirect_levels) > 1) {
-+      if ((indirect = info->indirect_levels) > 1) {
-               ext4_warning(dir->i_sb, "Unimplemented inode hash depth: %#06x",
--                           root->info.indirect_levels);
-+                           info->indirect_levels);
-               brelse(bh);
-               *err = ERR_BAD_DX_DIR;
-               goto fail;
-       }
--      entries = (struct dx_entry *) (((char *)&root->info) +
--                                     root->info.info_length);
-+      entries = (struct dx_entry *) (((char *)info) + info->info_length);
-       if (dx_get_limit(entries) != dx_root_limit(dir,
--                                                 root->info.info_length)) {
-+                                                 info->info_length)) {
-               ext4_warning(dir->i_sb, "dx entry: limit != root limit");
-               brelse(bh);
-               *err = ERR_BAD_DX_DIR;
-@@ -525,10 +526,12 @@ fail:
- static void dx_release (struct dx_frame *frames)
- {
-+      struct dx_root_info *info;
-       if (frames[0].bh == NULL)
-               return;
--      if (((struct dx_root *) frames[0].bh->b_data)->info.indirect_levels)
-+      info = dx_get_dx_info((struct ext4_dir_entry_2*)frames[0].bh->b_data);
-+      if (info->indirect_levels)
-               brelse(frames[1].bh);
-       brelse(frames[0].bh);
- }
-@@ -1447,17 +1450,16 @@
-       const char      *name = dentry->d_name.name;
-       int             namelen = dentry->d_name.len;
-       struct buffer_head *bh2;
--      struct dx_root  *root;
-       struct dx_frame frames[2], *frame;
-       struct dx_entry *entries;
--      struct ext4_dir_entry_2 *de, *de2;
-+      struct ext4_dir_entry_2 *de, *de2, *dot_de, *dotdot_de;
-       char            *data1, *top;
-       unsigned        len;
-       int             retval;
-       unsigned        blocksize;
-       struct dx_hash_info hinfo;
-       ext4_lblk_t  block;
--      struct fake_dirent *fde;
-+      struct dx_root_info *dx_info;
-       blocksize =  dir->i_sb->s_blocksize;
-       dxtrace(printk(KERN_DEBUG "Creating index: inode %lu\n", dir->i_ino));
-@@ -1467,20 +1469,21 @@
-               brelse(bh);
-               return retval;
-       }
--      root = (struct dx_root *) bh->b_data;
-+
-+      dot_de = (struct ext4_dir_entry_2 *) bh->b_data;
-+      dotdot_de = ext4_next_entry(dot_de, blocksize);
-       /* The 0th block becomes the root, move the dirents out */
--      fde = &root->dotdot;
--      de = (struct ext4_dir_entry_2 *)((char *)fde +
--              ext4_rec_len_from_disk(fde->rec_len, blocksize));
--      if ((char *) de >= (((char *) root) + blocksize)) {
-+      de = (struct ext4_dir_entry_2 *)((char *)dotdot_de +
-+              ext4_rec_len_from_disk(dotdot_de->rec_len, blocksize));
-+      if ((char *) de >= (((char *) dot_de) + blocksize)) {
-               ext4_error(dir->i_sb,
-                          "invalid rec_len for '..' in inode %lu",
-                          dir->i_ino);
-               brelse(bh);
-               return -EIO;
-       }
--      len = ((char *) root) + blocksize - (char *) de;
-+      len = ((char *) dot_de) + blocksize - (char *) de;
-       /* Allocate new block for the 0th block's dirents */
-       bh2 = ext4_append(handle, dir, &block, &retval);
-@@ -1499,19 +1502,23 @@
-       de->rec_len = ext4_rec_len_to_disk(data1 + blocksize - (char *) de,
-                                          blocksize);
-       /* Initialize the root; the dot dirents already exist */
--      de = (struct ext4_dir_entry_2 *) (&root->dotdot);
--      de->rec_len = ext4_rec_len_to_disk(blocksize - EXT4_DIR_REC_LEN(2),
--                                         blocksize);
--      memset (&root->info, 0, sizeof(root->info));
--      root->info.info_length = sizeof(root->info);
--      root->info.hash_version = EXT4_SB(dir->i_sb)->s_def_hash_version;
--      entries = root->entries;
-+      dotdot_de->rec_len = ext4_rec_len_to_disk(blocksize -
-+                      le16_to_cpu(dot_de->rec_len), blocksize);
-+
-+      /* initialize hashing info */
-+      dx_info = dx_get_dx_info(dot_de);
-+      memset (dx_info, 0, sizeof(*dx_info));
-+      dx_info->info_length = sizeof(*dx_info);
-+      dx_info->hash_version = EXT4_SB(dir->i_sb)->s_def_hash_version;
-+
-+      entries = (void *)dx_info + sizeof(*dx_info);
-+
-       dx_set_block(entries, 1);
-       dx_set_count(entries, 1);
--      dx_set_limit(entries, dx_root_limit(dir, sizeof(root->info)));
-+      dx_set_limit(entries, dx_root_limit(dir, sizeof(*dx_info)));
-       /* Initialize as for dx_probe */
--      hinfo.hash_version = root->info.hash_version;
-+      hinfo.hash_version = dx_info->hash_version;
-       if (hinfo.hash_version <= DX_HASH_TEA)
-               hinfo.hash_version += EXT4_SB(dir->i_sb)->s_hash_unsigned;
-       hinfo.seed = EXT4_SB(dir->i_sb)->s_hash_seed;
-@@ -1759,6 +1766,7 @@
-                               goto journal_error;
-                       brelse (bh2);
-               } else {
-+                      struct dx_root_info * info;
-                       dxtrace(printk(KERN_DEBUG
-                                      "Creating second level index...\n"));
-                       memcpy((char *) entries2, (char *) entries,
-@@ -1768,7 +1776,9 @@
-                       /* Set up root */
-                       dx_set_count(entries, 1);
-                       dx_set_block(entries + 0, newblock);
--                      ((struct dx_root *) frames[0].bh->b_data)->info.indirect_levels = 1;
-+                      info = dx_get_dx_info((struct ext4_dir_entry_2*)
-+                                      frames[0].bh->b_data);
-+                      info->indirect_levels = 1;
-                       /* Add new access path frame */
-                       frame = frames + 1;
diff --git a/ldiskfs/kernel_patches/patches/rhel6.3/ext4-large-dir.patch b/ldiskfs/kernel_patches/patches/rhel6.3/ext4-large-dir.patch
deleted file mode 100644 (file)
index cf5f1f1..0000000
+++ /dev/null
@@ -1,355 +0,0 @@
-This INCOMPAT_LARGEDIR feature allows larger directories
-to be created in ldiskfs, both with directory sizes over
-2GB and and a maximum htree depth of 3 instead of the
-current limit of 2. These features are needed in order
-to exceed the current limit of approximately 10M entries
-in a single directory.
-
-Index: linux-2.6.32-504.3.3.el6.x86_64/fs/ext4/ext4.h
-===================================================================
---- 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
-@@ -1344,6 +1344,7 @@ EXT4_INODE_BIT_FNS(state, state_flags)
- #define EXT4_FEATURE_INCOMPAT_FLEX_BG         0x0200
- #define EXT4_FEATURE_INCOMPAT_EA_INODE                0x0400
- #define EXT4_FEATURE_INCOMPAT_DIRDATA         0x1000
-+#define EXT4_FEATURE_INCOMPAT_LARGEDIR                0x4000
- #define EXT4_FEATURE_COMPAT_SUPP      EXT2_FEATURE_COMPAT_EXT_ATTR
- #define EXT4_FEATURE_INCOMPAT_SUPP    (EXT4_FEATURE_INCOMPAT_FILETYPE| \
-@@ -1354,7 +1355,8 @@ EXT4_INODE_BIT_FNS(state, state_flags)
-                                        EXT4_FEATURE_INCOMPAT_FLEX_BG| \
-                                        EXT4_FEATURE_INCOMPAT_EA_INODE| \
-                                        EXT4_FEATURE_INCOMPAT_MMP| \
--                                       EXT4_FEATURE_INCOMPAT_DIRDATA)
-+                                       EXT4_FEATURE_INCOMPAT_DIRDATA| \
-+                                       EXT4_FEATURE_INCOMPAT_LARGEDIR)
- #define EXT4_FEATURE_RO_COMPAT_SUPP   (EXT4_FEATURE_RO_COMPAT_SPARSE_SUPER| \
-                                        EXT4_FEATURE_RO_COMPAT_LARGE_FILE| \
-@@ -1612,6 +1614,17 @@ ext4_group_first_block_no(struct super_b
-  */
- #define ERR_BAD_DX_DIR        -75000
-+/* htree levels for ext4 */
-+#define EXT4_HTREE_LEVEL_COMPAT 2
-+#define EXT4_HTREE_LEVEL      3
-+
-+static inline int
-+ext4_dir_htree_level(struct super_block *sb)
-+{
-+      return EXT4_HAS_INCOMPAT_FEATURE(sb, EXT4_FEATURE_INCOMPAT_LARGEDIR) ?
-+              EXT4_HTREE_LEVEL : EXT4_HTREE_LEVEL_COMPAT;
-+}
-+
- void ext4_get_group_no_and_offset(struct super_block *sb, ext4_fsblk_t blocknr,
-                       ext4_group_t *blockgrpp, ext4_grpblk_t *offsetp);
-@@ -2005,13 +2018,15 @@ static inline void ext4_r_blocks_count_s
-       es->s_r_blocks_count_hi = cpu_to_le32(blk >> 32);
- }
--static inline loff_t ext4_isize(struct ext4_inode *raw_inode)
-+static inline loff_t ext4_isize(struct super_block *sb,
-+                              struct ext4_inode *raw_inode)
- {
--      if (S_ISREG(le16_to_cpu(raw_inode->i_mode)))
-+      if (EXT4_HAS_INCOMPAT_FEATURE(sb, EXT4_FEATURE_INCOMPAT_LARGEDIR) ||
-+          S_ISREG(le16_to_cpu(raw_inode->i_mode)))
-               return ((loff_t)le32_to_cpu(raw_inode->i_size_high) << 32) |
-                       le32_to_cpu(raw_inode->i_size_lo);
--      else
--              return (loff_t) le32_to_cpu(raw_inode->i_size_lo);
-+
-+      return (loff_t) le32_to_cpu(raw_inode->i_size_lo);
- }
- static inline void ext4_isize_set(struct ext4_inode *raw_inode, loff_t i_size)
-Index: linux-2.6.32-504.3.3.el6.x86_64/fs/ext4/inode.c
-===================================================================
---- linux-2.6.32-504.3.3.el6.x86_64.orig/fs/ext4/inode.c
-+++ linux-2.6.32-504.3.3.el6.x86_64/fs/ext4/inode.c
-@@ -5470,7 +5470,7 @@ struct inode *ext4_iget(struct super_blo
-       if (EXT4_HAS_INCOMPAT_FEATURE(sb, EXT4_FEATURE_INCOMPAT_64BIT))
-               ei->i_file_acl |=
-                       ((__u64)le16_to_cpu(raw_inode->i_file_acl_high)) << 32;
--      inode->i_size = ext4_isize(raw_inode);
-+      inode->i_size = ext4_isize(sb, raw_inode);
-       ei->i_disksize = inode->i_size;
- #ifdef CONFIG_QUOTA
-       ei->i_reserved_quota = 0;
-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
-@@ -225,7 +225,7 @@ struct dx_root_info * dx_get_dx_info(str
- static inline ext4_lblk_t dx_get_block(struct dx_entry *entry)
- {
--      return le32_to_cpu(entry->block) & 0x00ffffff;
-+      return le32_to_cpu(entry->block) & 0x0fffffff;
- }
- static inline void dx_set_block(struct dx_entry *entry, ext4_lblk_t value)
-@@ -388,7 +388,7 @@ dx_probe(const struct qstr *d_name, stru
-       struct dx_frame *frame = frame_in;
-       u32 hash;
--      frame->bh = NULL;
-+      memset(frame_in, 0, EXT4_HTREE_LEVEL * sizeof(frame_in[0]));
-       if (!(bh = ext4_bread (NULL,dir, 0, 0, err)))
-               goto fail;
-@@ -418,9 +418,16 @@ dx_probe(const struct qstr *d_name, stru
-               goto fail;
-       }
--      if ((indirect = info->indirect_levels) > 1) {
--              ext4_warning(dir->i_sb, "Unimplemented inode hash depth: %#06x",
--                           info->indirect_levels);
-+      indirect = info->indirect_levels;
-+      if (indirect >= ext4_dir_htree_level(dir->i_sb)) {
-+              ext4_warning(dir->i_sb,
-+                           "Directory (ino: %lu) htree depth %#06x exceed "
-+                           "supported value", dir->i_ino,
-+                           ext4_dir_htree_level(dir->i_sb));
-+              if (ext4_dir_htree_level(dir->i_sb) < EXT4_HTREE_LEVEL) {
-+                      ext4_warning(dir->i_sb, "Enable large directory "
-+                                              "feature to access it");
-+              }
-               brelse(bh);
-               *err = ERR_BAD_DX_DIR;
-               goto fail;
-@@ -512,13 +519,18 @@ fail:
- static void dx_release (struct dx_frame *frames)
- {
-       struct dx_root_info *info;
-+      int i;
-+
-       if (frames[0].bh == NULL)
-               return;
-       info = dx_get_dx_info((struct ext4_dir_entry_2*)frames[0].bh->b_data);
--      if (info->indirect_levels)
--              brelse(frames[1].bh);
--      brelse(frames[0].bh);
-+      for (i = 0; i <= info->indirect_levels; i++) {
-+              if (frames[i].bh == NULL)
-+                      break;
-+              brelse(frames[i].bh);
-+              frames[i].bh = NULL;
-+      }
- }
- /*
-@@ -661,7 +673,7 @@ int ext4_htree_fill_tree(struct file *di
- {
-       struct dx_hash_info hinfo;
-       struct ext4_dir_entry_2 *de;
--      struct dx_frame frames[2], *frame;
-+      struct dx_frame frames[EXT4_HTREE_LEVEL], *frame;
-       struct inode *dir;
-       ext4_lblk_t block;
-       int count = 0;
-@@ -1003,7 +1015,7 @@ static struct buffer_head * ext4_dx_find
-       struct super_block * sb;
-       struct dx_hash_info     hinfo;
-       u32 hash;
--      struct dx_frame frames[2], *frame;
-+      struct dx_frame frames[EXT4_HTREE_LEVEL], *frame;
-       struct ext4_dir_entry_2 *de, *top;
-       struct buffer_head *bh;
-       ext4_lblk_t block;
-@@ -1443,7 +1455,7 @@ static int add_dirent_to_buf(handle_t *h
-        */
-       dir->i_mtime = dir->i_ctime = ext4_current_time(dir);
-       ext4_update_dx_flag(dir);
--      dir->i_version++;
-+      inode_inc_iversion(dir);
-       ext4_mark_inode_dirty(handle, dir);
-       BUFFER_TRACE(bh, "call ext4_handle_dirty_metadata");
-       err = ext4_handle_dirty_metadata(handle, dir, bh);
-@@ -1463,7 +1475,7 @@ static int make_indexed_dir(handle_t *ha
-       const char      *name = dentry->d_name.name;
-       int             namelen = dentry->d_name.len;
-       struct buffer_head *bh2;
--      struct dx_frame frames[2], *frame;
-+      struct dx_frame frames[EXT4_HTREE_LEVEL], *frame;
-       struct dx_entry *entries;
-       struct ext4_dir_entry_2 *de, *de2, *dot_de, *dotdot_de;
-       char            *data1, *top;
-@@ -1712,15 +1724,18 @@ static int ext4_add_entry(handle_t *hand
- static int ext4_dx_add_entry(handle_t *handle, struct dentry *dentry,
-                            struct inode *inode)
- {
--      struct dx_frame frames[2], *frame;
-+      struct dx_frame frames[EXT4_HTREE_LEVEL], *frame;
-       struct dx_entry *entries, *at;
-       struct dx_hash_info hinfo;
-       struct buffer_head *bh;
-       struct inode *dir = dentry->d_parent->d_inode;
-       struct super_block *sb = dir->i_sb;
-       struct ext4_dir_entry_2 *de;
-+      int restart;
-       int err;
-+again:
-+      restart = 0;
-       frame = dx_probe(&dentry->d_name, dir, &hinfo, frames, &err);
-       if (!frame)
-               return err;
-@@ -1730,33 +1745,48 @@ static int ext4_dx_add_entry(handle_t *h
-       if (!(bh = ext4_bread(handle,dir, dx_get_block(frame->at), 0, &err)))
-               goto cleanup;
--      BUFFER_TRACE(bh, "get_write_access");
--      err = ext4_journal_get_write_access(handle, bh);
--      if (err)
--              goto journal_error;
--
-       err = add_dirent_to_buf(handle, dentry, inode, NULL, bh);
-       if (err != -ENOSPC)
-               goto cleanup;
-+      err = 0;
-       /* Block full, should compress but for now just split */
-       dxtrace(printk(KERN_DEBUG "using %u of %u node entries\n",
-                      dx_get_count(entries), dx_get_limit(entries)));
-       /* Need to split index? */
-       if (dx_get_count(entries) == dx_get_limit(entries)) {
-               ext4_lblk_t newblock;
--              unsigned icount = dx_get_count(entries);
--              int levels = frame - frames;
-+              int levels = frame - frames + 1;
-+              unsigned icount;
-+              int add_level = 1;
-               struct dx_entry *entries2;
-               struct dx_node *node2;
-               struct buffer_head *bh2;
--              if (levels && (dx_get_count(frames->entries) ==
--                             dx_get_limit(frames->entries))) {
--                      ext4_warning(sb, "Directory index full!");
-+              while (frame > frames) {
-+                      if (dx_get_count((frame - 1)->entries) <
-+                          dx_get_limit((frame - 1)->entries)) {
-+                              add_level = 0;
-+                              break;
-+                      }
-+                      frame--; /* split higher index block */
-+                      at = frame->at;
-+                      entries = frame->entries;
-+                      restart = 1;
-+              }
-+              if (add_level && levels == ext4_dir_htree_level(sb)) {
-+                      ext4_warning(sb, "Directory (ino: %lu) index full, "
-+                                       "reach max htree level :%d",
-+                                       dir->i_ino, levels);
-+                      if (ext4_dir_htree_level(sb) < EXT4_HTREE_LEVEL) {
-+                              ext4_warning(sb, "Large directory feature is"
-+                                               "not enabled on this "
-+                                               "filesystem");
-+                      }
-                       err = -ENOSPC;
-                       goto cleanup;
-               }
-+              icount = dx_get_count(entries);
-               bh2 = ext4_append (handle, dir, &newblock, &err);
-               if (!(bh2))
-                       goto cleanup;
-@@ -1769,7 +1799,7 @@ static int ext4_dx_add_entry(handle_t *h
-               err = ext4_journal_get_write_access(handle, frame->bh);
-               if (err)
-                       goto journal_error;
--              if (levels) {
-+              if (!add_level) {
-                       unsigned icount1 = icount/2, icount2 = icount - icount1;
-                       unsigned hash2 = dx_get_hash(entries + icount1);
-                       dxtrace(printk(KERN_DEBUG "Split index %i/%i\n",
-@@ -1777,7 +1807,7 @@ static int ext4_dx_add_entry(handle_t *h
-                       BUFFER_TRACE(frame->bh, "get_write_access"); /* index root */
-                       err = ext4_journal_get_write_access(handle,
--                                                           frames[0].bh);
-+                                                          (frame - 1)->bh);
-                       if (err)
-                               goto journal_error;
-@@ -1793,18 +1823,24 @@ static int ext4_dx_add_entry(handle_t *h
-                               frame->entries = entries = entries2;
-                               swap(frame->bh, bh2);
-                       }
--                      dx_insert_block(frames + 0, hash2, newblock);
--                      dxtrace(dx_show_index("node", frames[1].entries));
-+                      dx_insert_block((frame - 1), hash2, newblock);
-+                      dxtrace(dx_show_index("node", frame->entries));
-                       dxtrace(dx_show_index("node",
-                              ((struct dx_node *) bh2->b_data)->entries));
-                       err = ext4_handle_dirty_metadata(handle, dir, bh2);
-                       if (err)
-                               goto journal_error;
-                       brelse (bh2);
-+                      ext4_handle_dirty_metadata(handle, dir,
-+                                                 (frame - 1)->bh);
-+                      if (restart) {
-+                              ext4_handle_dirty_metadata(handle, dir,
-+                                                         frame->bh);
-+                              goto cleanup;
-+                      }
-               } else {
-                       struct dx_root_info * info;
--                      dxtrace(printk(KERN_DEBUG
--                                     "Creating second level index...\n"));
-+
-                       memcpy((char *) entries2, (char *) entries,
-                              icount * sizeof(struct dx_entry));
-                       dx_set_limit(entries2, dx_node_limit(dir));
-@@ -1814,19 +1850,16 @@ static int ext4_dx_add_entry(handle_t *h
-                       dx_set_block(entries + 0, newblock);
-                       info = dx_get_dx_info((struct ext4_dir_entry_2*)
-                                       frames[0].bh->b_data);
--                      info->indirect_levels = 1;
--
--                      /* Add new access path frame */
--                      frame = frames + 1;
--                      frame->at = at = at - entries + entries2;
--                      frame->entries = entries = entries2;
--                      frame->bh = bh2;
--                      err = ext4_journal_get_write_access(handle,
--                                                           frame->bh);
--                      if (err)
--                              goto journal_error;
-+                      info->indirect_levels += 1;
-+                      dxtrace(printk(KERN_DEBUG
-+                                     "Creating %d level index...\n",
-+                                     info->indirect_levels));
-+                      ext4_handle_dirty_metadata(handle, dir, frame->bh);
-+                      ext4_handle_dirty_metadata(handle, dir, bh2);
-+                      brelse(bh2);
-+                      restart = 1;
-+                      goto cleanup;
-               }
--              err = ext4_handle_dirty_metadata(handle, dir, frames[0].bh);
-               if (err) {
-                       ext4_std_error(inode->i_sb, err);
-                       goto cleanup;
-@@ -1840,6 +1873,10 @@ cleanup:
-       if (bh)
-               brelse(bh);
-       dx_release(frames);
-+      /* @restart is true means htree-path has been changed, we need to
-+       * repeat dx_probe() to find out valid htree-path */
-+      if (restart && err == 0)
-+              goto again;
-       return err;
- }
-@@ -1874,7 +1911,7 @@ int ext4_delete_entry(handle_t *handle,
-                                       blocksize);
-                       else
-                               de->inode = 0;
--                      dir->i_version++;
-+                      inode_inc_iversion(dir);
-                       BUFFER_TRACE(bh, "call ext4_handle_dirty_metadata");
-                       ext4_handle_dirty_metadata(handle, dir, bh);
-                       return 0;
diff --git a/ldiskfs/kernel_patches/patches/rhel6.3/ext4-large-eas.patch b/ldiskfs/kernel_patches/patches/rhel6.3/ext4-large-eas.patch
deleted file mode 100644 (file)
index 968ab15..0000000
+++ /dev/null
@@ -1,1026 +0,0 @@
-Index: linux-stage/fs/ext4/ext4.h
-===================================================================
---- linux-stage.orig/fs/ext4/ext4.h
-+++ linux-stage/fs/ext4/ext4.h
-@@ -1329,6 +1329,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_INCOMPAT_EA_INODE                0x0400
- #define EXT4_FEATURE_INCOMPAT_DIRDATA         0x1000
- #define EXT4_FEATURE_COMPAT_SUPP      EXT2_FEATURE_COMPAT_EXT_ATTR
-@@ -1338,6 +1339,7 @@ EXT4_INODE_BIT_FNS(state, state_flags)
-                                        EXT4_FEATURE_INCOMPAT_EXTENTS| \
-                                        EXT4_FEATURE_INCOMPAT_64BIT| \
-                                        EXT4_FEATURE_INCOMPAT_FLEX_BG| \
-+                                       EXT4_FEATURE_INCOMPAT_EA_INODE| \
-                                        EXT4_FEATURE_INCOMPAT_MMP| \
-                                        EXT4_FEATURE_INCOMPAT_DIRDATA)
-@@ -1706,6 +1714,10 @@ struct mmpd_data {
- # define ATTRIB_NORET __attribute__((noreturn))
- # define NORET_AND    noreturn,
-+struct ext4_xattr_ino_array {
-+      unsigned int xia_count;         /* # of used item in the array */
-+      unsigned int xia_inodes[0];
-+};
- /* bitmap.c */
- extern unsigned int ext4_count_free(struct buffer_head *, unsigned);
-Index: linux-stage/fs/ext4/xattr.c
-===================================================================
---- linux-stage.orig/fs/ext4/xattr.c
-+++ linux-stage/fs/ext4/xattr.c
-@@ -168,19 +168,26 @@ ext4_xattr_check_block(struct buffer_hea
- }
- static inline int
--ext4_xattr_check_entry(struct ext4_xattr_entry *entry, size_t size)
-+ext4_xattr_check_entry(struct ext4_xattr_entry *entry, size_t size,
-+                     struct inode *inode)
- {
-       size_t value_size = le32_to_cpu(entry->e_value_size);
--      if (entry->e_value_block != 0 || value_size > size ||
-+      if (!entry->e_value_inum &&
-           le16_to_cpu(entry->e_value_offs) + value_size > size)
-+              return -EIO;
-+      if (entry->e_value_inum &&
-+          (le32_to_cpu(entry->e_value_inum) < EXT4_FIRST_INO(inode->i_sb) ||
-+           le32_to_cpu(entry->e_value_inum) >
-+           le32_to_cpu(EXT4_SB(inode->i_sb)->s_es->s_inodes_count)))
-               return -EIO;
-       return 0;
- }
- static int
- ext4_xattr_find_entry(struct ext4_xattr_entry **pentry, int name_index,
--                    const char *name, size_t size, int sorted)
-+                    const char *name, size_t size, int sorted,
-+                    struct inode *inode)
- {
-       struct ext4_xattr_entry *entry;
-       size_t name_len;
-@@ -200,11 +207,104 @@ ext4_xattr_find_entry(struct ext4_xattr_
-                       break;
-       }
-       *pentry = entry;
--      if (!cmp && ext4_xattr_check_entry(entry, size))
-+      if (!cmp && ext4_xattr_check_entry(entry, size, inode))
-                       return -EIO;
-       return cmp ? -ENODATA : 0;
- }
-+/*
-+ * Read the EA value from an inode.
-+ */
-+static int
-+ext4_xattr_inode_read(struct inode *ea_inode, void *buf, size_t *size)
-+{
-+      unsigned long block = 0;
-+      struct buffer_head *bh = NULL;
-+      int err, blocksize;
-+      size_t csize, ret_size = 0;
-+
-+      if (*size == 0)
-+              return 0;
-+
-+      blocksize = ea_inode->i_sb->s_blocksize;
-+
-+      while (ret_size < *size) {
-+              csize = (*size - ret_size) > blocksize ? blocksize :
-+                                                      *size - ret_size;
-+              bh = ext4_bread(NULL, ea_inode, block, 0, &err);
-+              if (!bh) {
-+                      *size = ret_size;
-+                      return err;
-+              }
-+              memcpy(buf, bh->b_data, csize);
-+              brelse(bh);
-+
-+              buf += csize;
-+              block += 1;
-+              ret_size += csize;
-+      }
-+
-+      *size = ret_size;
-+
-+      return err;
-+}
-+
-+struct inode *ext4_xattr_inode_iget(struct inode *parent, unsigned long ea_ino, int *err)
-+{
-+      struct inode *ea_inode = NULL;
-+
-+      ea_inode = ext4_iget(parent->i_sb, ea_ino);
-+      if (IS_ERR(ea_inode) || is_bad_inode(ea_inode)) {
-+              int rc = IS_ERR(ea_inode) ? PTR_ERR(ea_inode) : 0;
-+              ext4_error(parent->i_sb, "error while reading EA inode %lu "
-+                         "/ %d %d", ea_ino, rc, is_bad_inode(ea_inode));
-+              *err = rc != 0 ? rc : -EIO;
-+              return NULL;
-+      }
-+
-+      if (EXT4_XATTR_INODE_GET_PARENT(ea_inode) != parent->i_ino ||
-+          ea_inode->i_generation != parent->i_generation) {
-+              ext4_error(parent->i_sb, "Backpointer from EA inode %lu "
-+                         "to parent invalid.", ea_ino);
-+              *err = -EINVAL;
-+              goto error;
-+      }
-+
-+      if (!(EXT4_I(ea_inode)->i_flags & EXT4_EA_INODE_FL)) {
-+              ext4_error(parent->i_sb, "EA inode %lu does not have "
-+                         "EXT4_EA_INODE_FL flag set.\n", ea_ino);
-+              *err = -EINVAL;
-+              goto error;
-+      }
-+
-+      *err = 0;
-+      return ea_inode;
-+
-+error:
-+      iput(ea_inode);
-+      return NULL;
-+}
-+
-+/*
-+ * Read the value from the EA inode.
-+ */
-+static int
-+ext4_xattr_inode_get(struct inode *inode, unsigned long ea_ino, void *buffer,
-+                   size_t *size)
-+{
-+      struct inode *ea_inode = NULL;
-+      int err;
-+
-+      ea_inode = ext4_xattr_inode_iget(inode, ea_ino, &err);
-+      if (err)
-+              return err;
-+
-+      err = ext4_xattr_inode_read(ea_inode, buffer, size);
-+      iput(ea_inode);
-+
-+      return err;
-+}
-+
- static int
- ext4_xattr_block_get(struct inode *inode, int name_index, const char *name,
-                    void *buffer, size_t buffer_size)
-@@ -236,7 +335,8 @@ bad_block:
-       }
-       ext4_xattr_cache_insert(bh);
-       entry = BFIRST(bh);
--      error = ext4_xattr_find_entry(&entry, name_index, name, bh->b_size, 1);
-+      error = ext4_xattr_find_entry(&entry, name_index, name, bh->b_size, 1,
-+                                    inode);
-       if (error == -EIO)
-               goto bad_block;
-       if (error)
-@@ -246,8 +346,16 @@ bad_block:
-               error = -ERANGE;
-               if (size > buffer_size)
-                       goto cleanup;
--              memcpy(buffer, bh->b_data + le16_to_cpu(entry->e_value_offs),
--                     size);
-+              if (entry->e_value_inum) {
-+                      error = ext4_xattr_inode_get(inode,
-+                                           le32_to_cpu(entry->e_value_inum),
-+                                           buffer, &size);
-+                      if (error)
-+                              goto cleanup;
-+              } else {
-+                      memcpy(buffer, bh->b_data +
-+                             le16_to_cpu(entry->e_value_offs), size);
-+              }
-       }
-       error = size;
-@@ -281,7 +389,7 @@ ext4_xattr_ibody_get(struct inode *inode
-       if (error)
-               goto cleanup;
-       error = ext4_xattr_find_entry(&entry, name_index, name,
--                                    end - (void *)entry, 0);
-+                                    end - (void *)entry, 0, inode);
-       if (error)
-               goto cleanup;
-       size = le32_to_cpu(entry->e_value_size);
-@@ -289,8 +397,16 @@ ext4_xattr_ibody_get(struct inode *inode
-               error = -ERANGE;
-               if (size > buffer_size)
-                       goto cleanup;
--              memcpy(buffer, (void *)IFIRST(header) +
--                     le16_to_cpu(entry->e_value_offs), size);
-+              if (entry->e_value_inum) {
-+                      error = ext4_xattr_inode_get(inode,
-+                                           le32_to_cpu(entry->e_value_inum),
-+                                           buffer, &size);
-+                      if (error)
-+                              goto cleanup;
-+              } else {
-+                      memcpy(buffer, (void *)IFIRST(header) +
-+                             le16_to_cpu(entry->e_value_offs), size);
-+              }
-       }
-       error = size;
-@@ -513,7 +629,7 @@ static size_t ext4_xattr_free_space(stru
- {
-       for (; !IS_LAST_ENTRY(last); last = EXT4_XATTR_NEXT(last)) {
-               *total += EXT4_XATTR_LEN(last->e_name_len);
--              if (!last->e_value_block && last->e_value_size) {
-+              if (!last->e_value_inum && last->e_value_size) {
-                       size_t offs = le16_to_cpu(last->e_value_offs);
-                       if (offs < *min_offs)
-                               *min_offs = offs;
-@@ -522,11 +638,159 @@ static size_t ext4_xattr_free_space(stru
-       return (*min_offs - ((void *)last - base) - sizeof(__u32));
- }
-+/*
-+ * Write the value of the EA in an inode.
-+ */
-+static int
-+ext4_xattr_inode_write(handle_t *handle, struct inode *ea_inode,
-+                     const void *buf, int bufsize)
-+{
-+      struct buffer_head *bh = NULL, dummy;
-+      unsigned long block = 0;
-+      unsigned blocksize = ea_inode->i_sb->s_blocksize;
-+      unsigned max_blocks = (bufsize + blocksize - 1) >> ea_inode->i_blkbits;
-+      int csize, wsize = 0;
-+      int ret = 0;
-+      int retries = 0;
-+
-+retry:
-+      while (ret >= 0 && ret < max_blocks) {
-+              block += ret;
-+              max_blocks -= ret;
-+
-+              ret = ext4_get_blocks(handle, ea_inode, block, max_blocks,
-+                                    &dummy, EXT4_GET_BLOCKS_CREATE);
-+              if (ret <= 0) {
-+                      ext4_mark_inode_dirty(handle, ea_inode);
-+                      if (ret == -ENOSPC &&
-+                          ext4_should_retry_alloc(ea_inode->i_sb, &retries)) {
-+                              ret = 0;
-+                              goto retry;
-+                      }
-+                      break;
-+              }
-+      }
-+
-+      if (ret < 0)
-+              return ret;
-+
-+      block = 0;
-+      while (wsize < bufsize) {
-+              if (bh != NULL)
-+                      brelse(bh);
-+              csize = (bufsize - wsize) > blocksize ? blocksize :
-+                                                              bufsize - wsize;
-+              bh = ext4_getblk(handle, ea_inode, block, 0, &ret);
-+              if (!bh)
-+                      goto out;
-+              ret = ext4_journal_get_write_access(handle, bh);
-+              if (ret)
-+                      goto out;
-+
-+              memcpy(bh->b_data, buf, csize);
-+              set_buffer_uptodate(bh);
-+              ext4_handle_dirty_metadata(handle, ea_inode, bh);
-+
-+              buf += csize;
-+              wsize += csize;
-+              block += 1;
-+      }
-+
-+      i_size_write(ea_inode, wsize);
-+      ext4_update_i_disksize(ea_inode, wsize);
-+
-+      ext4_mark_inode_dirty(handle, ea_inode);
-+
-+out:
-+      brelse(bh);
-+
-+      return ret;
-+}
-+
-+/*
-+ * Create an inode to store the value of a large EA.
-+ */
-+static struct inode *
-+ext4_xattr_inode_create(handle_t *handle, struct inode *inode)
-+{
-+      struct inode *ea_inode = NULL;
-+
-+      /*
-+       * Let the next inode be the goal, so we try and allocate the EA inode
-+       * in the same group, or nearby one.
-+       */
-+      ea_inode = ext4_new_inode(handle, inode->i_sb->s_root->d_inode,
-+                                S_IFREG|0600, NULL, inode->i_ino + 1);
-+
-+      if (!IS_ERR(ea_inode)) {
-+              ea_inode->i_op = &ext4_file_inode_operations;
-+              ea_inode->i_fop = &ext4_file_operations;
-+              ext4_set_aops(ea_inode);
-+              ea_inode->i_generation = inode->i_generation;
-+              EXT4_I(ea_inode)->i_flags |= EXT4_EA_INODE_FL;
-+
-+              /*
-+               * A back-pointer from EA inode to parent inode will be useful
-+               * for e2fsck.
-+               */
-+              EXT4_XATTR_INODE_SET_PARENT(ea_inode, inode->i_ino);
-+              unlock_new_inode(ea_inode);
-+      }
-+
-+      return ea_inode;
-+}
-+
-+/*
-+ * Unlink the inode storing the value of the EA.
-+ */
-+int
-+ext4_xattr_inode_unlink(struct inode *inode, unsigned long ea_ino)
-+{
-+      struct inode *ea_inode = NULL;
-+      int err;
-+
-+      ea_inode = ext4_xattr_inode_iget(inode, ea_ino, &err);
-+      if (err)
-+              return err;
-+
-+      ea_inode->i_nlink = 0;
-+      iput(ea_inode);
-+
-+      return 0;
-+}
-+
-+/*
-+ * Add value of the EA in an inode.
-+ */
-+static int
-+ext4_xattr_inode_set(handle_t *handle, struct inode *inode, unsigned long *ea_ino,
-+                   const void *value, size_t value_len)
-+{
-+      struct inode *ea_inode = NULL;
-+      int err;
-+
-+      /* Create an inode for the EA value */
-+      ea_inode = ext4_xattr_inode_create(handle, inode);
-+      if (IS_ERR(ea_inode))
-+              return -1;
-+
-+      err = ext4_xattr_inode_write(handle, ea_inode, value, value_len);
-+      if (err)
-+              ea_inode->i_nlink = 0;
-+      else
-+              *ea_ino = ea_inode->i_ino;
-+
-+      iput(ea_inode);
-+
-+      return err;
-+}
-+
- struct ext4_xattr_info {
--      int name_index;
-       const char *name;
-       const void *value;
-       size_t value_len;
-+      int name_index;
-+      int in_inode;
- };
- struct ext4_xattr_search {
-@@ -538,15 +802,23 @@ struct ext4_xattr_search {
- };
- static int
--ext4_xattr_set_entry(struct ext4_xattr_info *i, struct ext4_xattr_search *s)
-+ext4_xattr_set_entry(struct ext4_xattr_info *i, struct ext4_xattr_search *s,
-+                   handle_t *handle, struct inode *inode)
- {
-       struct ext4_xattr_entry *last;
-       size_t free, min_offs = s->end - s->base, name_len = strlen(i->name);
-+      int in_inode = i->in_inode;
-+
-+      if (EXT4_HAS_INCOMPAT_FEATURE(inode->i_sb,
-+               EXT4_FEATURE_INCOMPAT_EA_INODE) &&
-+          (EXT4_XATTR_SIZE(i->value_len) >
-+           EXT4_XATTR_MIN_LARGE_EA_SIZE(inode->i_sb->s_blocksize)))
-+              in_inode = 1;
-       /* Compute min_offs and last. */
-       last = s->first;
-       for (; !IS_LAST_ENTRY(last); last = EXT4_XATTR_NEXT(last)) {
--              if (!last->e_value_block && last->e_value_size) {
-+              if (!last->e_value_inum && last->e_value_size) {
-                       size_t offs = le16_to_cpu(last->e_value_offs);
-                       if (offs < min_offs)
-                               min_offs = offs;
-@@ -554,16 +826,21 @@ ext4_xattr_set_entry(struct ext4_xattr_i
-       }
-       free = min_offs - ((void *)last - s->base) - sizeof(__u32);
-       if (!s->not_found) {
--              if (!s->here->e_value_block && s->here->e_value_size) {
-+              if (!in_inode &&
-+                  !s->here->e_value_inum && s->here->e_value_size) {
-                       size_t size = le32_to_cpu(s->here->e_value_size);
-                       free += EXT4_XATTR_SIZE(size);
-               }
-               free += EXT4_XATTR_LEN(name_len);
-       }
-       if (i->value) {
--              if (free < EXT4_XATTR_SIZE(i->value_len) ||
--                  free < EXT4_XATTR_LEN(name_len) +
--                         EXT4_XATTR_SIZE(i->value_len))
-+              size_t value_len = EXT4_XATTR_SIZE(i->value_len);
-+
-+              if (in_inode)
-+                      value_len = 0;
-+
-+              if (free < value_len ||
-+                  free < EXT4_XATTR_LEN(name_len) + value_len)
-                       return -ENOSPC;
-       }
-@@ -577,7 +854,8 @@ ext4_xattr_set_entry(struct ext4_xattr_i
-               s->here->e_name_len = name_len;
-               memcpy(s->here->e_name, i->name, name_len);
-       } else {
--              if (!s->here->e_value_block && s->here->e_value_size) {
-+              if (!s->here->e_value_inum && s->here->e_value_size &&
-+                  s->here->e_value_offs > 0) {
-                       void *first_val = s->base + min_offs;
-                       size_t offs = le16_to_cpu(s->here->e_value_offs);
-                       void *val = s->base + offs;
-@@ -606,13 +884,18 @@ ext4_xattr_set_entry(struct ext4_xattr_i
-                       last = s->first;
-                       while (!IS_LAST_ENTRY(last)) {
-                               size_t o = le16_to_cpu(last->e_value_offs);
--                              if (!last->e_value_block &&
-+                              if (!last->e_value_inum &&
-                                   last->e_value_size && o < offs)
-                                       last->e_value_offs =
-                                               cpu_to_le16(o + size);
-                               last = EXT4_XATTR_NEXT(last);
-                       }
-               }
-+              if (s->here->e_value_inum) {
-+                      ext4_xattr_inode_unlink(inode,
-+                                      le32_to_cpu(s->here->e_value_inum));
-+                      s->here->e_value_inum = 0;
-+              }
-               if (!i->value) {
-                       /* Remove the old name. */
-                       size_t size = EXT4_XATTR_LEN(name_len);
-@@ -626,10 +908,17 @@ ext4_xattr_set_entry(struct ext4_xattr_i
-       if (i->value) {
-               /* Insert the new value. */
-               s->here->e_value_size = cpu_to_le32(i->value_len);
--              if (i->value_len) {
-+              if (in_inode) {
-+                      unsigned long ea_ino = le32_to_cpu(s->here->e_value_inum);
-+                      ext4_xattr_inode_set(handle, inode, &ea_ino, i->value,
-+                                           i->value_len);
-+                      s->here->e_value_inum = cpu_to_le32(ea_ino);
-+                      s->here->e_value_offs = 0;
-+              } else if (i->value_len) {
-                       size_t size = EXT4_XATTR_SIZE(i->value_len);
-                       void *val = s->base + min_offs - size;
-                       s->here->e_value_offs = cpu_to_le16(min_offs - size);
-+                      s->here->e_value_inum = 0;
-                       memset(val + size - EXT4_XATTR_PAD, 0,
-                              EXT4_XATTR_PAD); /* Clear the pad bytes. */
-                       memcpy(val, i->value, i->value_len);
-@@ -674,7 +963,7 @@ ext4_xattr_block_find(struct inode *inod
-               bs->s.end = bs->bh->b_data + bs->bh->b_size;
-               bs->s.here = bs->s.first;
-               error = ext4_xattr_find_entry(&bs->s.here, i->name_index,
--                                            i->name, bs->bh->b_size, 1);
-+                                           i->name, bs->bh->b_size, 1, inode);
-               if (error && error != -ENODATA)
-                       goto cleanup;
-               bs->s.not_found = error;
-@@ -698,8 +987,6 @@ ext4_xattr_block_set(handle_t *handle, s
- #define header(x) ((struct ext4_xattr_header *)(x))
--      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);
-@@ -714,7 +1001,7 @@ ext4_xattr_block_set(handle_t *handle, s
-                               ce = NULL;
-                       }
-                       ea_bdebug(bs->bh, "modifying in-place");
--                      error = ext4_xattr_set_entry(i, s);
-+                      error = ext4_xattr_set_entry(i, s, handle, inode);
-                       if (!error) {
-                               if (!IS_LAST_ENTRY(s->first))
-                                       ext4_xattr_rehash(header(s->base),
-@@ -766,7 +1053,7 @@ ext4_xattr_block_set(handle_t *handle, s
-               s->end = s->base + sb->s_blocksize;
-       }
--      error = ext4_xattr_set_entry(i, s);
-+      error = ext4_xattr_set_entry(i, s, handle, inode);
-       if (error == -EIO)
-               goto bad_block;
-       if (error)
-@@ -917,7 +1204,7 @@ ext4_xattr_ibody_find(struct inode *inod
-               /* Find the named attribute. */
-               error = ext4_xattr_find_entry(&is->s.here, i->name_index,
-                                             i->name, is->s.end -
--                                            (void *)is->s.base, 0);
-+                                            (void *)is->s.base, 0, inode);
-               if (error && error != -ENODATA)
-                       return error;
-               is->s.not_found = error;
-@@ -936,7 +1223,7 @@ ext4_xattr_ibody_set(handle_t *handle, s
-       if (EXT4_I(inode)->i_extra_isize == 0)
-               return -ENOSPC;
--      error = ext4_xattr_set_entry(i, s);
-+      error = ext4_xattr_set_entry(i, s, handle, inode);
-       if (error)
-               return error;
-       header = IHDR(inode, ext4_raw_inode(&is->iloc));
-@@ -972,7 +1259,7 @@ ext4_xattr_set_handle(handle_t *handle, 
-               .name = name,
-               .value = value,
-               .value_len = value_len,
--
-+              .in_inode = 0,
-       };
-       struct ext4_xattr_ibody_find is = {
-               .s = { .not_found = -ENODATA, },
-@@ -1041,6 +1328,15 @@ ext4_xattr_set_handle(handle_t *handle, 
-                                       goto cleanup;
-                       }
-                       error = ext4_xattr_block_set(handle, inode, &i, &bs);
-+                      if (EXT4_HAS_INCOMPAT_FEATURE(inode->i_sb,
-+                                      EXT4_FEATURE_INCOMPAT_EA_INODE) &&
-+                          error == -ENOSPC) {
-+                              /* xattr not fit to block, store at external
-+                               * inode */
-+                              i.in_inode = 1;
-+                              error = ext4_xattr_ibody_set(handle, inode,
-+                                                           &i, &is);
-+                      }
-                       if (error)
-                               goto cleanup;
-                       if (!is.s.not_found) {
-@@ -1087,10 +1383,25 @@ ext4_xattr_set(struct inode *inode, int 
-              const void *value, size_t value_len, int flags)
- {
-       handle_t *handle;
-+      struct super_block *sb = inode->i_sb;
-+      int buffer_credits;
-       int error, retries = 0;
-+      buffer_credits = EXT4_DATA_TRANS_BLOCKS(sb);
-+      if ((value_len >= EXT4_XATTR_MIN_LARGE_EA_SIZE(sb->s_blocksize)) &&
-+          EXT4_HAS_INCOMPAT_FEATURE(sb, EXT4_FEATURE_INCOMPAT_EA_INODE)) {
-+              int nrblocks = (value_len + sb->s_blocksize - 1) >>
-+                                      sb->s_blocksize_bits;
-+
-+              /* For new inode */
-+              buffer_credits += EXT4_SINGLEDATA_TRANS_BLOCKS(sb) + 3;
-+
-+              /* For data blocks of EA inode */
-+              buffer_credits += ext4_meta_trans_blocks(inode, nrblocks, 0);
-+      }
-+
- retry:
--      handle = ext4_journal_start(inode, EXT4_DATA_TRANS_BLOCKS(inode->i_sb));
-+      handle = ext4_journal_start(inode, buffer_credits);
-       if (IS_ERR(handle)) {
-               error = PTR_ERR(handle);
-       } else {
-@@ -1100,7 +1411,7 @@ retry:
-                                             value, value_len, flags);
-               error2 = ext4_journal_stop(handle);
-               if (error == -ENOSPC &&
--                  ext4_should_retry_alloc(inode->i_sb, &retries))
-+                  ext4_should_retry_alloc(sb, &retries))
-                       goto retry;
-               if (error == 0)
-                       error = error2;
-@@ -1122,7 +1433,7 @@ static void ext4_xattr_shift_entries(str
-       /* Adjust the value offsets of the entries */
-       for (; !IS_LAST_ENTRY(last); last = EXT4_XATTR_NEXT(last)) {
--              if (!last->e_value_block && last->e_value_size) {
-+              if (!last->e_value_inum && last->e_value_size) {
-                       new_offs = le16_to_cpu(last->e_value_offs) +
-                                                       value_offs_shift;
-                       BUG_ON(new_offs + le32_to_cpu(last->e_value_size)
-@@ -1355,22 +1666,135 @@ cleanup:
-       return error;
- }
-+#define EIA_INCR 16 /* must be 2^n */
-+#define EIA_MASK (EIA_INCR - 1)
-+/* Add the large xattr @ino into @lea_ino_array for later deletion.
-+ * If @lea_ino_array is new or full it will be grown and the old
-+ * contents copied over.
-+ */
-+static int
-+ext4_expand_ino_array(struct ext4_xattr_ino_array **lea_ino_array, __u32 ino)
-+{
-+      if (*lea_ino_array == NULL) {
-+              /*
-+               * Start with 15 inodes, so it fits into a power-of-two size.
-+               * If *lea_ino_array is NULL, this is essentially offsetof()
-+               */
-+              (*lea_ino_array) =
-+                      kmalloc(offsetof(struct ext4_xattr_ino_array,
-+                                       xia_inodes[EIA_MASK]),
-+                              GFP_NOFS);
-+              if (*lea_ino_array == NULL)
-+                      return -ENOMEM;
-+              (*lea_ino_array)->xia_count = 0;
-+      } else if (((*lea_ino_array)->xia_count & EIA_MASK) == EIA_MASK) {
-+              /* expand the array once all 15 + n * 16 slots are full */
-+              struct ext4_xattr_ino_array *new_array = NULL;
-+              int count = (*lea_ino_array)->xia_count;
-+
-+              /* if new_array is NULL, this is essentially offsetof() */
-+              new_array = kmalloc(
-+                              offsetof(struct ext4_xattr_ino_array,
-+                                       xia_inodes[count + EIA_INCR]),
-+                              GFP_NOFS);
-+              if (new_array == NULL)
-+                      return -ENOMEM;
-+              memcpy(new_array, *lea_ino_array,
-+                     offsetof(struct ext4_xattr_ino_array,
-+                              xia_inodes[count]));
-+              kfree(*lea_ino_array);
-+              *lea_ino_array = new_array;
-+      }
-+      (*lea_ino_array)->xia_inodes[(*lea_ino_array)->xia_count++] = ino;
-+      return 0;
-+}
-+/**
-+ * Add xattr inode to orphan list
-+ */
-+static int
-+ext4_xattr_inode_orphan_add(handle_t *handle, struct inode *inode,
-+                      int credits, struct ext4_xattr_ino_array *lea_ino_array)
-+{
-+      struct inode *ea_inode = NULL;
-+      int idx = 0, error = 0;
-+
-+      if (lea_ino_array == NULL)
-+              return 0;
-+
-+      for (; idx < lea_ino_array->xia_count; ++idx) {
-+              if (!ext4_handle_has_enough_credits(handle, credits)) {
-+                      error = ext4_journal_extend(handle, credits);
-+                      if (error > 0)
-+                              error = ext4_journal_restart(handle, credits);
-+
-+                      if (error != 0) {
-+                              ext4_warning(inode->i_sb,
-+                                      "couldn't extend journal "
-+                                      "(err %d)", error);
-+                              return error;
-+                      }
-+              }
-+              ea_inode = ext4_xattr_inode_iget(inode,
-+                              lea_ino_array->xia_inodes[idx], &error);
-+              if (error)
-+                      continue;
-+              ext4_orphan_add(handle, ea_inode);
-+              /* the inode's i_count will be released by caller */
-+      }
-+
-+      return 0;
-+}
- /*
-  * ext4_xattr_delete_inode()
-  *
-- * Free extended attribute resources associated with this inode. This
-+ * Free extended attribute resources associated with this inode. Traverse
-+ * all entries and unlink any xattr inodes associated with this inode. This
-  * is called immediately before an inode is freed. We have exclusive
-- * access to the inode.
-+ * access to the inode. If an orphan inode is deleted it will also delete any
-+ * xattr block and all xattr inodes. They are checked by ext4_xattr_inode_iget()
-+ * to ensure they belong to the parent inode and were not deleted already.
-  */
--void
--ext4_xattr_delete_inode(handle_t *handle, struct inode *inode)
-+int
-+ext4_xattr_delete_inode(handle_t *handle, struct inode *inode,
-+                      struct ext4_xattr_ino_array **lea_ino_array)
- {
-       struct buffer_head *bh = NULL;
-+      struct ext4_xattr_ibody_header *header;
-+      struct ext4_inode *raw_inode;
-+      struct ext4_iloc iloc;
-+      struct ext4_xattr_entry *entry;
-+      int credits = 3, error = 0;
--      if (!EXT4_I(inode)->i_file_acl)
-+      if (!ext4_test_inode_state(inode, EXT4_STATE_XATTR))
-+              goto delete_external_ea;
-+
-+      error = ext4_get_inode_loc(inode, &iloc);
-+      if (error)
-+              goto cleanup;
-+      raw_inode = ext4_raw_inode(&iloc);
-+      header = IHDR(inode, raw_inode);
-+      for (entry = IFIRST(header); !IS_LAST_ENTRY(entry);
-+           entry = EXT4_XATTR_NEXT(entry)) {
-+              if (!entry->e_value_inum)
-+                      continue;
-+              if (ext4_expand_ino_array(lea_ino_array,
-+                                        entry->e_value_inum) != 0) {
-+                      brelse(iloc.bh);
-+                      goto cleanup;
-+              }
-+              entry->e_value_inum = 0;
-+      }
-+      brelse(iloc.bh);
-+
-+delete_external_ea:
-+      if (!EXT4_I(inode)->i_file_acl) {
-+              /* add xattr inode to orphan list */
-+              ext4_xattr_inode_orphan_add(handle, inode, credits,
-+                                              *lea_ino_array);
-               goto cleanup;
-+      }
-       bh = sb_bread(inode->i_sb, EXT4_I(inode)->i_file_acl);
-       if (!bh) {
-               ext4_error(inode->i_sb, "inode %lu: block %llu read error",
-@@ -1383,11 +1807,71 @@ ext4_xattr_delete_inode(handle_t *handle
-                          inode->i_ino, EXT4_I(inode)->i_file_acl);
-               goto cleanup;
-       }
-+
-+      for (entry = BFIRST(bh); !IS_LAST_ENTRY(entry);
-+           entry = EXT4_XATTR_NEXT(entry)) {
-+              if (!entry->e_value_inum)
-+                      continue;
-+              if (ext4_expand_ino_array(lea_ino_array,
-+                                        entry->e_value_inum) != 0)
-+                      goto cleanup;
-+              entry->e_value_inum = 0;
-+      }
-+
-+      /* add xattr inode to orphan list */
-+      error = ext4_xattr_inode_orphan_add(handle, inode, credits,
-+                                      *lea_ino_array);
-+      if (error != 0)
-+              goto cleanup;
-+
-+      if (!IS_NOQUOTA(inode))
-+              credits += 2 * EXT4_QUOTA_DEL_BLOCKS(inode->i_sb);
-+
-+      if (!ext4_handle_has_enough_credits(handle, credits)) {
-+              error = ext4_journal_extend(handle, credits);
-+              if (error > 0)
-+                      error = ext4_journal_restart(handle, credits);
-+              if (error != 0) {
-+                      ext4_warning(inode->i_sb,
-+                              "couldn't extend journal (err %d)", error);
-+                      goto cleanup;
-+              }
-+      }
-+
-       ext4_xattr_release_block(handle, inode, bh);
-       EXT4_I(inode)->i_file_acl = 0;
- cleanup:
-       brelse(bh);
-+
-+      return error;
-+}
-+
-+void
-+ext4_xattr_inode_array_free(struct inode *inode,
-+                          struct ext4_xattr_ino_array *lea_ino_array)
-+{
-+      struct inode    *ea_inode = NULL;
-+      int             idx = 0;
-+      int             err;
-+
-+      if (lea_ino_array == NULL)
-+              return;
-+
-+      for (; idx < lea_ino_array->xia_count; ++idx) {
-+              ea_inode = ext4_xattr_inode_iget(inode,
-+                              lea_ino_array->xia_inodes[idx], &err);
-+              if (err)
-+                      continue;
-+
-+              /* for inode's i_count get from ext4_xattr_delete_inode */
-+              if (!list_empty(&EXT4_I(ea_inode)->i_orphan))
-+                      iput(ea_inode);
-+
-+              ea_inode->i_nlink = 0;
-+              iput(ea_inode);
-+      }
-+      kfree(lea_ino_array);
- }
- /*
-@@ -1457,10 +1941,9 @@ ext4_xattr_cmp(struct ext4_xattr_header 
-                   entry1->e_name_index != entry2->e_name_index ||
-                   entry1->e_name_len != entry2->e_name_len ||
-                   entry1->e_value_size != entry2->e_value_size ||
-+                  entry1->e_value_inum != entry2->e_value_inum ||
-                   memcmp(entry1->e_name, entry2->e_name, entry1->e_name_len))
-                       return 1;
--              if (entry1->e_value_block != 0 || entry2->e_value_block != 0)
--                      return -EIO;
-               if (memcmp((char *)header1 + le16_to_cpu(entry1->e_value_offs),
-                          (char *)header2 + le16_to_cpu(entry2->e_value_offs),
-                          le32_to_cpu(entry1->e_value_size)))
-@@ -1545,7 +2028,7 @@ static inline void ext4_xattr_hash_entry
-                      *name++;
-       }
--      if (entry->e_value_block == 0 && entry->e_value_size != 0) {
-+      if (!entry->e_value_inum && entry->e_value_size) {
-               __le32 *value = (__le32 *)((char *)header +
-                       le16_to_cpu(entry->e_value_offs));
-               for (n = (le32_to_cpu(entry->e_value_size) +
-Index: linux-stage/fs/ext4/xattr.h
-===================================================================
---- linux-stage.orig/fs/ext4/xattr.h
-+++ linux-stage/fs/ext4/xattr.h
-@@ -38,7 +38,7 @@ struct ext4_xattr_entry {
-       __u8    e_name_len;     /* length of name */
-       __u8    e_name_index;   /* attribute name index */
-       __le16  e_value_offs;   /* offset in disk block of value */
--      __le32  e_value_block;  /* disk block attribute is stored on (n/i) */
-+      __le32  e_value_inum;   /* inode in which the value is stored */
-       __le32  e_value_size;   /* size of attribute value */
-       __le32  e_hash;         /* hash value of name and value */
-       char    e_name[0];      /* attribute name */
-@@ -63,6 +63,26 @@ struct ext4_xattr_entry {
-               EXT4_I(inode)->i_extra_isize))
- #define IFIRST(hdr) ((struct ext4_xattr_entry *)((hdr)+1))
-+/*
-+ * Link EA inode back to parent one using i_mtime field.
-+ * Extra integer type conversion added to ignore higher
-+ * bits in i_mtime.tv_sec which might be set by ext4_get()
-+ */
-+#define EXT4_XATTR_INODE_SET_PARENT(inode, inum)      \
-+do {                                                  \
-+      (inode)->i_mtime.tv_sec = inum;                 \
-+} while(0)
-+
-+#define EXT4_XATTR_INODE_GET_PARENT(inode)            \
-+((__u32)(inode)->i_mtime.tv_sec)
-+
-+/*
-+ * The minimum size of EA value when you start storing it in an external inode
-+ * size of block - size of header - size of 1 entry - 4 null bytes
-+*/
-+#define EXT4_XATTR_MIN_LARGE_EA_SIZE(b)                                       \
-+      ((b) - EXT4_XATTR_LEN(3) - sizeof(struct ext4_xattr_header) - 4)
-+
- # ifdef CONFIG_EXT4_FS_XATTR
- extern struct xattr_handler ext4_xattr_user_handler;
-@@ -77,7 +86,13 @@ extern int ext4_xattr_get(struct inode *
- extern int ext4_xattr_set(struct inode *, int, const char *, const void *, size_t, int);
- extern int ext4_xattr_set_handle(handle_t *, struct inode *, int, const char *, const void *, size_t, int);
--extern void ext4_xattr_delete_inode(handle_t *, struct inode *);
-+extern struct inode *ext4_xattr_inode_iget(struct inode *parent, unsigned long ea_ino,
-+                                         int *err);
-+extern int ext4_xattr_inode_unlink(struct inode *inode, unsigned long ea_ino);
-+extern int ext4_xattr_delete_inode(handle_t *handle, struct inode *inode,
-+                                 struct ext4_xattr_ino_array **array);
-+extern void ext4_xattr_inode_array_free(struct inode *inode,
-+                                      struct ext4_xattr_ino_array *array);
- extern void ext4_xattr_put_super(struct super_block *);
- extern int ext4_expand_extra_isize_ea(struct inode *inode, int new_extra_isize,
-@@ -111,9 +126,11 @@ ext4_xattr_set_handle(handle_t *handle, 
-       return -EOPNOTSUPP;
- }
--static inline void
--ext4_xattr_delete_inode(handle_t *handle, struct inode *inode)
-+inline int
-+ext4_xattr_delete_inode(handle_t *handle, struct inode *inode,
-+                      struct ext4_xattr_ino_array **array)
- {
-+      return -EOPNOTSUPP;
- }
- static inline void
-Index: linux-stage/fs/ext4/inode.c
-===================================================================
---- linux-stage.orig/fs/ext4/inode.c
-+++ linux-stage/fs/ext4/inode.c
-@@ -222,6 +222,8 @@ void ext4_delete_inode(struct inode *ino
- {
-       handle_t *handle;
-       int err;
-+      int extra_credits = 3;
-+      struct ext4_xattr_ino_array *lea_ino_array = NULL;
-       if (ext4_should_order_data(inode))
-               ext4_begin_ordered_truncate(inode, 0);
-@@ -235,7 +237,8 @@ void ext4_delete_inode(struct inode *ino
-        * protection against it
-        */
-       sb_start_intwrite(inode->i_sb);
--      handle = ext4_journal_start(inode, blocks_for_truncate(inode)+3);
-+
-+      handle = ext4_journal_start(inode, extra_credits);
-       if (IS_ERR(handle)) {
-               ext4_std_error(inode->i_sb, PTR_ERR(handle));
-               /*
-@@ -247,9 +250,36 @@ void ext4_delete_inode(struct inode *ino
-               sb_end_intwrite(inode->i_sb);
-               goto no_delete;
-       }
--
-       if (IS_SYNC(inode))
-               ext4_handle_sync(handle);
-+
-+      /*
-+       * Delete xattr inode before deleting the main inode.
-+       */
-+      err = ext4_xattr_delete_inode(handle, inode, &lea_ino_array);
-+      if (err) {
-+              ext4_warning(inode->i_sb,
-+                           "couldn't delete inode's xattr (err %d)", err);
-+              goto stop_handle;
-+      }
-+
-+      if (!IS_NOQUOTA(inode))
-+              extra_credits += 2 * EXT4_QUOTA_DEL_BLOCKS(inode->i_sb);
-+
-+      if (!ext4_handle_has_enough_credits(handle,
-+                              blocks_for_truncate(inode) + extra_credits)) {
-+              err = ext4_journal_extend(handle,
-+                              blocks_for_truncate(inode) + extra_credits);
-+              if (err > 0)
-+                      err = ext4_journal_restart(handle,
-+                              blocks_for_truncate(inode) + extra_credits);
-+              if (err != 0) {
-+                      ext4_warning(inode->i_sb,
-+                                   "couldn't extend journal (err %d)", err);
-+                      goto stop_handle;
-+              }
-+      }
-+
-       inode->i_size = 0;
-       err = ext4_mark_inode_dirty(handle, inode);
-       if (err) {
-@@ -266,10 +296,10 @@ void ext4_delete_inode(struct inode *ino
-        * enough credits left in the handle to remove the inode from
-        * the orphan list and set the dtime field.
-        */
--      if (!ext4_handle_has_enough_credits(handle, 3)) {
--              err = ext4_journal_extend(handle, 3);
-+      if (!ext4_handle_has_enough_credits(handle, extra_credits)) {
-+              err = ext4_journal_extend(handle, extra_credits);
-               if (err > 0)
--                      err = ext4_journal_restart(handle, 3);
-+                      err = ext4_journal_restart(handle, extra_credits);
-               if (err != 0) {
-                       ext4_warning(inode->i_sb,
-                                    "couldn't extend journal (err %d)", err);
-@@ -303,8 +333,12 @@ void ext4_delete_inode(struct inode *ino
-               clear_inode(inode);
-       else
-               ext4_free_inode(handle, inode);
-+
-       ext4_journal_stop(handle);
-       sb_end_intwrite(inode->i_sb);
-+
-+      if (lea_ino_array != NULL)
-+              ext4_xattr_inode_array_free(inode, lea_ino_array);
-       return;
- no_delete:
-       clear_inode(inode);     /* We must guarantee clearing of inode... */
-Index: linux-stage/fs/ext4/ialloc.c
-===================================================================
---- linux-stage.orig/fs/ext4/ialloc.c
-+++ linux-stage/fs/ext4/ialloc.c
-@@ -219,7 +219,6 @@ void ext4_free_inode(handle_t *handle, s
-        * as writing the quota to disk may need the lock as well.
-        */
-       vfs_dq_init(inode);
--      ext4_xattr_delete_inode(handle, inode);
-       vfs_dq_free_inode(inode);
-       vfs_dq_drop(inode);
diff --git a/ldiskfs/kernel_patches/patches/rhel6.3/ext4-lookup-dotdot.patch b/ldiskfs/kernel_patches/patches/rhel6.3/ext4-lookup-dotdot.patch
deleted file mode 100644 (file)
index 4bc588b..0000000
+++ /dev/null
@@ -1,43 +0,0 @@
-Index: linux-2.6.18.i386/fs/ext4/namei.c
-===================================================================
---- linux-2.6.18.i386.orig/fs/ext4/namei.c
-+++ linux-2.6.18.i386/fs/ext4/namei.c
-@@ -1067,6 +1067,38 @@ static struct dentry *ext4_lookup(struct
-                       }
-               }
-       }
-+      /* ".." shouldn't go into dcache to preserve dcache hierarchy
-+       * otherwise we'll get parent being a child of actual child.
-+       * see bug 10458 for details -bzzz */
-+      if (inode && (dentry->d_name.name[0] == '.' && (dentry->d_name.len == 1 ||
-+              (dentry->d_name.len == 2 && dentry->d_name.name[1] == '.')))) {
-+              struct dentry *tmp, *goal = NULL;
-+              struct list_head *lp;
-+
-+              /* first, look for an existing dentry - any one is good */
-+              spin_lock(&dcache_lock);
-+              list_for_each(lp, &inode->i_dentry) {
-+                      tmp = list_entry(lp, struct dentry, d_alias);
-+                      goal = tmp;
-+                      dget_locked(goal);
-+                      break;
-+              }
-+              if (goal == NULL) {
-+                      /* there is no alias, we need to make current dentry:
-+                       *  a) inaccessible for __d_lookup()
-+                       *  b) inaccessible for iopen */
-+                      J_ASSERT(list_empty(&dentry->d_alias));
-+                      dentry->d_flags |= DCACHE_NFSFS_RENAMED;
-+                      /* this is d_instantiate() ... */
-+                      list_add(&dentry->d_alias, &inode->i_dentry);
-+                      dentry->d_inode = inode;
-+              }
-+              spin_unlock(&dcache_lock);
-+              if (goal)
-+                      iput(inode);
-+              return goal;
-+      }
-+
-       return d_splice_alias(inode, dentry);
- }
diff --git a/ldiskfs/kernel_patches/patches/rhel6.3/ext4-map_inode_page-2.6.18.patch b/ldiskfs/kernel_patches/patches/rhel6.3/ext4-map_inode_page-2.6.18.patch
deleted file mode 100644 (file)
index 22e67c0..0000000
+++ /dev/null
@@ -1,78 +0,0 @@
-diff -ur a/fs/ext4/ext4.h b/fs/ext4/ext4.h
---- a/fs/ext4/ext4.h   2013-03-14 12:04:44.105541822 -0400
-+++ b/fs/ext4/ext4.h   2013-03-14 12:09:14.264489405 -0400
-@@ -1661,6 +1661,8 @@
- extern int ext4_block_truncate_page(handle_t *handle,
-               struct address_space *mapping, loff_t from);
- extern int ext4_page_mkwrite(struct vm_area_struct *vma, struct vm_fault *vmf);
-+extern int ext4_map_inode_page(struct inode *inode, struct page *page,
-+                              sector_t *blocks, int create);
- extern qsize_t *ext4_get_reserved_space(struct inode *inode);
- extern int flush_aio_dio_completed_IO(struct inode *inode);
- extern void ext4_da_update_reserve_space(struct inode *inode,
-diff -ur a/fs/ext4/inode.c b/fs/ext4/inode.c
---- a/fs/ext4/inode.c  2013-03-14 12:04:44.103541330 -0400
-+++ b/fs/ext4/inode.c  2013-03-14 12:11:16.526353498 -0400
-@@ -6131,3 +6131,62 @@
- out:
-         return ret;
- }
-+
-+int ext4_map_inode_page(struct inode *inode, struct page *page,
-+                      sector_t *blocks, int create)
-+{
-+      unsigned int blocksize, blocks_per_page;
-+      unsigned long iblock;
-+      struct buffer_head dummy;
-+      void *handle;
-+      int i, rc = 0, failed = 0, needed_blocks;
-+
-+      blocksize = inode->i_sb->s_blocksize;
-+      blocks_per_page = PAGE_SIZE >> inode->i_sb->s_blocksize_bits;
-+      iblock = page->index * blocks_per_page;
-+
-+      for (i = 0; i < blocks_per_page; i++, iblock++) {
-+              blocks[i] = ext4_bmap(inode->i_mapping, iblock);
-+              if (blocks[i] == 0) {
-+                      failed++;
-+              }
-+      }
-+
-+      if (failed == 0 || create == 0)
-+              return 0;
-+
-+      needed_blocks = ext4_writepage_trans_blocks(inode);
-+      handle = ext4_journal_start(inode, needed_blocks);
-+      if (IS_ERR(handle))
-+              return PTR_ERR(handle);
-+
-+      iblock = page->index * blocks_per_page;
-+      for (i = 0; i < blocks_per_page; i++, iblock++) {
-+              if (blocks[i] != 0)
-+                      continue;
-+
-+              rc = ext4_ind_get_blocks(handle, inode, iblock, 1, &dummy,
-+                                       EXT4_GET_BLOCKS_CREATE);
-+              if (rc < 0) {
-+                      printk(KERN_INFO "ext4_map_inode_page: error reading "
-+                                      "block %ld\n", iblock);
-+                      goto out;
-+              } else {
-+                      if (rc > 1)
-+                              WARN_ON(1);
-+                      rc = 0;
-+              }
-+              /* Unmap any metadata buffers from the block mapping, to avoid
-+               * data corruption due to direct-write from Lustre being
-+               * clobbered by a later flush of the blockdev metadata buffer.*/
-+              if (buffer_new(&dummy))
-+                      unmap_underlying_metadata(dummy.b_bdev,
-+                                      dummy.b_blocknr);
-+              blocks[i] = dummy.b_blocknr;
-+      }
-+
-+out:
-+      ext4_journal_stop(handle);
-+      return rc;
-+}
-+EXPORT_SYMBOL(ext4_map_inode_page);
diff --git a/ldiskfs/kernel_patches/patches/rhel6.3/ext4-max-dir-size-options.patch b/ldiskfs/kernel_patches/patches/rhel6.3/ext4-max-dir-size-options.patch
deleted file mode 100644 (file)
index edb5726..0000000
+++ /dev/null
@@ -1,36 +0,0 @@
-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 10:29:34.125478791 -0400
-+++ linux-stage/fs/ext4/super.c        2013-05-13 10:31:59.800359005 -0400
-@@ -1264,8 +1264,8 @@ enum {
-       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_inode_table, Opt_noinit_inode_table,
-+      Opt_max_dir_size_kb,
- };
- static const match_table_t tokens = {
-@@ -1346,6 +1346,7 @@ static const match_table_t tokens = {
-       {Opt_init_inode_table, "init_itable=%u"},
-       {Opt_init_inode_table, "init_itable"},
-       {Opt_noinit_inode_table, "noinit_itable"},
-+      {Opt_max_dir_size_kb, "max_dir_size_kb=%u"},
-       {Opt_err, NULL},
- };
-@@ -1732,6 +1733,13 @@ set_qf_format:
-               case Opt_nodelalloc:
-                       clear_opt(sbi->s_mount_opt, DELALLOC);
-                       break;
-+              case Opt_max_dir_size_kb:
-+                      if (match_int(&args[0], &option))
-+                              return 0;
-+                      if (option < 0)
-+                              return 0;
-+                      sbi->s_max_dir_size = option * 1024;
-+                      break;
-               case Opt_stripe:
-                       if (match_int(&args[0], &option))
-                               return 0;
diff --git a/ldiskfs/kernel_patches/patches/rhel6.3/ext4-mballoc-extra-checks.patch b/ldiskfs/kernel_patches/patches/rhel6.3/ext4-mballoc-extra-checks.patch
deleted file mode 100644 (file)
index 4b3104f..0000000
+++ /dev/null
@@ -1,321 +0,0 @@
-Index: linux-stage/fs/ext4/ext4.h
-===================================================================
---- linux-stage.orig/fs/ext4/ext4.h    2011-03-14 16:18:28.300241437 +0800
-+++ linux-stage/fs/ext4/ext4.h 2011-03-14 16:33:17.056087375 +0800
-@@ -1770,6 +1770,7 @@
-       ext4_grpblk_t   bb_free;        /* total free blocks */
-       ext4_grpblk_t   bb_fragments;   /* nr of freespace fragments */
-       struct          list_head bb_prealloc_list;
-+      unsigned long   bb_prealloc_nr;
- #ifdef DOUBLE_CHECK
-       void            *bb_bitmap;
- #endif
-Index: linux-stage/fs/ext4/mballoc.c
-===================================================================
---- linux-stage.orig/fs/ext4/mballoc.c 2011-03-14 16:18:28.336242149 +0800
-+++ linux-stage/fs/ext4/mballoc.c      2011-03-14 16:33:27.072292006 +0800
-@@ -337,7 +337,7 @@
- static struct kmem_cache *ext4_pspace_cachep;
- static struct kmem_cache *ext4_ac_cachep;
- static struct kmem_cache *ext4_free_ext_cachep;
--static void ext4_mb_generate_from_pa(struct super_block *sb, void *bitmap,
-+static int ext4_mb_generate_from_pa(struct super_block *sb, void *bitmap,
-                                       ext4_group_t group);
- static void ext4_mb_generate_from_freelist(struct super_block *sb, void *bitmap,
-                                               ext4_group_t group);
-@@ -659,7 +659,7 @@
- }
- static noinline_for_stack
--void ext4_mb_generate_buddy(struct super_block *sb,
-+int ext4_mb_generate_buddy(struct super_block *sb,
-                               void *buddy, void *bitmap, ext4_group_t group)
- {
-       struct ext4_group_info *grp = ext4_get_group_info(sb, group);
-@@ -691,14 +691,13 @@
-       grp->bb_fragments = fragments;
-       if (free != grp->bb_free) {
--              ext4_grp_locked_error(sb, group,  __func__,
--                      "EXT4-fs: group %u: %u blocks in bitmap, %u in gd",
--                      group, free, grp->bb_free);
--              /*
--               * If we intent to continue, we consider group descritor
--               * corrupt and update bb_free using bitmap value
--               */
--              grp->bb_free = free;
-+              struct ext4_group_desc *gdp;
-+              gdp = ext4_get_group_desc (sb, group, NULL);
-+              ext4_error(sb, "group %lu: %u blocks in bitmap, %u in bb, "
-+                      "%u in gd, %lu pa's\n", (long unsigned int)group,
-+                      free, grp->bb_free, ext4_free_blks_count(sb, gdp),
-+                      grp->bb_prealloc_nr);
-+              return -EIO;
-       }
-       clear_bit(EXT4_GROUP_INFO_NEED_INIT_BIT, &(grp->bb_state));
-@@ -708,6 +707,8 @@
-       EXT4_SB(sb)->s_mb_buddies_generated++;
-       EXT4_SB(sb)->s_mb_generation_time += period;
-       spin_unlock(&EXT4_SB(sb)->s_bal_lock);
-+
-+      return 0;
- }
- /* The buddy information is attached the buddy cache inode
-@@ -839,7 +840,7 @@
-       err = 0;
-       first_block = page->index * blocks_per_page;
--      for (i = 0; i < blocks_per_page; i++) {
-+      for (i = 0; i < blocks_per_page && err == 0; i++) {
-               int group;
-               struct ext4_group_info *grinfo;
-@@ -874,7 +875,7 @@
-                       ext4_lock_group(sb, group);
-                       /* init the buddy */
-                       memset(data, 0xff, blocksize);
--                      ext4_mb_generate_buddy(sb, data, incore, group);
-+                      err = ext4_mb_generate_buddy(sb, data, incore, group);
-                       ext4_unlock_group(sb, group);
-                       incore = NULL;
-               } else {
-@@ -888,7 +889,7 @@
-                       memcpy(data, bitmap, blocksize);
-                       /* mark all preallocated blks used in in-core bitmap */
--                      ext4_mb_generate_from_pa(sb, data, group);
-+                      err = ext4_mb_generate_from_pa(sb, data, group);
-                       ext4_mb_generate_from_freelist(sb, data, group);
-                       ext4_unlock_group(sb, group);
-@@ -898,7 +899,8 @@
-                       incore = data;
-               }
-       }
--      SetPageUptodate(page);
-+      if (likely(err == 0))
-+              SetPageUptodate(page);
- out:
-       if (bh) {
-@@ -2142,9 +2144,11 @@
- static int ext4_mb_seq_groups_show(struct seq_file *seq, void *v)
- {
-       struct super_block *sb = seq->private;
-+      struct ext4_group_desc *gdp;
-       ext4_group_t group = (ext4_group_t) ((unsigned long) v);
-       int i;
-       int err;
-+      int free = 0;
-       struct ext4_buddy e4b;
-       struct sg {
-               struct ext4_group_info info;
-@@ -2153,10 +2157,10 @@
-       group--;
-       if (group == 0)
--              seq_printf(seq, "#%-5s: %-5s %-5s %-5s "
-+              seq_printf(seq, "#%-5s: %-5s %-5s %-5s %-5s %-5s"
-                               "[ %-5s %-5s %-5s %-5s %-5s %-5s %-5s "
-                                 "%-5s %-5s %-5s %-5s %-5s %-5s %-5s ]\n",
--                         "group", "free", "frags", "first",
-+                         "group", "free", "free", "frags", "first", "pa",
-                          "2^0", "2^1", "2^2", "2^3", "2^4", "2^5", "2^6",
-                          "2^7", "2^8", "2^9", "2^10", "2^11", "2^12", "2^13");
-@@ -2167,13 +2171,20 @@
-               seq_printf(seq, "#%-5u: I/O error\n", group);
-               return 0;
-       }
-+
-+      gdp = ext4_get_group_desc(sb, group, NULL);
-+      if (gdp != NULL)
-+              free = ext4_free_blks_count(sb, gdp);
-+
-       ext4_lock_group(sb, group);
-       memcpy(&sg, ext4_get_group_info(sb, group), i);
-       ext4_unlock_group(sb, group);
-       ext4_mb_release_desc(&e4b);
--      seq_printf(seq, "#%-5u: %-5u %-5u %-5u [", group, sg.info.bb_free,
--                      sg.info.bb_fragments, sg.info.bb_first_free);
-+      seq_printf(seq, "#%-5lu: %-5u %-5u %-5u %-5u %-5lu [",
-+                      (long unsigned int)group, sg.info.bb_free, free,
-+                      sg.info.bb_fragments, sg.info.bb_first_free,
-+                      sg.info.bb_prealloc_nr);
-       for (i = 0; i <= 13; i++)
-               seq_printf(seq, " %-5u", i <= sb->s_blocksize_bits + 1 ?
-                               sg.info.bb_counters[i] : 0);
-@@ -3354,23 +3365,72 @@
- }
- /*
-+ * check free blocks in bitmap match free block in group descriptor
-+ * do this before taking preallocated blocks into account to be able
-+ * to detect on-disk corruptions. The group lock should be hold by the
-+ * caller.
-+ */
-+int ext4_mb_check_ondisk_bitmap(struct super_block *sb, void *bitmap,
-+                              struct ext4_group_desc *gdp, int group)
-+{
-+      unsigned short max = EXT4_BLOCKS_PER_GROUP(sb);
-+      unsigned short i, first, free = 0;
-+      unsigned short free_in_gdp = ext4_free_blks_count(sb, gdp);
-+
-+      if (gdp->bg_flags & cpu_to_le16(EXT4_BG_BLOCK_UNINIT))
-+              return 0;
-+
-+      i = mb_find_next_zero_bit(bitmap, max, 0);
-+
-+      while (i < max) {
-+              first = i;
-+              i = mb_find_next_bit(bitmap, max, i);
-+              if (i > max)
-+                      i = max;
-+              free += i - first;
-+              if (i < max)
-+                      i = mb_find_next_zero_bit(bitmap, max, i);
-+      }
-+
-+      if (free != free_in_gdp) {
-+              ext4_error(sb, "on-disk bitmap for group %d"
-+                      "corrupted: %u blocks free in bitmap, %u - in gd\n",
-+                      group, free, free_in_gdp);
-+              return -EIO;
-+      }
-+      return 0;
-+}
-+
-+/*
-  * the function goes through all preallocation in this group and marks them
-  * used in in-core bitmap. buddy must be generated from this bitmap
-  * Need to be called with ext4 group lock held
-  */
- static noinline_for_stack
--void ext4_mb_generate_from_pa(struct super_block *sb, void *bitmap,
-+int ext4_mb_generate_from_pa(struct super_block *sb, void *bitmap,
-                                       ext4_group_t group)
- {
-       struct ext4_group_info *grp = ext4_get_group_info(sb, group);
-       struct ext4_prealloc_space *pa;
-+      struct ext4_group_desc *gdp;
-       struct list_head *cur;
-       ext4_group_t groupnr;
-       ext4_grpblk_t start;
-       int preallocated = 0;
-       int count = 0;
-+      int skip = 0;
-+      int err;
-       int len;
-+      gdp = ext4_get_group_desc (sb, group, NULL);
-+      if (gdp == NULL)
-+              return -EIO;
-+
-+      /* before applying preallocations, check bitmap consistency */
-+      err = ext4_mb_check_ondisk_bitmap(sb, bitmap, gdp, group);
-+      if (err)
-+              return err;
-+
-       /* all form of preallocation discards first load group,
-        * so the only competing code is preallocation use.
-        * we don't need any locking here
-@@ -3386,14 +3442,23 @@
-                                            &groupnr, &start);
-               len = pa->pa_len;
-               spin_unlock(&pa->pa_lock);
--              if (unlikely(len == 0))
-+              if (unlikely(len == 0)) {
-+                      skip++;
-                       continue;
-+              }
-               BUG_ON(groupnr != group);
-               mb_set_bits(bitmap, start, len);
-               preallocated += len;
-               count++;
-       }
-+      if (count + skip != grp->bb_prealloc_nr) {
-+              ext4_error(sb, "lost preallocations: "
-+                         "count %d, bb_prealloc_nr %lu, skip %d\n",
-+                         count, grp->bb_prealloc_nr, skip);
-+              return -EIO;
-+      }
-       mb_debug(1, "prellocated %u for group %u\n", preallocated, group);
-+      return 0;
- }
- static void ext4_mb_pa_callback(struct rcu_head *head)
-@@ -3452,6 +3517,7 @@
-        */
-       ext4_lock_group(sb, grp);
-       list_del(&pa->pa_group_list);
-+      ext4_get_group_info(sb, grp)->bb_prealloc_nr--;
-       ext4_unlock_group(sb, grp);
-       spin_lock(pa->pa_obj_lock);
-@@ -3543,6 +3609,7 @@
-       ext4_lock_group(sb, ac->ac_b_ex.fe_group);
-       list_add(&pa->pa_group_list, &grp->bb_prealloc_list);
-+      grp->bb_prealloc_nr++;
-       ext4_unlock_group(sb, ac->ac_b_ex.fe_group);
-       spin_lock(pa->pa_obj_lock);
-@@ -3604,6 +3671,7 @@
-       ext4_lock_group(sb, ac->ac_b_ex.fe_group);
-       list_add(&pa->pa_group_list, &grp->bb_prealloc_list);
-+      grp->bb_prealloc_nr++;
-       ext4_unlock_group(sb, ac->ac_b_ex.fe_group);
-       /*
-@@ -3802,6 +3870,8 @@
-               spin_unlock(&pa->pa_lock);
-+              BUG_ON(grp->bb_prealloc_nr == 0);
-+              grp->bb_prealloc_nr--;
-               list_del(&pa->pa_group_list);
-               list_add(&pa->u.pa_tmp_list, &list);
-       }
-@@ -3942,7 +4012,7 @@
-               if (err) {
-                       ext4_error(sb, "Error loading buddy information for %u",
-                                       group);
--                      continue;
-+                      return;
-               }
-               bitmap_bh = ext4_read_block_bitmap(sb, group);
-@@ -3954,6 +4024,8 @@
-               }
-               ext4_lock_group(sb, group);
-+              BUG_ON(e4b.bd_info->bb_prealloc_nr == 0);
-+              e4b.bd_info->bb_prealloc_nr--;
-               list_del(&pa->pa_group_list);
-               ext4_mb_release_inode_pa(&e4b, bitmap_bh, pa, ac);
-               ext4_unlock_group(sb, group);
-@@ -4227,6 +4299,7 @@
-               }
-               ext4_lock_group(sb, group);
-               list_del(&pa->pa_group_list);
-+              ext4_get_group_info(sb, group)->bb_prealloc_nr--;
-               ext4_mb_release_group_pa(&e4b, pa, ac);
-               ext4_unlock_group(sb, group);
-Index: linux-stage/fs/ext4/mballoc.h
-===================================================================
---- linux-stage.orig/fs/ext4/mballoc.h 2011-03-14 16:18:26.670209322 +0800
-+++ linux-stage/fs/ext4/mballoc.h      2011-03-14 16:32:50.859552482 +0800
-@@ -88,7 +88,7 @@
- /*
-  * for which requests use 2^N search using buddies
-  */
--#define MB_DEFAULT_ORDER2_REQS                2
-+#define MB_DEFAULT_ORDER2_REQS                8
- /*
-  * default group prealloc size 512 blocks
diff --git a/ldiskfs/kernel_patches/patches/rhel6.3/ext4-mballoc-pa_free-mismatch.patch b/ldiskfs/kernel_patches/patches/rhel6.3/ext4-mballoc-pa_free-mismatch.patch
deleted file mode 100644 (file)
index 243e1d1..0000000
+++ /dev/null
@@ -1,111 +0,0 @@
-Index: linux-stage/fs/ext4/mballoc.c
-===================================================================
---- linux-stage.orig/fs/ext4/mballoc.c 2011-03-14 16:34:39.790758415 +0800
-+++ linux-stage/fs/ext4/mballoc.c      2011-03-14 16:38:36.211681104 +0800
-@@ -3593,6 +3593,7 @@
-       INIT_LIST_HEAD(&pa->pa_group_list);
-       pa->pa_deleted = 0;
-       pa->pa_type = MB_INODE_PA;
-+      pa->pa_error = 0;
-       mb_debug(1, "new inode pa %p: %llu/%u for %u\n", pa,
-                       pa->pa_pstart, pa->pa_len, pa->pa_lstart);
-@@ -3654,6 +3655,7 @@
-       INIT_LIST_HEAD(&pa->pa_group_list);
-       pa->pa_deleted = 0;
-       pa->pa_type = MB_GROUP_PA;
-+      pa->pa_error = 0;
-       mb_debug(1, "new group pa %p: %llu/%u for %u\n", pa,
-                       pa->pa_pstart, pa->pa_len, pa->pa_lstart);
-@@ -3716,7 +3718,9 @@
-       int err = 0;
-       int free = 0;
-+      assert_spin_locked(ext4_group_lock_ptr(sb, e4b->bd_group));
-       BUG_ON(pa->pa_deleted == 0);
-+      BUG_ON(pa->pa_inode == NULL);
-       ext4_get_group_no_and_offset(sb, pa->pa_pstart, &group, &bit);
-       grp_blk_start = pa->pa_pstart - bit;
-       BUG_ON(group != e4b->bd_group && pa->pa_len != 0);
-@@ -3752,19 +3756,27 @@
-               mb_free_blocks(pa->pa_inode, e4b, bit, next - bit);
-               bit = next + 1;
-       }
--      if (free != pa->pa_free) {
--              printk(KERN_CRIT "pa %p: logic %lu, phys. %lu, len %lu\n",
--                      pa, (unsigned long) pa->pa_lstart,
--                      (unsigned long) pa->pa_pstart,
--                      (unsigned long) pa->pa_len);
-+
-+      /* "free < pa->pa_free" means we maybe double alloc the same blocks,
-+       * otherwise maybe leave some free blocks unavailable, no need to BUG.*/
-+      if ((free > pa->pa_free && !pa->pa_error) || (free < pa->pa_free)) {
-+              ext4_error(sb, "pa free mismatch: [pa %p] "
-+                              "[phy %lu] [logic %lu] [len %u] [free %u] "
-+                              "[error %u] [inode %lu] [freed %u]", pa,
-+                              (unsigned long)pa->pa_pstart,
-+                              (unsigned long)pa->pa_lstart,
-+                              (unsigned)pa->pa_len, (unsigned)pa->pa_free,
-+                              (unsigned)pa->pa_error, pa->pa_inode->i_ino,
-+                              free);
-               ext4_grp_locked_error(sb, group,
--                                      __func__, "free %u, pa_free %u",
--                                      free, pa->pa_free);
-+                              __func__, "free %u, pa_free %u",
-+                              free, pa->pa_free);
-               /*
-                * pa is already deleted so we use the value obtained
-                * from the bitmap and continue.
-                */
-       }
-+      BUG_ON(pa->pa_free != free);
-       atomic_add(free, &sbi->s_mb_discarded);
-       return err;
-@@ -4511,6 +4541,25 @@
-                       ac->ac_b_ex.fe_len = 0;
-                       ar->len = 0;
-                       ext4_mb_show_ac(ac);
-+                      if (ac->ac_pa) {
-+                              struct ext4_prealloc_space *pa = ac->ac_pa;
-+
-+                              /* We can not make sure whether the bitmap has
-+                               * been updated or not when fail case. So can
-+                               * not revert pa_free back, just mark pa_error*/
-+                              pa->pa_error++;
-+                              ext4_error(sb,
-+                                      "Updating bitmap error: [err %d] "
-+                                      "[pa %p] [phy %lu] [logic %lu] "
-+                                      "[len %u] [free %u] [error %u] "
-+                                      "[inode %lu]", *errp, pa,
-+                                      (unsigned long)pa->pa_pstart,
-+                                      (unsigned long)pa->pa_lstart,
-+                                      (unsigned)pa->pa_len,
-+                                      (unsigned)pa->pa_free,
-+                                      (unsigned)pa->pa_error,
-+                                      pa->pa_inode ? pa->pa_inode->i_ino : 0);
-+                      }
-               } else {
-                       block = ext4_grp_offs_to_block(sb, &ac->ac_b_ex);
-                       ar->len = ac->ac_b_ex.fe_len;
-Index: linux-stage/fs/ext4/mballoc.h
-===================================================================
---- linux-stage.orig/fs/ext4/mballoc.h 2011-03-14 16:32:50.859552482 +0800
-+++ linux-stage/fs/ext4/mballoc.h      2011-03-14 16:39:20.928429776 +0800
-@@ -20,6 +20,7 @@
- #include <linux/version.h>
- #include <linux/blkdev.h>
- #include <linux/mutex.h>
-+#include <linux/genhd.h>
- #include "ext4_jbd2.h"
- #include "ext4.h"
-@@ -130,6 +131,7 @@
-       ext4_grpblk_t           pa_free;        /* how many blocks are free */
-       unsigned short          pa_type;        /* pa type. inode or group */
-       spinlock_t              *pa_obj_lock;
-+      unsigned short          pa_error;
-       struct inode            *pa_inode;      /* hack, for history only */
- };
diff --git a/ldiskfs/kernel_patches/patches/rhel6.3/ext4-misc.patch b/ldiskfs/kernel_patches/patches/rhel6.3/ext4-misc.patch
deleted file mode 100644 (file)
index ad9e0ee..0000000
+++ /dev/null
@@ -1,176 +0,0 @@
-Index: linux-stage/fs/ext4/ext4.h
-===================================================================
---- 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
-@@ -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 *);
-+extern void ext4_mb_discard_inode_preallocations(struct inode *);
-+
-+
- /* inode.c */
- int ext4_forget(handle_t *handle, int is_metadata, struct inode *inode,
-               struct buffer_head *bh, ext4_fsblk_t blocknr);
-Index: linux-stage/fs/ext4/ext4_extents.h
-===================================================================
---- linux-stage.orig/fs/ext4/ext4_extents.h    2011-05-20 10:59:30.000000000 +0300
-+++ linux-stage/fs/ext4/ext4_extents.h 2011-05-20 11:00:01.000000000 +0300
-@@ -58,6 +58,12 @@
-  */
- #define EXT_STATS_
-+/*
-+ * define EXT4_ALLOC_NEEDED to 0 since block bitmap, group desc. and sb
-+ * are now accounted in ext4_ext_calc_credits_for_insert()
-+ */
-+#define EXT4_ALLOC_NEEDED 0
-+#define HAVE_EXT_PREPARE_CB_EXTENT
- /*
-  * ext4_inode has i_block array (60 bytes total).
-@@ -239,6 +245,8 @@ extern int ext4_extent_tree_init(handle_
- extern int ext4_ext_calc_credits_for_single_extent(struct inode *inode,
-                                                  int num,
-                                                  struct ext4_ext_path *path);
-+extern int ext4_ext_calc_credits_for_insert(struct inode *,
-+                                          struct ext4_ext_path *);
- extern int ext4_can_extents_be_merged(struct inode *inode,
-                                     struct ext4_extent *ex1,
-                                     struct ext4_extent *ex2);
-Index: linux-stage/fs/ext4/ext4_jbd2.c
-===================================================================
---- linux-stage.orig/fs/ext4/ext4_jbd2.c       2011-05-20 10:59:29.000000000 +0300
-+++ linux-stage/fs/ext4/ext4_jbd2.c    2011-05-20 11:00:01.000000000 +0300
-@@ -31,6 +31,7 @@ int __ext4_journal_get_write_access(cons
-       }
-       return err;
- }
-+EXPORT_SYMBOL(__ext4_journal_get_write_access);
- int __ext4_journal_forget(const char *where, handle_t *handle,
-                               struct buffer_head *bh)
-@@ -107,3 +108,4 @@ int __ext4_handle_dirty_metadata(const c
-       }
-       return err;
- }
-+EXPORT_SYMBOL(__ext4_handle_dirty_metadata);
-Index: linux-stage/fs/ext4/extents.c
-===================================================================
---- linux-stage.orig/fs/ext4/extents.c
-+++ linux-stage/fs/ext4/extents.c
-@@ -2133,6 +2133,55 @@ int ext4_ext_calc_credits_for_single_ext
- }
- /*
-+ * This routine returns max. credits extent tree can consume.
-+ * It should be OK for low-performance paths like ->writepage()
-+ * To allow many writing process to fit a single transaction,
-+ * caller should calculate credits under truncate_mutex and
-+ * pass actual path.
-+ */
-+int ext4_ext_calc_credits_for_insert(struct inode *inode,
-+                                   struct ext4_ext_path *path)
-+{
-+      int depth, needed;
-+
-+      if (path) {
-+              /* probably there is space in leaf? */
-+              depth = path->p_depth;
-+              if (le16_to_cpu(path[depth].p_hdr->eh_entries)
-+                              < le16_to_cpu(path[depth].p_hdr->eh_max))
-+                      return 1;
-+      }
-+
-+      /*
-+       * given 32bit logical block (4294967296 blocks), max. tree
-+       * can be 4 levels in depth -- 4 * 340^4 == 53453440000.
-+       * let's also add one more level for imbalance.
-+       */
-+      depth = 5;
-+
-+      /* allocation of new data block(s) */
-+      needed = 2;
-+
-+      /*
-+       * tree can be full, so it'd need to grow in depth:
-+       * we need one credit to modify old root, credits for
-+       * new root will be added in split accounting
-+       */
-+      needed += 1;
-+      /*
-+       * Index split can happen, we'd need:
-+       *    allocate intermediate indexes (bitmap + group)
-+       *  + change two blocks at each level, but root (already included)
-+       */
-+      needed += (depth * 2) + (depth * 2);
-+
-+      /* any allocation modifies superblock */
-+      needed += 1;
-+
-+      return needed;
-+}
-+
-+/*
-  * 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
-@@ -4029,3 +4079,14 @@ int ext4_fiemap(struct inode *inode, str
-       return error;
- }
-+EXPORT_SYMBOL(ext4_ext_store_pblock);
-+EXPORT_SYMBOL(ext4_ext_search_right);
-+EXPORT_SYMBOL(ext4_ext_search_left);
-+EXPORT_SYMBOL(ext_pblock);
-+EXPORT_SYMBOL(ext4_ext_insert_extent);
-+EXPORT_SYMBOL(ext4_mb_new_blocks);
-+EXPORT_SYMBOL(ext4_ext_calc_credits_for_insert);
-+EXPORT_SYMBOL(ext4_mark_inode_dirty);
-+EXPORT_SYMBOL(ext4_ext_walk_space);
-+EXPORT_SYMBOL(ext4_ext_find_extent);
-+EXPORT_SYMBOL(ext4_ext_drop_refs);
-+
-Index: linux-stage/fs/ext4/inode.c
-===================================================================
---- linux-stage.orig/fs/ext4/inode.c   2011-05-20 10:59:31.000000000 +0300
-+++ linux-stage/fs/ext4/inode.c        2011-05-20 11:00:01.000000000 +0300
-@@ -5249,6 +5249,7 @@ bad_inode:
-       iget_failed(inode);
-       return ERR_PTR(ret);
- }
-+EXPORT_SYMBOL(ext4_iget);
- static int ext4_inode_blocks_set(handle_t *handle,
-                               struct ext4_inode *raw_inode,
-Index: linux-stage/fs/ext4/mballoc.c
-===================================================================
---- linux-stage.orig/fs/ext4/mballoc.c 2011-05-20 10:59:32.000000000 +0300
-+++ linux-stage/fs/ext4/mballoc.c      2011-05-20 11:00:01.000000000 +0300
-@@ -4044,6 +4044,7 @@ repeat:
-       if (ac)
-               kmem_cache_free(ext4_ac_cachep, ac);
- }
-+EXPORT_SYMBOL(ext4_discard_preallocations);
- /*
-  * finds all preallocated spaces and return blocks being freed to them
-@@ -5029,3 +5030,6 @@ int ext4_trim_fs(struct super_block *sb,
-       return ret;
- }
-+
-+EXPORT_SYMBOL(ext4_free_blocks);
-+
-Index: linux-stage/fs/ext4/super.c
-===================================================================
---- linux-stage.orig/fs/ext4/super.c   2011-05-20 10:59:31.000000000 +0300
-+++ linux-stage/fs/ext4/super.c        2011-05-20 11:00:01.000000000 +0300
-@@ -128,6 +128,7 @@ __u32 ext4_itable_unused_count(struct su
-               (EXT4_DESC_SIZE(sb) >= EXT4_MIN_DESC_SIZE_64BIT ?
-                (__u32)le16_to_cpu(bg->bg_itable_unused_hi) << 16 : 0);
- }
-+EXPORT_SYMBOL(ext4_itable_unused_count);
- void ext4_block_bitmap_set(struct super_block *sb,
-                          struct ext4_group_desc *bg, ext4_fsblk_t blk)
diff --git a/ldiskfs/kernel_patches/patches/rhel6.3/ext4-mmp-dont-mark-bh-dirty.patch b/ldiskfs/kernel_patches/patches/rhel6.3/ext4-mmp-dont-mark-bh-dirty.patch
deleted file mode 100644 (file)
index ed25813..0000000
+++ /dev/null
@@ -1,35 +0,0 @@
-From fe18d649891d813964d3aaeebad873f281627fbc Mon Sep 17 00:00:00 2001
-From: Li Dongyang <dongyangli@ddn.com>
-Date: Sat, 15 Sep 2018 17:11:25 -0400
-Subject: [PATCH] ext4: don't mark mmp buffer head dirty
-
-Marking mmp bh dirty before writing it will make writeback
-pick up mmp block later and submit a write, we don't want the
-duplicate write as kmmpd thread should have full control of
-reading and writing the mmp block.
-Another reason is we will also have random I/O error on
-the writeback request when blk integrity is enabled, because
-kmmpd could modify the content of the mmp block(e.g. setting
-new seq and time) while the mmp block is under I/O requested
-by writeback.
-
-Signed-off-by: Li Dongyang <dongyangli@ddn.com>
-Signed-off-by: Theodore Ts'o <tytso@mit.edu>
-Reviewed-by: Andreas Dilger <adilger@dilger.ca>
-Cc: stable@vger.kernel.org
----
- fs/ext4/mmp.c | 1 -
- 1 file changed, 1 deletion(-)
-
-Index: linux-stage/fs/ext4/mmp.c
-===================================================================
---- linux-stage.orig/fs/ext4/mmp.c
-+++ linux-stage/fs/ext4/mmp.c
-@@ -12,7 +12,6 @@
-  */
- static int write_mmp_block(struct buffer_head *bh)
- {
--       mark_buffer_dirty(bh);
-        lock_buffer(bh);
-        bh->b_end_io = end_buffer_write_sync;
-        get_bh(bh);
diff --git a/ldiskfs/kernel_patches/patches/rhel6.3/ext4-mmp.patch b/ldiskfs/kernel_patches/patches/rhel6.3/ext4-mmp.patch
deleted file mode 100644 (file)
index 5ce0da8..0000000
+++ /dev/null
@@ -1,582 +0,0 @@
-Prevent an ext4 filesystem from being mounted multiple times.
-A sequence number is stored on disk and is periodically updated (every 5
-seconds by default) by a mounted filesystem.
-At mount time, we now wait for s_mmp_update_interval seconds to make sure
-that the MMP sequence does not change.
-In case of failure, the nodename, bdevname and the time at which the MMP
-block was last updated is displayed.
-Move all mmp code to a dedicated file (mmp.c).
-
-Signed-off-by: Andreas Dilger <adilger <at> whamcloud.com>
-Signed-off-by: Johann Lombardi <johann <at> whamcloud.com>
----
- fs/ext4/Makefile |    3 +-
- fs/ext4/ext4.h   |   76 ++++++++++++-
- fs/ext4/mmp.c    |  354 ++++++++++++++++++++++++++++++++++++++++++++++++++++++
- fs/ext4/super.c  |   18 +++-
- 4 files changed, 447 insertions(+), 4 deletions(-)
- create mode 100644 fs/ext4/mmp.c
-
-Index: linux-stage/fs/ext4/Makefile
-===================================================================
---- linux-stage.orig/fs/ext4/Makefile
-+++ linux-stage/fs/ext4/Makefile
-@@ -6,7 +6,8 @@ obj-$(CONFIG_EXT4_FS) += ext4.o
- ext4-y        := balloc.o bitmap.o dir.o file.o fsync.o ialloc.o inode.o \
-               ioctl.o namei.o super.o symlink.o hash.o resize.o extents.o \
--              ext4_jbd2.o migrate.o mballoc.o block_validity.o move_extent.o
-+              ext4_jbd2.o migrate.o mballoc.o block_validity.o move_extent.o \
-+              mmp.o
- ext4-$(CONFIG_EXT4_FS_XATTR)          += xattr.o xattr_user.o xattr_trusted.o
- ext4-$(CONFIG_EXT4_FS_POSIX_ACL)      += acl.o
-Index: linux-stage/fs/ext4/ext4.h
-===================================================================
---- linux-stage.orig/fs/ext4/ext4.h
-+++ linux-stage/fs/ext4/ext4.h
-@@ -893,7 +893,7 @@ struct ext4_super_block {
-       __le16  s_want_extra_isize;     /* New inodes should reserve # bytes */
-       __le32  s_flags;                /* Miscellaneous flags */
-       __le16  s_raid_stride;          /* RAID stride */
--      __le16  s_mmp_interval;         /* # seconds to wait in MMP checking */
-+      __le16  s_mmp_update_interval;  /* # seconds to wait in MMP checking */
-       __le64  s_mmp_block;            /* Block for multi-mount protection */
-       __le32  s_raid_stripe_width;    /* blocks on all data disks (N*stride)*/
-       __u8    s_log_groups_per_flex;  /* FLEX_BG group size */
-@@ -1040,6 +1040,9 @@ struct ext4_sb_info {
-       /* workqueue for dio unwritten */
-       struct workqueue_struct *dio_unwritten_wq;
-+
-+      /* Kernel thread for multiple mount protection */
-+      struct task_struct *s_mmp_tsk;
-       /* Lazy inode table initialization info */
-       struct ext4_li_request *s_li_request;
-@@ -1176,7 +1179,8 @@ static inline void ext4_clear_inode_stat
-                                        EXT4_FEATURE_INCOMPAT_META_BG| \
-                                        EXT4_FEATURE_INCOMPAT_EXTENTS| \
-                                        EXT4_FEATURE_INCOMPAT_64BIT| \
--                                       EXT4_FEATURE_INCOMPAT_FLEX_BG)
-+                                       EXT4_FEATURE_INCOMPAT_FLEX_BG| \
-+                                       EXT4_FEATURE_INCOMPAT_MMP)
- #define EXT4_FEATURE_RO_COMPAT_SUPP   (EXT4_FEATURE_RO_COMPAT_SPARSE_SUPER| \
-                                        EXT4_FEATURE_RO_COMPAT_LARGE_FILE| \
-                                        EXT4_FEATURE_RO_COMPAT_GDT_CSUM| \
-@@ -1383,6 +1387,67 @@ void ext4_get_group_no_and_offset(struct
- extern struct proc_dir_entry *ext4_proc_root;
- /*
-+ * This structure will be used for multiple mount protection. It will be
-+ * written into the block number saved in the s_mmp_block field in the
-+ * superblock. Programs that check MMP should assume that if
-+ * SEQ_FSCK (or any unknown code above SEQ_MAX) is present then it is NOT safe
-+ * to use the filesystem, regardless of how old the timestamp is.
-+ */
-+#define EXT4_MMP_MAGIC     0x004D4D50U /* ASCII for MMP */
-+#define EXT4_MMP_SEQ_CLEAN 0xFF4D4D50U /* mmp_seq value for clean unmount */
-+#define EXT4_MMP_SEQ_FSCK  0xE24D4D50U /* mmp_seq value when being fscked */
-+#define EXT4_MMP_SEQ_MAX   0xE24D4D4FU /* maximum valid mmp_seq value */
-+
-+struct mmp_struct {
-+       __le32  mmp_magic;              /* Magic number for MMP */
-+       __le32  mmp_seq;                /* Sequence no. updated periodically */
-+
-+       /*
-+        * mmp_time, mmp_nodename & mmp_bdevname are only used for information
-+        * purposes and do not affect the correctness of the algorithm
-+        */
-+       __le64  mmp_time;               /* Time last updated */
-+       char    mmp_nodename[64];       /* Node which last updated MMP block */
-+       char    mmp_bdevname[32];       /* Bdev which last updated MMP block */
-+
-+       /*
-+        * mmp_check_interval is used to verify if the MMP block has been
-+        * updated on the block device. The value is updated based on the
-+        * maximum time to write the MMP block during an update cycle.
-+        */
-+       __le16  mmp_check_interval;
-+
-+       __le16  mmp_pad1;
-+       __le32  mmp_pad2[227];
-+};
-+
-+/* arguments passed to the mmp thread */
-+struct mmpd_data {
-+       struct buffer_head *bh; /* bh from initial read_mmp_block() */
-+       struct super_block *sb;  /* super block of the fs */
-+};
-+
-+/*
-+ * Check interval multiplier
-+ * The MMP block is written every update interval and initially checked every
-+ * update interval x the multiplier (the value is then adapted based on the
-+ * write latency). The reason is that writes can be delayed under load and we
-+ * don't want readers to incorrectly assume that the filesystem is no longer
-+ * in use.
-+ */
-+#define EXT4_MMP_CHECK_MULT            2UL
-+
-+/*
-+ * Minimum interval for MMP checking in seconds.
-+ */
-+#define EXT4_MMP_MIN_CHECK_INTERVAL    5UL
-+
-+/*
-+ * Maximum interval for MMP checking in seconds.
-+ */
-+#define EXT4_MMP_MAX_CHECK_INTERVAL    300UL
-+
-+/*
-  * Function prototypes
-  */
-@@ -1552,6 +1617,10 @@ extern void __ext4_warning(struct super_
- #define ext4_warning(sb, message...)  __ext4_warning(sb, __func__, ## message)
- extern void ext4_msg(struct super_block *, const char *, const char *, ...)
-       __attribute__ ((format (printf, 3, 4)));
-+extern void __dump_mmp_msg(struct super_block *, struct mmp_struct *mmp,
-+                         const char *, const char *);
-+#define dump_mmp_msg(sb, mmp, msg)     __dump_mmp_msg(sb, mmp, __func__, \
-+                                                      msg)
- extern void ext4_grp_locked_error(struct super_block *, ext4_group_t,
-                               const char *, const char *, ...)
-       __attribute__ ((format (printf, 4, 5)));
-@@ -1833,6 +1902,8 @@ extern int ext4_move_extents(struct file
-                            __u64 start_orig, __u64 start_donor,
-                            __u64 len, __u64 *moved_len);
-+/* mmp.c */
-+extern int ext4_multi_mount_protect(struct super_block *, ext4_fsblk_t);
- /*
-  * Add new method to test wether block and inode bitmaps are properly
-Index: linux-stage/fs/ext4/mmp.c
-===================================================================
---- /dev/null
-+++ linux-stage/fs/ext4/mmp.c
-@@ -0,0 +1,357 @@
-+#include <linux/fs.h>
-+#include <linux/random.h>
-+#include <linux/buffer_head.h>
-+#include <linux/utsname.h>
-+#include <linux/kthread.h>
-+
-+#include "ext4.h"
-+
-+/*
-+ * Write the MMP block using WRITE_SYNC to try to get the block on-disk
-+ * faster.
-+ */
-+static int write_mmp_block(struct buffer_head *bh)
-+{
-+       mark_buffer_dirty(bh);
-+       lock_buffer(bh);
-+       bh->b_end_io = end_buffer_write_sync;
-+       get_bh(bh);
-+       submit_bh(WRITE_SYNC, bh);
-+       wait_on_buffer(bh);
-+       if (unlikely(!buffer_uptodate(bh)))
-+               return 1;
-+
-+       return 0;
-+}
-+
-+/*
-+ * Read the MMP block. It _must_ be read from disk and hence we clear the
-+ * uptodate flag on the buffer.
-+ */
-+static int read_mmp_block(struct super_block *sb, struct buffer_head **bh,
-+                         ext4_fsblk_t mmp_block)
-+{
-+       struct mmp_struct *mmp;
-+
-+       if (*bh)
-+               clear_buffer_uptodate(*bh);
-+
-+       /* This would be sb_bread(sb, mmp_block), except we need to be sure
-+        * that the MD RAID device cache has been bypassed, and that the read
-+        * is not blocked in the elevator. */
-+       if (!*bh)
-+               *bh = sb_getblk(sb, mmp_block);
-+       if (*bh) {
-+               get_bh(*bh);
-+               lock_buffer(*bh);
-+               (*bh)->b_end_io = end_buffer_read_sync;
-+               submit_bh(READ_SYNC, *bh);
-+               wait_on_buffer(*bh);
-+               if (!buffer_uptodate(*bh)) {
-+                       brelse(*bh);
-+                       *bh = NULL;
-+               }
-+       }
-+       if (!*bh) {
-+               ext4_warning(sb, "Error while reading MMP block %llu",
-+                            mmp_block);
-+               return -EIO;
-+       }
-+
-+       mmp = (struct mmp_struct *)((*bh)->b_data);
-+       if (le32_to_cpu(mmp->mmp_magic) != EXT4_MMP_MAGIC) {
-+              brelse(*bh);
-+              *bh = NULL;
-+               return -EINVAL;
-+      }
-+
-+       return 0;
-+}
-+
-+/*
-+ * Dump as much information as possible to help the admin.
-+ */
-+void __dump_mmp_msg(struct super_block *sb, struct mmp_struct *mmp,
-+                   const char *function, const char *msg)
-+{
-+       __ext4_warning(sb, function, msg);
-+       __ext4_warning(sb, function,
-+                      "MMP failure info: last update time: %llu, last update "
-+                      "node: %s, last update device: %s\n",
-+                      (long long unsigned int) le64_to_cpu(mmp->mmp_time),
-+                      mmp->mmp_nodename, mmp->mmp_bdevname);
-+}
-+
-+/*
-+ * kmmpd will update the MMP sequence every s_mmp_update_interval seconds
-+ */
-+static int kmmpd(void *data)
-+{
-+       struct super_block *sb = ((struct mmpd_data *) data)->sb;
-+       struct buffer_head *bh = ((struct mmpd_data *) data)->bh;
-+       struct ext4_super_block *es = EXT4_SB(sb)->s_es;
-+       struct mmp_struct *mmp;
-+       ext4_fsblk_t mmp_block;
-+       u32 seq = 0;
-+       unsigned long failed_writes = 0;
-+       int mmp_update_interval = le16_to_cpu(es->s_mmp_update_interval);
-+       unsigned mmp_check_interval;
-+       unsigned long last_update_time;
-+       unsigned long diff;
-+       int retval;
-+
-+       mmp_block = le64_to_cpu(es->s_mmp_block);
-+       mmp = (struct mmp_struct *)(bh->b_data);
-+       mmp->mmp_time = cpu_to_le64(get_seconds());
-+       /*
-+        * Start with the higher mmp_check_interval and reduce it if
-+        * the MMP block is being updated on time.
-+        */
-+       mmp_check_interval = max(EXT4_MMP_CHECK_MULT * mmp_update_interval,
-+                                EXT4_MMP_MIN_CHECK_INTERVAL);
-+       mmp->mmp_check_interval = cpu_to_le16(mmp_check_interval);
-+       bdevname(bh->b_bdev, mmp->mmp_bdevname);
-+
-+       memcpy(mmp->mmp_nodename, init_utsname()->nodename,
-+              sizeof(mmp->mmp_nodename));
-+
-+       while (!kthread_should_stop()) {
-+               if (++seq > EXT4_MMP_SEQ_MAX)
-+                       seq = 1;
-+
-+               mmp->mmp_seq = cpu_to_le32(seq);
-+               mmp->mmp_time = cpu_to_le64(get_seconds());
-+               last_update_time = jiffies;
-+
-+               retval = write_mmp_block(bh);
-+               /*
-+                * Don't spew too many error messages. Print one every
-+                * (s_mmp_update_interval * 60) seconds.
-+                */
-+               if (retval) {
-+                       if ((failed_writes % 60) == 0)
-+                               ext4_error(sb, "Error writing to MMP block");
-+                       failed_writes++;
-+               }
-+
-+               if (!(le32_to_cpu(es->s_feature_incompat) &
-+                   EXT4_FEATURE_INCOMPAT_MMP)) {
-+                       ext4_warning(sb, "kmmpd being stopped since MMP feature"
-+                                    " has been disabled.");
-+                       EXT4_SB(sb)->s_mmp_tsk = NULL;
-+                       goto failed;
-+               }
-+
-+               if (sb->s_flags & MS_RDONLY) {
-+                       ext4_warning(sb, "kmmpd being stopped since filesystem "
-+                                    "has been remounted as readonly.");
-+                       EXT4_SB(sb)->s_mmp_tsk = NULL;
-+                       goto failed;
-+               }
-+
-+              diff = jiffies - last_update_time;
-+              if (diff < mmp_update_interval * msecs_to_jiffies(MSEC_PER_SEC))
-+                      schedule_timeout_interruptible(mmp_update_interval *
-+                              msecs_to_jiffies(MSEC_PER_SEC) - diff);
-+
-+               /*
-+                * We need to make sure that more than mmp_check_interval
-+                * seconds have not passed since writing. If that has happened
-+                * we need to check if the MMP block is as we left it.
-+                */
-+               diff = jiffies - last_update_time;
-+               if (diff > mmp_check_interval * msecs_to_jiffies(MSEC_PER_SEC)) {
-+                       struct buffer_head *bh_check = NULL;
-+                       struct mmp_struct *mmp_check;
-+
-+                       retval = read_mmp_block(sb, &bh_check, mmp_block);
-+                       if (retval) {
-+                               ext4_error(sb, "error reading MMP data: %d",
-+                                          retval);
-+                               EXT4_SB(sb)->s_mmp_tsk = NULL;
-+                               goto failed;
-+                       }
-+
-+                       mmp_check = (struct mmp_struct *)(bh_check->b_data);
-+                       if (mmp->mmp_seq != mmp_check->mmp_seq ||
-+                           memcmp(mmp->mmp_nodename, mmp_check->mmp_nodename,
-+                                  sizeof(mmp->mmp_nodename))) {
-+                               dump_mmp_msg(sb, mmp_check,
-+                                            "Error while updating MMP info. "
-+                                            "The filesystem seems to have been"
-+                                            " multiply mounted.");
-+                               ext4_error(sb, "abort");
-+                              put_bh(bh_check);
-+                               goto failed;
-+                       }
-+                       put_bh(bh_check);
-+               }
-+
-+              /*
-+               * Adjust the mmp_check_interval depending on how much time
-+               * it took for the MMP block to be written.
-+               */
-+              mmp_check_interval = max(min(EXT4_MMP_CHECK_MULT * diff /
-+                                           msecs_to_jiffies(MSEC_PER_SEC),
-+                                           EXT4_MMP_MAX_CHECK_INTERVAL),
-+                                       EXT4_MMP_MIN_CHECK_INTERVAL);
-+              mmp->mmp_check_interval = cpu_to_le16(mmp_check_interval);
-+       }
-+
-+       /*
-+        * Unmount seems to be clean.
-+        */
-+       mmp->mmp_seq = cpu_to_le32(EXT4_MMP_SEQ_CLEAN);
-+       mmp->mmp_time = cpu_to_le64(get_seconds());
-+
-+       retval = write_mmp_block(bh);
-+
-+failed:
-+       kfree(data);
-+       brelse(bh);
-+       return retval;
-+}
-+
-+/*
-+ * Get a random new sequence number but make sure it is not greater than
-+ * EXT4_MMP_SEQ_MAX.
-+ */
-+static unsigned int mmp_new_seq(void)
-+{
-+       u32 new_seq;
-+
-+       do {
-+               get_random_bytes(&new_seq, sizeof(u32));
-+       } while (new_seq > EXT4_MMP_SEQ_MAX);
-+
-+       return new_seq;
-+}
-+
-+/*
-+ * Protect the filesystem from being mounted more than once.
-+ */
-+int ext4_multi_mount_protect(struct super_block *sb,
-+                                   ext4_fsblk_t mmp_block)
-+{
-+       struct ext4_super_block *es = EXT4_SB(sb)->s_es;
-+       struct buffer_head *bh = NULL;
-+       struct mmp_struct *mmp = NULL;
-+       struct mmpd_data *mmpd_data;
-+       u32 seq;
-+       unsigned int mmp_check_interval = le16_to_cpu(es->s_mmp_update_interval);
-+       unsigned int wait_time = 0;
-+       int retval;
-+
-+       if (mmp_block < le32_to_cpu(es->s_first_data_block) ||
-+           mmp_block >= ext4_blocks_count(es)) {
-+               ext4_warning(sb, "Invalid MMP block in superblock");
-+               goto failed;
-+       }
-+
-+       retval = read_mmp_block(sb, &bh, mmp_block);
-+       if (retval)
-+               goto failed;
-+
-+       mmp = (struct mmp_struct *)(bh->b_data);
-+
-+       if (mmp_check_interval < EXT4_MMP_MIN_CHECK_INTERVAL)
-+               mmp_check_interval = EXT4_MMP_MIN_CHECK_INTERVAL;
-+
-+       /*
-+        * If check_interval in MMP block is larger, use that instead of
-+        * update_interval from the superblock.
-+        */
-+       if (mmp->mmp_check_interval > mmp_check_interval)
-+               mmp_check_interval = mmp->mmp_check_interval;
-+
-+       seq = le32_to_cpu(mmp->mmp_seq);
-+       if (seq == EXT4_MMP_SEQ_CLEAN)
-+               goto skip;
-+
-+       if (seq == EXT4_MMP_SEQ_FSCK) {
-+               dump_mmp_msg(sb, mmp, "fsck is running on the filesystem");
-+               goto failed;
-+       }
-+
-+       wait_time = min(mmp_check_interval * 2 + 1,
-+                       mmp_check_interval + 60);
-+
-+       /* Print MMP interval if more than 20 secs. */
-+       if (wait_time > EXT4_MMP_MIN_CHECK_INTERVAL * 4)
-+               ext4_warning(sb, "MMP interval %u higher than expected, please"
-+                            " wait.\n", wait_time * 2);
-+
-+      if (schedule_timeout_interruptible(msecs_to_jiffies(MSEC_PER_SEC) *
-+                                         wait_time) != 0) {
-+              ext4_warning(sb, "MMP startup interrupted, failing mount\n");
-+              goto failed;
-+      }
-+
-+       retval = read_mmp_block(sb, &bh, mmp_block);
-+       if (retval)
-+               goto failed;
-+       mmp = (struct mmp_struct *)(bh->b_data);
-+       if (seq != le32_to_cpu(mmp->mmp_seq)) {
-+               dump_mmp_msg(sb, mmp,
-+                            "Device is already active on another node.");
-+               goto failed;
-+       }
-+
-+skip:
-+       /*
-+        * write a new random sequence number.
-+        */
-+       mmp->mmp_seq = seq = cpu_to_le32(mmp_new_seq());
-+
-+       retval = write_mmp_block(bh);
-+       if (retval)
-+               goto failed;
-+
-+      /*
-+       * wait for MMP interval and check mmp_seq.
-+       */
-+      if (schedule_timeout_interruptible(msecs_to_jiffies(MSEC_PER_SEC) *
-+                                         wait_time) != 0) {
-+              ext4_warning(sb, "MMP startup interrupted, failing mount\n");
-+              goto failed;
-+      }
-+
-+       retval = read_mmp_block(sb, &bh, mmp_block);
-+       if (retval)
-+               goto failed;
-+       mmp = (struct mmp_struct *)(bh->b_data);
-+       if (seq != le32_to_cpu(mmp->mmp_seq)) {
-+               dump_mmp_msg(sb, mmp,
-+                            "Device is already active on another node.");
-+               goto failed;
-+       }
-+
-+       mmpd_data = kmalloc(sizeof(struct mmpd_data), GFP_KERNEL);
-+       if (!mmpd_data) {
-+               ext4_warning(sb, "not enough memory for mmpd_data");
-+               goto failed;
-+       }
-+       mmpd_data->sb = sb;
-+       mmpd_data->bh = bh;
-+
-+       /*
-+        * Start a kernel thread to update the MMP block periodically.
-+        */
-+       EXT4_SB(sb)->s_mmp_tsk = kthread_run(kmmpd, mmpd_data, "kmmpd-%s",
-+                                            bdevname(bh->b_bdev,
-+                                                     mmp->mmp_bdevname));
-+       if (IS_ERR(EXT4_SB(sb)->s_mmp_tsk)) {
-+               EXT4_SB(sb)->s_mmp_tsk = NULL;
-+               kfree(mmpd_data);
-+               ext4_warning(sb, "Unable to create kmmpd thread for %s.",
-+                            sb->s_id);
-+               goto failed;
-+       }
-+
-+       return 0;
-+
-+failed:
-+       brelse(bh);
-+       return 1;
-+}
-+
-+
-Index: linux-stage/fs/ext4/super.c
-===================================================================
---- linux-stage.orig/fs/ext4/super.c
-+++ linux-stage/fs/ext4/super.c
-@@ -40,6 +40,8 @@
- #include <linux/log2.h>
- #include <linux/crc16.h>
- #include <asm/uaccess.h>
-+#include <linux/kthread.h>
-+#include <linux/utsname.h>
- #include "ext4.h"
- #include "ext4_jbd2.h"
-@@ -700,6 +702,8 @@ static void ext4_put_super(struct super_
-               invalidate_bdev(sbi->journal_bdev);
-               ext4_blkdev_remove(sbi);
-       }
-+      if (sbi->s_mmp_tsk)
-+              kthread_stop(sbi->s_mmp_tsk);
-       sb->s_fs_info = NULL;
-       /*
-        * Now that we are completely done shutting down the
-@@ -2799,6 +2803,10 @@ static int ext4_fill_super(struct super_
-       needs_recovery = (es->s_last_orphan != 0 ||
-                         EXT4_HAS_INCOMPAT_FEATURE(sb,
-                                   EXT4_FEATURE_INCOMPAT_RECOVER));
-+      if (EXT4_HAS_INCOMPAT_FEATURE(sb, EXT4_FEATURE_INCOMPAT_MMP) &&
-+          !(sb->s_flags & MS_RDONLY))
-+              if (ext4_multi_mount_protect(sb, le64_to_cpu(es->s_mmp_block)))
-+                      goto failed_mount3;
-       /*
-        * The first inode we look at is the journal inode.  Don't try
-@@ -3036,6 +3044,8 @@ failed_mount3:
-       percpu_counter_destroy(&sbi->s_freeinodes_counter);
-       percpu_counter_destroy(&sbi->s_dirs_counter);
-       percpu_counter_destroy(&sbi->s_dirtyblocks_counter);
-+      if (sbi->s_mmp_tsk)
-+              kthread_stop(sbi->s_mmp_tsk);
- failed_mount2:
-       for (i = 0; i < db_count; i++)
-               brelse(sbi->s_group_desc[i]);
-@@ -3544,7 +3554,7 @@ static int ext4_remount(struct super_blo
-       struct ext4_mount_options old_opts;
-       ext4_group_t g;
-       unsigned int journal_ioprio = DEFAULT_JOURNAL_IOPRIO;
--      int err;
-+      int err = 0;
- #ifdef CONFIG_QUOTA
-       int i;
- #endif
-@@ -3666,6 +3676,13 @@ static int ext4_remount(struct super_blo
-                               goto restore_opts;
-                       if (!ext4_setup_super(sb, es, 0))
-                               sb->s_flags &= ~MS_RDONLY;
-+                      if (EXT4_HAS_INCOMPAT_FEATURE(sb,
-+                                                  EXT4_FEATURE_INCOMPAT_MMP))
-+                              if (ext4_multi_mount_protect(sb,
-+                                              le64_to_cpu(es->s_mmp_block))) {
-+                                      err = -EROFS;
-+                                      goto restore_opts;
-+                              }
-               }
-       }
-       ext4_setup_system_zone(sb);
diff --git a/ldiskfs/kernel_patches/patches/rhel6.3/ext4-notalloc_under_idatasem.patch b/ldiskfs/kernel_patches/patches/rhel6.3/ext4-notalloc_under_idatasem.patch
deleted file mode 100644 (file)
index 067543b..0000000
+++ /dev/null
@@ -1,14 +0,0 @@
-Index: linux-stage/fs/ext4/extents.c
-===================================================================
---- linux-stage.orig/fs/ext4/extents.c 2015-07-13 22:22:56.000000000 +0300
-+++ linux-stage/fs/ext4/extents.c      2015-07-13 22:24:05.000000000 +0300
-@@ -4318,7 +4318,8 @@ static int ext4_find_delayed_extent(stru
-       struct buffer_head *head = NULL;
-       unsigned int nr_pages = PAGE_SIZE / sizeof(struct page *);
--      pages = kmalloc(PAGE_SIZE, GFP_KERNEL);
-+      /* we are running under i_data_sem so don't reenter the FS code */
-+      pages = kmalloc(PAGE_SIZE, GFP_NOFS);
-       if (pages == NULL)
-               return -ENOMEM;
diff --git a/ldiskfs/kernel_patches/patches/rhel6.3/ext4-osd-iop-common.patch b/ldiskfs/kernel_patches/patches/rhel6.3/ext4-osd-iop-common.patch
deleted file mode 100644 (file)
index 9a95aa3..0000000
+++ /dev/null
@@ -1,215 +0,0 @@
-diff --git a/fs/ext4/ext4.h b/fs/ext4/ext4.h
-index 1d41eef..87b4ea3 100644
---- a/fs/ext4/ext4.h
-+++ b/fs/ext4/ext4.h
-@@ -1825,6 +1825,14 @@ extern int ext4_orphan_add(handle_t *, struct inode *);
- extern int ext4_orphan_del(handle_t *, struct inode *);
- extern int ext4_htree_fill_tree(struct file *dir_file, __u32 start_hash,
-                               __u32 start_minor_hash, __u32 *next_hash);
-+extern struct inode *ext4_create_inode(handle_t *handle,
-+                                     struct inode * dir, int mode,
-+                                     uid_t *owner);
-+extern int ext4_delete_entry(handle_t *handle, struct inode * dir,
-+                           struct ext4_dir_entry_2 * de_del,
-+                           struct buffer_head * bh);
-+extern int ext4_add_dot_dotdot(handle_t *handle, struct inode *dir,
-+                             struct inode *inode);
- /* resize.c */
- extern int ext4_group_add(struct super_block *sb,
-diff --git a/fs/ext4/namei.c b/fs/ext4/namei.c
-index 6433d87..0f3783b 100644
---- a/fs/ext4/namei.c
-+++ b/fs/ext4/namei.c
-@@ -24,6 +24,7 @@
-  *    Theodore Ts'o, 2002
-  */
-+#include <linux/module.h>
- #include <linux/fs.h>
- #include <linux/pagemap.h>
- #include <linux/jbd2.h>
-@@ -1691,10 +1692,10 @@ cleanup:
-  * ext4_delete_entry deletes a directory entry by merging it with the
-  * previous entry
-  */
--static int ext4_delete_entry(handle_t *handle,
--                           struct inode *dir,
--                           struct ext4_dir_entry_2 *de_del,
--                           struct buffer_head *bh)
-+int ext4_delete_entry(handle_t *handle,
-+                    struct inode *dir,
-+                    struct ext4_dir_entry_2 *de_del,
-+                    struct buffer_head *bh)
- {
-       struct ext4_dir_entry_2 *de, *pde;
-       unsigned int blocksize = dir->i_sb->s_blocksize;
-@@ -1729,7 +1730,7 @@ static int ext4_delete_entry(handle_t *handle,
-       }
-       return -ENOENT;
- }
--
-+EXPORT_SYMBOL(ext4_delete_entry);
- /*
-  * DIR_NLINK feature is set if 1) nlinks > EXT4_LINK_MAX or 2) nlinks == 2,
-  * since this indicates that nlinks count was previously 1.
-@@ -1776,6 +1777,30 @@ static int ext4_add_nondir(handle_t *handle,
-       return err;
- }
-+ /* Return locked inode, then the caller can modify the inode's states/flags
-+  * before others finding it. The caller should unlock the inode by itself. */
-+struct inode *ext4_create_inode(handle_t *handle, struct inode *dir, int mode,
-+                              uid_t *owner)
-+{
-+      struct inode *inode;
-+
-+      inode = ext4_new_inode(handle, dir, mode, 0,
-+                             EXT4_SB(dir->i_sb)->s_inode_goal);
-+      if (!IS_ERR(inode)) {
-+              if (S_ISCHR(mode) || S_ISBLK(mode) || S_ISFIFO(mode)) {
-+#ifdef CONFIG_EXT4_FS_XATTR
-+                      inode->i_op = &ext4_special_inode_operations;
-+#endif
-+              } else {
-+                      inode->i_op = &ext4_file_inode_operations;
-+                      inode->i_fop = &ext4_file_operations;
-+                      ext4_set_aops(inode);
-+              }
-+      }
-+      return inode;
-+}
-+EXPORT_SYMBOL(ext4_create_inode);
-+
- /*
-  * By the time this is called, we already have created
-  * the directory cache entry for the new file, but it
-@@ -1850,44 +1875,32 @@ retry:
-       return err;
- }
--static int ext4_mkdir(struct inode *dir, struct dentry *dentry, int mode)
-+/* 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,
-+                      struct inode *inode)
- {
--      handle_t *handle;
--      struct inode *inode;
--      struct buffer_head *dir_block = NULL;
--      struct ext4_dir_entry_2 *de;
-+      struct buffer_head * dir_block;
-+      struct ext4_dir_entry_2 * de;
-       unsigned int blocksize = dir->i_sb->s_blocksize;
--      int err, retries = 0;
--
--      if (EXT4_DIR_LINK_MAX(dir))
--              return -EMLINK;
-+      int err = 0;
--retry:
--      handle = ext4_journal_start(dir, EXT4_DATA_TRANS_BLOCKS(dir->i_sb) +
--                                      EXT4_INDEX_EXTRA_TRANS_BLOCKS + 3 +
--                                      EXT4_MAXQUOTAS_INIT_BLOCKS(dir->i_sb));
-       if (IS_ERR(handle))
-               return PTR_ERR(handle);
-       if (IS_DIRSYNC(dir))
-               ext4_handle_sync(handle);
--      inode = ext4_new_inode(handle, dir, S_IFDIR | mode,
--                             &dentry->d_name, 0);
--      err = PTR_ERR(inode);
--      if (IS_ERR(inode))
--              goto out_stop;
--
-       inode->i_op = &ext4_dir_inode_operations;
-       inode->i_fop = &ext4_dir_operations;
-       inode->i_size = EXT4_I(inode)->i_disksize = inode->i_sb->s_blocksize;
-       dir_block = ext4_bread(handle, inode, 0, 1, &err);
-       if (!dir_block)
--              goto out_clear_inode;
-+              goto get_out;
-       BUFFER_TRACE(dir_block, "get_write_access");
-       err = ext4_journal_get_write_access(handle, dir_block);
-       if (err)
--              goto out_clear_inode;
-+              goto get_out;
-       de = (struct ext4_dir_entry_2 *) dir_block->b_data;
-       de->inode = cpu_to_le32(inode->i_ino);
-       de->name_len = 1;
-@@ -1906,18 +1919,46 @@ retry:
-       BUFFER_TRACE(dir_block, "call ext4_handle_dirty_metadata");
-       err = ext4_handle_dirty_metadata(handle, inode, dir_block);
-       if (err)
--              goto out_clear_inode;
-+              goto get_out;
-       err = ext4_mark_inode_dirty(handle, inode);
--      if (!err)
--              err = ext4_add_entry(handle, dentry, inode);
--      if (err) {
--out_clear_inode:
--              clear_nlink(inode);
--              unlock_new_inode(inode);
--              ext4_mark_inode_dirty(handle, inode);
--              iput(inode);
-+get_out:
-+      brelse(dir_block);
-+      return err;
-+}
-+EXPORT_SYMBOL(ext4_add_dot_dotdot);
-+
-+
-+static int ext4_mkdir(struct inode *dir, struct dentry *dentry, int mode)
-+{
-+      handle_t *handle;
-+      struct inode *inode;
-+      int err, retries = 0;
-+
-+      if (EXT4_DIR_LINK_MAX(dir))
-+              return -EMLINK;
-+
-+retry:
-+      handle = ext4_journal_start(dir, EXT4_DATA_TRANS_BLOCKS(dir->i_sb) +
-+                                      EXT4_INDEX_EXTRA_TRANS_BLOCKS + 3 +
-+                                      2*EXT4_QUOTA_INIT_BLOCKS(dir->i_sb));
-+      if (IS_ERR(handle))
-+              return PTR_ERR(handle);
-+
-+      if (IS_DIRSYNC(dir))
-+              ext4_handle_sync(handle);
-+
-+      inode = ext4_new_inode(handle, dir, S_IFDIR | mode, &dentry->d_name, 0);
-+      err = PTR_ERR(inode);
-+      if (IS_ERR(inode))
-               goto out_stop;
--      }
-+
-+      err = ext4_add_dot_dotdot(handle, dir, inode);
-+      if (err)
-+              goto out_clear_inode;
-+
-+      err = ext4_add_entry(handle, dentry, inode);
-+      if (err)
-+              goto out_clear_inode;
-       ext4_inc_count(handle, dir);
-       ext4_update_dx_flag(dir);
-       err = ext4_mark_inode_dirty(handle, dir);
-@@ -1926,11 +1967,16 @@ out_clear_inode:
-       d_instantiate(dentry, inode);
-       unlock_new_inode(inode);
- out_stop:
--      brelse(dir_block);
-       ext4_journal_stop(handle);
-       if (err == -ENOSPC && ext4_should_retry_alloc(dir->i_sb, &retries))
-               goto retry;
-       return err;
-+out_clear_inode:
-+      clear_nlink(inode);
-+      unlock_new_inode(inode);
-+      ext4_mark_inode_dirty(handle, inode);
-+      iput(inode);
-+      goto out_stop;
- }
- /*
diff --git a/ldiskfs/kernel_patches/patches/rhel6.3/ext4-prealloc.patch b/ldiskfs/kernel_patches/patches/rhel6.3/ext4-prealloc.patch
deleted file mode 100644 (file)
index 5ec3320..0000000
+++ /dev/null
@@ -1,411 +0,0 @@
-Index: linux-stage/fs/ext4/ext4.h
-===================================================================
---- linux-stage.orig/fs/ext4/ext4.h    2011-03-11 14:17:02.000000000 +0800
-+++ linux-stage/fs/ext4/ext4.h 2011-03-11 14:20:08.269063193 +0800
-@@ -999,11 +999,14 @@
-       /* tunables */
-       unsigned long s_stripe;
--      unsigned int s_mb_stream_request;
-+      unsigned long s_mb_small_req;
-+      unsigned long s_mb_large_req;
-       unsigned int s_mb_max_to_scan;
-       unsigned int s_mb_min_to_scan;
-       unsigned int s_mb_stats;
-       unsigned int s_mb_order2_reqs;
-+      unsigned long *s_mb_prealloc_table;
-+      unsigned long s_mb_prealloc_table_size;
-       unsigned int s_mb_group_prealloc;
-       unsigned int s_max_writeback_mb_bump;
-       /* where last allocation was done - for stream allocation */
-Index: linux-stage/fs/ext4/inode.c
-===================================================================
-@@ -3028,6 +3028,11 @@ static int ext4_da_writepages(struct add
-       if (unlikely(sbi->s_mount_flags & EXT4_MF_FS_ABORTED))
-               return -EROFS;
-+      if (wbc->nr_to_write < sbi->s_mb_small_req) {
-+              nr_to_writebump = sbi->s_mb_small_req - wbc->nr_to_write;
-+              wbc->nr_to_write = sbi->s_mb_small_req;
-+      }
-+
-       if (wbc->range_start == 0 && wbc->range_end == LLONG_MAX)
-               range_whole = 1;
-
-Index: linux-stage/fs/ext4/mballoc.c
-===================================================================
---- linux-stage.orig/fs/ext4/mballoc.c 2011-03-11 14:03:32.000000000 +0800
-+++ linux-stage/fs/ext4/mballoc.c      2011-03-11 14:44:49.106543493 +0800
-@@ -1823,6 +1823,25 @@
-
-       }
- }
-+
-+static void ext4_mb_prealloc_table_add(struct ext4_sb_info *sbi, int value)
-+{
-+      int i;
-+
-+      if (value > (sbi->s_blocks_per_group - 1 - 1 - sbi->s_itb_per_group))
-+              return;
-+
-+      for (i = 0; i < sbi->s_mb_prealloc_table_size; i++) {
-+              if (sbi->s_mb_prealloc_table[i] == 0) {
-+                      sbi->s_mb_prealloc_table[i] = value;
-+                      return;
-+              }
-+
-+              /* they should add values in order */
-+              if (value <= sbi->s_mb_prealloc_table[i])
-+                      return;
-+      }
-+}
- static int ext4_mb_good_group(struct ext4_allocation_context *ac,
-                               ext4_group_t group, int cr)
-@@ -2173,6 +2193,80 @@
-       .show   = ext4_mb_seq_groups_show,
- };
-+#define EXT4_MB_PREALLOC_TABLE          "prealloc_table"
-+
-+static int ext4_mb_prealloc_table_proc_read(char *page, char **start, off_t off,
-+                                          int count, int *eof, void *data)
-+{
-+      struct ext4_sb_info *sbi = data;
-+      int len = 0;
-+      int i;
-+
-+      *eof = 1;
-+      if (off != 0)
-+              return 0;
-+
-+      for (i = 0; i < sbi->s_mb_prealloc_table_size; i++)
-+              len += sprintf(page + len, "%ld ",
-+                             sbi->s_mb_prealloc_table[i]);
-+      len += sprintf(page + len, "\n");
-+
-+      *start = page;
-+      return len;
-+}
-+
-+static int ext4_mb_prealloc_table_proc_write(struct file *file,
-+                                           const char __user *buf,
-+                                           unsigned long cnt, void *data)
-+{
-+      struct ext4_sb_info *sbi = data;
-+      unsigned long value;
-+      unsigned long prev = 0;
-+      char str[128];
-+      char *cur;
-+      char *end;
-+      unsigned long *new_table;
-+      int num = 0;
-+      int i = 0;
-+
-+      if (cnt >= sizeof(str))
-+              return -EINVAL;
-+      if (copy_from_user(str, buf, cnt))
-+              return -EFAULT;
-+
-+      num = 0;
-+      cur = str;
-+      end = str + cnt;
-+      while (cur < end) {
-+              while ((cur < end) && (*cur == ' ')) cur++;
-+              value = simple_strtol(cur, &cur, 0);
-+              if (value == 0)
-+                      break;
-+              if (value <= prev)
-+                      return -EINVAL;
-+              prev = value;
-+              num++;
-+      }
-+
-+      new_table = kmalloc(num * sizeof(*new_table), GFP_KERNEL);
-+      if (new_table == NULL)
-+              return -ENOMEM;
-+      kfree(sbi->s_mb_prealloc_table);
-+      memset(new_table, 0, num * sizeof(*new_table));
-+      sbi->s_mb_prealloc_table = new_table;
-+      sbi->s_mb_prealloc_table_size = num;
-+      cur = str;
-+      end = str + cnt;
-+      while (cur < end && i < num) {
-+      while ((cur < end) && (*cur == ' ')) cur++;
-+              value = simple_strtol(cur, &cur, 0);
-+              ext4_mb_prealloc_table_add(sbi, value);
-+              i++;
-+      }
-+
-+      return cnt;
-+}
-+
- static int ext4_mb_seq_groups_open(struct inode *inode, struct file *file)
- {
-       struct super_block *sb = PDE(inode)->data;
-@@ -2397,14 +2497,6 @@ int ext4_mb_init(struct super_block *sb,
-               i++;
-       } while (i <= sb->s_blocksize_bits + 1);
--      /* init file for buddy data */
--      ret = ext4_mb_init_backend(sb);
--      if (ret != 0) {
--              kfree(sbi->s_mb_offsets);
--              kfree(sbi->s_mb_maxs);
--              return ret;
--      }
--
-       spin_lock_init(&sbi->s_md_lock);
-       spin_lock_init(&sbi->s_bal_lock);
-@@ -2411,12 +2505,56 @@
-       sbi->s_mb_max_to_scan = MB_DEFAULT_MAX_TO_SCAN;
-       sbi->s_mb_min_to_scan = MB_DEFAULT_MIN_TO_SCAN;
-       sbi->s_mb_stats = MB_DEFAULT_STATS;
--      sbi->s_mb_stream_request = MB_DEFAULT_STREAM_THRESHOLD;
-       sbi->s_mb_order2_reqs = MB_DEFAULT_ORDER2_REQS;
--      sbi->s_mb_group_prealloc = MB_DEFAULT_GROUP_PREALLOC;
-+
-+      if (sbi->s_stripe == 0) {
-+              sbi->s_mb_prealloc_table_size = 10;
-+              i = sbi->s_mb_prealloc_table_size * sizeof(unsigned long);
-+              sbi->s_mb_prealloc_table = kmalloc(i, GFP_NOFS);
-+              if (sbi->s_mb_prealloc_table == NULL) {
-+                      kfree(sbi->s_mb_offsets);
-+                      kfree(sbi->s_mb_maxs);
-+                      return -ENOMEM;
-+              }
-+              memset(sbi->s_mb_prealloc_table, 0, i);
-+
-+              ext4_mb_prealloc_table_add(sbi, 4);
-+              ext4_mb_prealloc_table_add(sbi, 8);
-+              ext4_mb_prealloc_table_add(sbi, 16);
-+              ext4_mb_prealloc_table_add(sbi, 32);
-+              ext4_mb_prealloc_table_add(sbi, 64);
-+              ext4_mb_prealloc_table_add(sbi, 128);
-+              ext4_mb_prealloc_table_add(sbi, 256);
-+              ext4_mb_prealloc_table_add(sbi, 512);
-+              ext4_mb_prealloc_table_add(sbi, 1024);
-+              ext4_mb_prealloc_table_add(sbi, 2048);
-+
-+              sbi->s_mb_small_req = 256;
-+              sbi->s_mb_large_req = 1024;
-+              sbi->s_mb_group_prealloc = 512;
-+      } else {
-+              sbi->s_mb_prealloc_table_size = 3;
-+              i = sbi->s_mb_prealloc_table_size * sizeof(unsigned long);
-+              sbi->s_mb_prealloc_table = kmalloc(i, GFP_NOFS);
-+              if (sbi->s_mb_prealloc_table == NULL) {
-+                      kfree(sbi->s_mb_offsets);
-+                      kfree(sbi->s_mb_maxs);
-+                      return -ENOMEM;
-+              }
-+              memset(sbi->s_mb_prealloc_table, 0, i);
-+
-+              ext4_mb_prealloc_table_add(sbi, sbi->s_stripe);
-+              ext4_mb_prealloc_table_add(sbi, sbi->s_stripe * 2);
-+              ext4_mb_prealloc_table_add(sbi, sbi->s_stripe * 4);
-+
-+              sbi->s_mb_small_req = sbi->s_stripe;
-+              sbi->s_mb_large_req = sbi->s_stripe * 8;
-+              sbi->s_mb_group_prealloc = sbi->s_stripe * 4;
-+      }
-       sbi->s_locality_groups = alloc_percpu(struct ext4_locality_group);
-       if (sbi->s_locality_groups == NULL) {
-+              kfree(sbi->s_mb_prealloc_table);
-               kfree(sbi->s_mb_offsets);
-               kfree(sbi->s_mb_maxs);
-               return -ENOMEM;
-@@ -2430,9 +2568,27 @@
-               spin_lock_init(&lg->lg_prealloc_lock);
-       }
-+      /* init file for buddy data */
-+      ret = ext4_mb_init_backend(sb);
-+      if (ret != 0) {
-+              kfree(sbi->s_mb_prealloc_table);
-+              kfree(sbi->s_mb_offsets);
-+              kfree(sbi->s_mb_maxs);
-+              return ret;
-+      }
-+
--      if (sbi->s_proc)
-+      if (sbi->s_proc) {
-+              struct proc_dir_entry *p;
-               proc_create_data("mb_groups", S_IRUGO, sbi->s_proc,
-                                &ext4_mb_seq_groups_fops, sb);
-+              p = create_proc_entry(EXT4_MB_PREALLOC_TABLE, S_IFREG |
-+                                    S_IRUGO | S_IWUSR, sbi->s_proc);
-+              if (p) {
-+                      p->data = sbi;
-+                      p->read_proc = ext4_mb_prealloc_table_proc_read;
-+                      p->write_proc = ext4_mb_prealloc_table_proc_write;
-+              }
-+      }
-       if (sbi->s_journal)
-               sbi->s_journal->j_commit_callback = release_blocks_on_commit;
-@@ -2483,6 +2639,7 @@
-                       kfree(sbi->s_group_info[i]);
-               kfree(sbi->s_group_info);
-       }
-+      kfree(sbi->s_mb_prealloc_table);
-       kfree(sbi->s_mb_offsets);
-       kfree(sbi->s_mb_maxs);
-       if (sbi->s_buddy_cache)
-@@ -2512,8 +2668,10 @@
-       }
-       free_percpu(sbi->s_locality_groups);
--      if (sbi->s_proc)
-+      if (sbi->s_proc) {
-               remove_proc_entry("mb_groups", sbi->s_proc);
-+              remove_proc_entry(EXT4_MB_PREALLOC_TABLE, sbi->s_proc);
-+      }
-       return 0;
- }
-@@ -2807,11 +2965,12 @@
- ext4_mb_normalize_request(struct ext4_allocation_context *ac,
-                               struct ext4_allocation_request *ar)
- {
--      int bsbits, max;
-+      int bsbits, i, wind;
-       ext4_lblk_t end;
--      loff_t size, orig_size, start_off;
-+      loff_t size, orig_size;
-       ext4_lblk_t start, orig_start;
-       struct ext4_inode_info *ei = EXT4_I(ac->ac_inode);
-+      struct ext4_sb_info *sbi = EXT4_SB(ac->ac_sb);
-       struct ext4_prealloc_space *pa;
-       /* do normalize only data requests, metadata requests
-@@ -2841,49 +3000,35 @@
-       size = size << bsbits;
-       if (size < i_size_read(ac->ac_inode))
-               size = i_size_read(ac->ac_inode);
-+      size = (size + ac->ac_sb->s_blocksize - 1) >> bsbits;
--      /* max size of free chunks */
--      max = 2 << bsbits;
-+      start = wind = 0;
--#define NRL_CHECK_SIZE(req, size, max, chunk_size)    \
--              (req <= (size) || max <= (chunk_size))
-+      /* let's choose preallocation window depending on file size */
-+      for (i = 0; i < sbi->s_mb_prealloc_table_size; i++) {
-+              if (size <= sbi->s_mb_prealloc_table[i]) {
-+                      wind = sbi->s_mb_prealloc_table[i];
-+                      break;
-+              }
-+      }
-+      size = wind;
--      /* first, try to predict filesize */
--      /* XXX: should this table be tunable? */
--      start_off = 0;
--      if (size <= 16 * 1024) {
--              size = 16 * 1024;
--      } else if (size <= 32 * 1024) {
--              size = 32 * 1024;
--      } else if (size <= 64 * 1024) {
--              size = 64 * 1024;
--      } else if (size <= 128 * 1024) {
--              size = 128 * 1024;
--      } else if (size <= 256 * 1024) {
--              size = 256 * 1024;
--      } else if (size <= 512 * 1024) {
--              size = 512 * 1024;
--      } else if (size <= 1024 * 1024) {
--              size = 1024 * 1024;
--      } else if (NRL_CHECK_SIZE(size, 4 * 1024 * 1024, max, 2 * 1024)) {
--              start_off = ((loff_t)ac->ac_o_ex.fe_logical >>
--                                              (21 - bsbits)) << 21;
--              size = 2 * 1024 * 1024;
--      } else if (NRL_CHECK_SIZE(size, 8 * 1024 * 1024, max, 4 * 1024)) {
--              start_off = ((loff_t)ac->ac_o_ex.fe_logical >>
--                                                      (22 - bsbits)) << 22;
--              size = 4 * 1024 * 1024;
--      } else if (NRL_CHECK_SIZE(ac->ac_o_ex.fe_len,
--                                      (8<<20)>>bsbits, max, 8 * 1024)) {
--              start_off = ((loff_t)ac->ac_o_ex.fe_logical >>
--                                                      (23 - bsbits)) << 23;
--              size = 8 * 1024 * 1024;
--      } else {
--              start_off = (loff_t)ac->ac_o_ex.fe_logical << bsbits;
--              size      = ac->ac_o_ex.fe_len << bsbits;
-+      if (wind == 0) {
-+              __u64 tstart, tend;
-+              /* file is quite large, we now preallocate with
-+               * the biggest configured window with regart to
-+               * logical offset */
-+              wind = sbi->s_mb_prealloc_table[i - 1];
-+              tstart = ac->ac_o_ex.fe_logical;
-+              do_div(tstart, wind);
-+              start = tstart * wind;
-+              tend = ac->ac_o_ex.fe_logical + ac->ac_o_ex.fe_len - 1;
-+              do_div(tend, wind);
-+              tend = tend * wind + wind;
-+              size = tend - start;
-       }
--      orig_size = size = size >> bsbits;
--      orig_start = start = start_off >> bsbits;
-+      orig_size = size;
-+      orig_start = start;
-       /* don't cover already allocated blocks in selected range */
-       if (ar->pleft && start <= ar->lleft) {
-@@ -2955,7 +3100,6 @@
-       }
-       BUG_ON(start + size <= ac->ac_o_ex.fe_logical &&
-                       start > ac->ac_o_ex.fe_logical);
--      BUG_ON(size <= 0 || size > EXT4_BLOCKS_PER_GROUP(ac->ac_sb));
-       /* now prepare goal request */
-@@ -3939,11 +4083,19 @@
-       /* don't use group allocation for large files */
-       size = max(size, isize);
--      if (size > sbi->s_mb_stream_request) {
-+      if ((ac->ac_o_ex.fe_len >= sbi->s_mb_small_req) ||
-+          (size >= sbi->s_mb_large_req)) {
-               ac->ac_flags |= EXT4_MB_STREAM_ALLOC;
-               return;
-       }
-+      /*
-+       * request is so large that we don't care about
-+       * streaming - it overweights any possible seek
-+       */
-+      if (ac->ac_o_ex.fe_len >= sbi->s_mb_large_req)
-+              return;
-+
-       BUG_ON(ac->ac_lg != NULL);
-       /*
-        * locality group prealloc space are per cpu. The reason for having
-Index: linux-stage/fs/ext4/super.c
-===================================================================
---- linux-stage.orig/fs/ext4/super.c   2011-03-11 14:16:56.000000000 +0800
-+++ linux-stage/fs/ext4/super.c        2011-03-11 14:19:24.664467626 +0800
-@@ -2632,7 +2632,8 @@
- EXT4_RW_ATTR_SBI_UI(mb_max_to_scan, s_mb_max_to_scan);
- EXT4_RW_ATTR_SBI_UI(mb_min_to_scan, s_mb_min_to_scan);
- EXT4_RW_ATTR_SBI_UI(mb_order2_req, s_mb_order2_reqs);
--EXT4_RW_ATTR_SBI_UI(mb_stream_req, s_mb_stream_request);
-+EXT4_RW_ATTR_SBI_UI(mb_small_req, s_mb_small_req);
-+EXT4_RW_ATTR_SBI_UI(mb_large_req, s_mb_large_req);
- EXT4_RW_ATTR_SBI_UI(mb_group_prealloc, s_mb_group_prealloc);
- EXT4_RW_ATTR_SBI_UI(max_writeback_mb_bump, s_max_writeback_mb_bump);
-@@ -2647,7 +2648,8 @@
-       ATTR_LIST(mb_max_to_scan),
-       ATTR_LIST(mb_min_to_scan),
-       ATTR_LIST(mb_order2_req),
--      ATTR_LIST(mb_stream_req),
-+      ATTR_LIST(mb_small_req),
-+      ATTR_LIST(mb_large_req),
-       ATTR_LIST(mb_group_prealloc),
-       ATTR_LIST(max_writeback_mb_bump),
-       NULL,
diff --git a/ldiskfs/kernel_patches/patches/rhel6.3/ext4-quota-dont-update-cmtime.patch b/ldiskfs/kernel_patches/patches/rhel6.3/ext4-quota-dont-update-cmtime.patch
deleted file mode 100644 (file)
index 4c0a7f5..0000000
+++ /dev/null
@@ -1,92 +0,0 @@
-commit 21f976975cbecbdaf23ceeacc1cab2b1c05a028e
-Author: Jan Kara <jack@suse.cz>
-Date:   Mon Apr 4 15:33:39 2011 -0400
-
-    ext4: remove unnecessary [cm]time update of quota file
-
-    It is not necessary to update [cm]time of quota file on each quota
-    file write and it wastes journal space and IO throughput with inode
-    writes. So just remove the updating from ext4_quota_write() and only
-    update times when quotas are being turned off. Userspace cannot get
-    anything reliable from quota files while they are used by the kernel
-    anyway.
-
-    Signed-off-by: Jan Kara <jack@suse.cz>
-    Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
-
-Index: linux-stage/fs/ext4/ext4_jbd2.h
-===================================================================
---- linux-stage.orig/fs/ext4/ext4_jbd2.h       2012-06-26 11:26:25.000000000 +0200
-+++ linux-stage/fs/ext4/ext4_jbd2.h    2012-06-26 11:35:31.025105000 +0200
-@@ -88,8 +88,8 @@
- #ifdef CONFIG_QUOTA
- /* Amount of blocks needed for quota update - we know that the structure was
-- * allocated so we need to update only inode+data */
--#define EXT4_QUOTA_TRANS_BLOCKS(sb) (test_opt(sb, QUOTA) ? 2 : 0)
-+ * allocated so we need to update only data block */
-+#define EXT4_QUOTA_TRANS_BLOCKS(sb) (test_opt(sb, QUOTA) ? 1 : 0)
- /* Amount of blocks needed for quota insert/delete - we do some block writes
-  * but inode, sb and group updates are done only once */
- #define EXT4_QUOTA_INIT_BLOCKS(sb) (test_opt(sb, QUOTA) ? (DQUOT_INIT_ALLOC*\
-Index: linux-stage/fs/ext4/super.c
-===================================================================
---- linux-stage.orig/fs/ext4/super.c   2012-06-26 11:35:09.000000000 +0200
-+++ linux-stage/fs/ext4/super.c        2012-06-26 11:37:30.905374000 +0200
-@@ -4582,6 +4582,7 @@ static int ext4_quota_on(struct super_bl
- static int ext4_quota_off(struct super_block *sb, int type, int remount)
- {
-       struct quota_info *dqopt = sb_dqopt(sb);
-+      int                cnt;
-       mutex_lock(&dqopt->dqonoff_mutex);
-       if (!sb_any_quota_loaded(sb)) {
-@@ -4598,6 +4599,37 @@ static int ext4_quota_off(struct super_b
-               up_read(&sb->s_umount);
-       }
-+      for (cnt = 0; cnt < MAXQUOTAS; cnt++) {
-+              struct inode      *inode;
-+              handle_t          *handle;
-+
-+              if (type != -1 && cnt != type)
-+                      continue;
-+
-+              mutex_lock(&dqopt->dqonoff_mutex);
-+              inode = dqopt->files[cnt];
-+              if (!sb_has_quota_loaded(sb, cnt) || !inode) {
-+                      mutex_unlock(&dqopt->dqonoff_mutex);
-+                      continue;
-+              }
-+
-+              inode = igrab(inode);
-+              mutex_unlock(&dqopt->dqonoff_mutex);
-+
-+              if (!inode)
-+                      continue;
-+
-+              /* Update modification times of quota files when userspace can
-+               * start looking at them */
-+              handle = ext4_journal_start(inode, 1);
-+              if (!IS_ERR(handle)) {
-+                      inode->i_mtime = inode->i_ctime = CURRENT_TIME;
-+                      ext4_mark_inode_dirty(handle, inode);
-+                      ext4_journal_stop(handle);
-+              }
-+              iput(inode);
-+      }
-+
-       return vfs_quota_off(sb, type, remount);
- }
-@@ -4696,9 +4728,8 @@ out:
-       if (inode->i_size < off + len) {
-               i_size_write(inode, off + len);
-               EXT4_I(inode)->i_disksize = inode->i_size;
-+              ext4_mark_inode_dirty(handle, inode);
-       }
--      inode->i_mtime = inode->i_ctime = CURRENT_TIME;
--      ext4_mark_inode_dirty(handle, inode);
-       mutex_unlock(&inode->i_mutex);
-       return len;
- }
diff --git a/ldiskfs/kernel_patches/patches/rhel6.3/ext4-quota-first-class.patch b/ldiskfs/kernel_patches/patches/rhel6.3/ext4-quota-first-class.patch
deleted file mode 100644 (file)
index 85a9108..0000000
+++ /dev/null
@@ -1,408 +0,0 @@
-From: Aditya Kali <adityakali@google.com>
-
-This patch is an attempt towards supporting quotas as first class
-feature in ext4. It is based on the proposal at:
-https://ext4.wiki.kernel.org/index.php/Design_For_1st_Class_Quota_in_Ext4
-This patch introduces a new feature - EXT4_FEATURE_RO_COMPAT_QUOTA which, when
-turned on, enables quota accounting at mount time iteself. Also, the
-quota inodes are stored in two additional superblock fields.
-Some changes introduced by this patch that should be pointed out are:
-1) Two new ext4-superblock fields - s_usr_quota_inum and s_grp_quota_inum
-   for storing the quota inodes in use.
-2) If the QUOTA feature and corresponding quota inodes are set in superblock,
-   Quotas are turned on at mount time irrespective of the quota mount options.
-   Thus the mount options 'quota', 'usrquota' and 'grpquota' are completely
-   ignored with the new QUOTA feature flag.
-3) Default quota inodes are: inode#3 for tracking userquota and inode#4 for
-   tracking group quota. The superblock fields can be set to use other inodes
-   as well.
-4) mke2fs or tune2fs will initialize these inodes when quota feature is
-   being set. The default reserved inodes will not be visible to user as
-   regular files.
-5) Once quotas are turned on, they cannot be turned off while the FS is
-   mounted. This is because we do not want to let the quota get inconsistent.
-6) With the QUOTA feature set, since the quota inodes are hidden, some of the
-   utilities from quota-tools will no longer work correctly. Instead, e2fsprogs
-   will include support for fixing the quota files.
-7) Support is only for the new V2 quota file format.
-
-Signed-off-by: Aditya Kali <adityakali@google.com>
----
-Index: linux-stage/fs/ext4/ext4.h
-===================================================================
---- linux-stage.orig/fs/ext4/ext4.h
-+++ linux-stage/fs/ext4/ext4.h
-@@ -185,6 +185,8 @@ typedef struct ext4_io_end {
-  */
- #define       EXT4_BAD_INO             1      /* Bad blocks inode */
- #define EXT4_ROOT_INO          2      /* Root inode */
-+#define EXT4_USR_QUOTA_INO       3      /* User quota inode */
-+#define EXT4_GRP_QUOTA_INO       4      /* Group quota inode */
- #define EXT4_BOOT_LOADER_INO   5      /* Boot loader inode */
- #define EXT4_UNDEL_DIR_INO     6      /* Undelete directory inode */
- #define EXT4_RESIZE_INO                7      /* Reserved group descriptors inode */
-@@ -1042,7 +1044,9 @@ struct ext4_super_block {
-       __u8    s_last_error_func[32];  /* function where the error happened */
- #define EXT4_S_ERR_END offsetof(struct ext4_super_block, s_mount_opts)
-       __u8    s_mount_opts[64];
--      __le32  s_reserved[112];        /* Padding to the end of the block */
-+      __le32  s_usr_quota_inum;       /* inode for tracking user quota */
-+      __le32  s_grp_quota_inum;       /* inode for tracking group quota */
-+      __le32  s_reserved[110];        /* Padding to the end of the block */
- };
- #ifdef __KERNEL__
-@@ -1116,6 +1120,7 @@ struct ext4_sb_info {
- #ifdef CONFIG_QUOTA
-       char *s_qf_names[MAXQUOTAS];            /* Names of quota files with journalled quota */
-       int s_jquota_fmt;                       /* Format of quota to use */
-+      unsigned long s_qf_inums[MAXQUOTAS];    /* Quota file inodes */
- #endif
-       unsigned int s_want_extra_isize; /* New inodes should reserve # bytes */
-       struct rb_root system_blks;
-@@ -1216,6 +1221,8 @@ static inline struct timespec ext4_curre
- static inline int ext4_valid_inum(struct super_block *sb, unsigned long ino)
- {
-       return ino == EXT4_ROOT_INO ||
-+              ino == EXT4_USR_QUOTA_INO ||
-+              ino == EXT4_GRP_QUOTA_INO ||
-               ino == EXT4_JOURNAL_INO ||
-               ino == EXT4_RESIZE_INO ||
-               (ino >= EXT4_FIRST_INO(sb) &&
-@@ -1320,6 +1327,7 @@ EXT4_INODE_BIT_FNS(state, state_flags)
- #define EXT4_FEATURE_RO_COMPAT_GDT_CSUM               0x0010
- #define EXT4_FEATURE_RO_COMPAT_DIR_NLINK      0x0020
- #define EXT4_FEATURE_RO_COMPAT_EXTRA_ISIZE    0x0040
-+#define EXT4_FEATURE_RO_COMPAT_QUOTA          0x0100
- #define EXT4_FEATURE_INCOMPAT_COMPRESSION     0x0001
- #define EXT4_FEATURE_INCOMPAT_FILETYPE                0x0002
-@@ -1352,7 +1360,8 @@ EXT4_INODE_BIT_FNS(state, state_flags)
-                                        EXT4_FEATURE_RO_COMPAT_DIR_NLINK | \
-                                        EXT4_FEATURE_RO_COMPAT_EXTRA_ISIZE | \
-                                        EXT4_FEATURE_RO_COMPAT_BTREE_DIR |\
--                                       EXT4_FEATURE_RO_COMPAT_HUGE_FILE)
-+                                       EXT4_FEATURE_RO_COMPAT_HUGE_FILE| \
-+                                       EXT4_FEATURE_RO_COMPAT_QUOTA)
- /*
-  * Default values for user and/or group using reserved blocks
-Index: linux-stage/fs/ext4/ext4_jbd2.h
-===================================================================
---- linux-stage.orig/fs/ext4/ext4_jbd2.h       2012-06-26 11:35:31.025105000 +0200
-+++ linux-stage/fs/ext4/ext4_jbd2.h    2012-06-26 11:37:38.250631000 +0200
-@@ -89,14 +89,20 @@
- #ifdef CONFIG_QUOTA
- /* Amount of blocks needed for quota update - we know that the structure was
-  * allocated so we need to update only data block */
--#define EXT4_QUOTA_TRANS_BLOCKS(sb) (test_opt(sb, QUOTA) ? 1 : 0)
-+#define EXT4_QUOTA_TRANS_BLOCKS(sb) ((test_opt(sb, QUOTA) ||\
-+              EXT4_HAS_RO_COMPAT_FEATURE(sb, EXT4_FEATURE_RO_COMPAT_QUOTA)) ?\
-+              1 : 0)
- /* Amount of blocks needed for quota insert/delete - we do some block writes
-  * but inode, sb and group updates are done only once */
--#define EXT4_QUOTA_INIT_BLOCKS(sb) (test_opt(sb, QUOTA) ? (DQUOT_INIT_ALLOC*\
--              (EXT4_SINGLEDATA_TRANS_BLOCKS(sb)-3)+3+DQUOT_INIT_REWRITE) : 0)
-+#define EXT4_QUOTA_INIT_BLOCKS(sb) ((test_opt(sb, QUOTA) ||\
-+              EXT4_HAS_RO_COMPAT_FEATURE(sb, EXT4_FEATURE_RO_COMPAT_QUOTA)) ?\
-+              (DQUOT_INIT_ALLOC*(EXT4_SINGLEDATA_TRANS_BLOCKS(sb)-3)\
-+               +3+DQUOT_INIT_REWRITE) : 0)
--#define EXT4_QUOTA_DEL_BLOCKS(sb) (test_opt(sb, QUOTA) ? (DQUOT_DEL_ALLOC*\
--              (EXT4_SINGLEDATA_TRANS_BLOCKS(sb)-3)+3+DQUOT_DEL_REWRITE) : 0)
-+#define EXT4_QUOTA_DEL_BLOCKS(sb) ((test_opt(sb, QUOTA) ||\
-+              EXT4_HAS_RO_COMPAT_FEATURE(sb, EXT4_FEATURE_RO_COMPAT_QUOTA)) ?\
-+              (DQUOT_DEL_ALLOC*(EXT4_SINGLEDATA_TRANS_BLOCKS(sb)-3)\
-+               +3+DQUOT_DEL_REWRITE) : 0)
- #else
- #define EXT4_QUOTA_TRANS_BLOCKS(sb) 0
- #define EXT4_QUOTA_INIT_BLOCKS(sb) 0
-Index: linux-stage/fs/ext4/super.c
-===================================================================
---- linux-stage.orig/fs/ext4/super.c
-+++ linux-stage/fs/ext4/super.c
-@@ -115,6 +115,11 @@ void ext4_kvfree(void *ptr)
- static int bigendian_extents;
-+#ifdef CONFIG_QUOTA
-+static int ext4_acct_on(struct super_block *sb);
-+static int ext4_acct_off(struct super_block *sb);
-+#endif
-+
- ext4_fsblk_t ext4_block_bitmap(struct super_block *sb,
-                              struct ext4_group_desc *bg)
- {
-@@ -703,6 +708,12 @@ static void ext4_put_super(struct super_
-       ext4_unregister_li_request(sb);
-+#ifdef CONFIG_QUOTA
-+      /* disable usage tracking which was enabled at mount time */
-+      if (EXT4_HAS_RO_COMPAT_FEATURE(sb, EXT4_FEATURE_RO_COMPAT_QUOTA))
-+              ext4_acct_off(sb);
-+#endif
-+
-       flush_workqueue(sbi->dio_unwritten_wq);
-       destroy_workqueue(sbi->dio_unwritten_wq);
-@@ -2162,14 +2173,22 @@ static void ext4_orphan_cleanup(struct s
- #ifdef CONFIG_QUOTA
-       /* Needed for iput() to work correctly and not trash data */
-       sb->s_flags |= MS_ACTIVE;
--      /* Turn on quotas so that they are updated correctly */
--      for (i = 0; i < MAXQUOTAS; i++) {
--              if (EXT4_SB(sb)->s_qf_names[i]) {
--                      int ret = ext4_quota_on_mount(sb, i);
--                      if (ret < 0)
--                              ext4_msg(sb, KERN_ERR,
--                                      "Cannot turn on journaled "
--                                      "quota: error %d", ret);
-+      if (EXT4_HAS_RO_COMPAT_FEATURE(sb, EXT4_FEATURE_RO_COMPAT_QUOTA)) {
-+              int ret;
-+              ret = ext4_acct_on(sb);
-+              if (ret)
-+                      ext4_msg(sb, KERN_ERR, "Failed to turn on usage "
-+                               "tracking for quota: error %d", ret);
-+      } else {
-+              /* Turn on quotas so that they are updated correctly */
-+              for (i = 0; i < MAXQUOTAS; i++) {
-+                      if (EXT4_SB(sb)->s_qf_names[i]) {
-+                              int ret = ext4_quota_on_mount(sb, i);
-+                              if (ret < 0)
-+                                      ext4_msg(sb, KERN_ERR,
-+                                              "Cannot turn on journaled "
-+                                              "quota: error %d", ret);
-+                      }
-               }
-       }
- #endif
-@@ -2213,10 +2232,14 @@ static void ext4_orphan_cleanup(struct s
-               ext4_msg(sb, KERN_INFO, "%d truncate%s cleaned up",
-                      PLURAL(nr_truncates));
- #ifdef CONFIG_QUOTA
--      /* Turn quotas off */
--      for (i = 0; i < MAXQUOTAS; i++) {
--              if (sb_dqopt(sb)->files[i])
--                      vfs_quota_off(sb, i, 0);
-+      if (EXT4_HAS_RO_COMPAT_FEATURE(sb, EXT4_FEATURE_RO_COMPAT_QUOTA)) {
-+              ext4_acct_off(sb);
-+      } else {
-+              /* Turn quotas off */
-+              for (i = 0; i < MAXQUOTAS; i++) {
-+                      if (sb_dqopt(sb)->files[i])
-+                              vfs_quota_off(sb, i, 0);
-+              }
-       }
- #endif
-       sb->s_flags = s_flags; /* Restore MS_RDONLY status */
-@@ -3408,6 +3431,15 @@ static int ext4_fill_super(struct super_
- #ifdef CONFIG_QUOTA
-       sb->s_qcop = &ext4_qctl_operations;
-       sb->dq_op = &ext4_quota_operations;
-+
-+      if (EXT4_HAS_RO_COMPAT_FEATURE(sb, EXT4_FEATURE_RO_COMPAT_QUOTA)) {
-+              /* Use new qctl operations with quota on function that does not
-+               * require user specified quota file path. */
-+              sb->s_qcop = &ext4_qctl_operations;
-+
-+              sbi->s_qf_inums[USRQUOTA] = es->s_usr_quota_inum;
-+              sbi->s_qf_inums[GRPQUOTA] = es->s_grp_quota_inum;
-+      }
- #endif
-       INIT_LIST_HEAD(&sbi->s_orphan); /* unlinked but open files */
-       mutex_init(&sbi->s_orphan_lock);
-@@ -3633,13 +3665,40 @@ no_journal:
-       } else
-               descr = "out journal";
--      ext4_msg(sb, KERN_INFO, "mounted filesystem with%s. "
--               "Opts: %s%s", descr, sbi->s_es->s_mount_opts,
-+#ifdef CONFIG_QUOTA
-+      /* Enable space tracking during mount, enforcement can be enabled/disable
-+       * later with quota_on/off */
-+      if (EXT4_HAS_RO_COMPAT_FEATURE(sb, EXT4_FEATURE_RO_COMPAT_QUOTA) &&
-+          !(sb->s_flags & MS_RDONLY)) {
-+              ret = ext4_acct_on(sb);
-+              if (ret) {
-+                      ext4_msg(sb, KERN_ERR, "Can't enable usage tracking on "
-+                               "a filesystem with the QUOTA feature set");
-+                      goto failed_mount8;
-+              }
-+      }
-+#else
-+      if (EXT4_HAS_RO_COMPAT_FEATURE(sb, EXT4_FEATURE_RO_COMPAT_QUOTA) &&
-+          !(sb->s_flags & MS_RDONLY))
-+              ext4_msg(sb, KERN_WARNING, "Mounting a filesystem with the "
-+                       "QUOTA feature set whereas the kernel does not "
-+                       "support quota, e2fsck will be required to fix usage "
-+                       "information");
-+
-+#endif  /* CONFIG_QUOTA */
-+
-+      ext4_msg(sb, KERN_INFO, "mounted filesystem with%s. quota=%s. "
-+               "Opts: %s%s", descr, sb_any_quota_loaded(sb) ? "on" : "off",
-+               sbi->s_es->s_mount_opts,
-                *sbi->s_es->s_mount_opts ? "; " : "");
-       lock_kernel();
-       return 0;
-+#ifdef CONFIG_QUOTA
-+failed_mount8:
-+      kobject_del(&sbi->s_kobj);
-+#endif
- cantfind_ext4:
-       if (!silent)
-               ext4_msg(sb, KERN_ERR, "VFS: Can't find ext4 filesystem");
-@@ -3991,6 +4050,12 @@ static int ext4_commit_super(struct supe
-                                       &EXT4_SB(sb)->s_freeblocks_counter));
-       es->s_free_inodes_count = cpu_to_le32(percpu_counter_sum_positive(
-                                       &EXT4_SB(sb)->s_freeinodes_counter));
-+#ifdef CONFIG_QUOTA
-+      if (EXT4_HAS_RO_COMPAT_FEATURE(sb, EXT4_FEATURE_RO_COMPAT_QUOTA)) {
-+              es->s_usr_quota_inum = EXT4_SB(sb)->s_qf_inums[USRQUOTA];
-+              es->s_grp_quota_inum = EXT4_SB(sb)->s_qf_inums[GRPQUOTA];
-+      }
-+#endif
-       sb->s_dirt = 0;
-       BUFFER_TRACE(sbh, "marking dirty");
-       mark_buffer_dirty(sbh);
-@@ -4552,6 +4617,22 @@ static int ext4_quota_on(struct super_bl
-       int err;
-       struct path path;
-+      /* When QUOTA feature is set, quota on enables enforcement, accounting
-+       * being already enabled at mount time */
-+      if (EXT4_HAS_RO_COMPAT_FEATURE(sb, EXT4_FEATURE_RO_COMPAT_QUOTA)) {
-+              struct inode *qf_inode;
-+
-+              if (!EXT4_SB(sb)->s_qf_inums[type])
-+                      return -EINVAL;
-+              qf_inode = ext4_iget(sb, EXT4_SB(sb)->s_qf_inums[type]);
-+              if (IS_ERR(qf_inode))
-+                      return PTR_ERR(qf_inode);
-+              err = vfs_quota_enable(qf_inode, type, QFMT_VFS_V1,
-+                                     DQUOT_LIMITS_ENABLED);
-+              iput(qf_inode);
-+              return err;
-+      }
-+
-       if (!test_opt(sb, QUOTA))
-               return -EINVAL;
-       /* When remounting, no checks are needed and in fact, name is NULL */
-@@ -4651,9 +4732,114 @@ static int ext4_quota_off(struct super_b
-               iput(inode);
-       }
-+      /* When QUOTA feature is set, quota off just disables enforcement but
-+       * leaves accounting on */
-+      if (EXT4_HAS_RO_COMPAT_FEATURE(sb, EXT4_FEATURE_RO_COMPAT_QUOTA))
-+              return vfs_quota_disable(sb, type, DQUOT_LIMITS_ENABLED);
-+
-       return vfs_quota_off(sb, type, remount);
- }
-+/*
-+ * New quota_on function that is used to turn accounting on when QUOTA
-+ * feature is set.
-+ */
-+static int ext4_acct_on(struct super_block *sb)
-+{
-+      struct inode *qf_inode[MAXQUOTAS];
-+      int           rc;
-+
-+      if (!EXT4_HAS_RO_COMPAT_FEATURE(sb, EXT4_FEATURE_RO_COMPAT_QUOTA) ||
-+          !EXT4_SB(sb)->s_qf_inums[USRQUOTA] ||
-+          !EXT4_SB(sb)->s_qf_inums[GRPQUOTA])
-+              return -EINVAL;
-+
-+      qf_inode[USRQUOTA] = ext4_iget(sb, EXT4_SB(sb)->s_qf_inums[USRQUOTA]);
-+      if (IS_ERR(qf_inode[USRQUOTA])) {
-+              EXT4_SB(sb)->s_qf_inums[USRQUOTA] = 0;
-+              return PTR_ERR(qf_inode[USRQUOTA]);
-+      }
-+      qf_inode[GRPQUOTA] = ext4_iget(sb, EXT4_SB(sb)->s_qf_inums[GRPQUOTA]);
-+      if (IS_ERR(qf_inode[GRPQUOTA])) {
-+              iput(qf_inode[USRQUOTA]);
-+              EXT4_SB(sb)->s_qf_inums[GRPQUOTA] = 0;
-+              return PTR_ERR(qf_inode[GRPQUOTA]);
-+      }
-+
-+      /*
-+       * When we journal data on quota file, we have to flush journal to see
-+       * all updates to the file when we bypass pagecache...
-+       */
-+      if (EXT4_SB(sb)->s_journal) {
-+              /*
-+               * We don't need to lock updates but journal_flush() could
-+               * otherwise be livelocked...
-+               */
-+              jbd2_journal_lock_updates(EXT4_SB(sb)->s_journal);
-+              rc = jbd2_journal_flush(EXT4_SB(sb)->s_journal);
-+              jbd2_journal_unlock_updates(EXT4_SB(sb)->s_journal);
-+              if (rc) {
-+                      iput(qf_inode[USRQUOTA]);
-+                      iput(qf_inode[GRPQUOTA]);
-+                      return rc;
-+              }
-+      }
-+
-+      /* only enable quota accounting by default */
-+      rc = vfs_quota_enable(qf_inode[USRQUOTA], USRQUOTA, QFMT_VFS_V1,
-+                            DQUOT_USAGE_ENABLED);
-+      iput(qf_inode[USRQUOTA]);
-+      if (rc) {
-+              iput(qf_inode[GRPQUOTA]);
-+              return rc;
-+      }
-+      rc = vfs_quota_enable(qf_inode[GRPQUOTA], GRPQUOTA, QFMT_VFS_V1,
-+                            DQUOT_USAGE_ENABLED);
-+      iput(qf_inode[GRPQUOTA]);
-+      return rc;
-+}
-+
-+/*
-+ * New quota_on function that is used to turn off accounting when QUOTA feature
-+ * is set.
-+ */
-+static int ext4_acct_off(struct super_block *sb)
-+{
-+      int type, rc = 0;
-+
-+      if (!EXT4_HAS_RO_COMPAT_FEATURE(sb, EXT4_FEATURE_RO_COMPAT_QUOTA))
-+              return -EINVAL;
-+
-+      for (type = 0; type < MAXQUOTAS; type++) {
-+              struct inode *inode = sb_dqopt(sb)->files[type];
-+              handle_t     *handle;
-+
-+              if (!inode)
-+                      continue;
-+              /* Update modification times of quota files when userspace can
-+               * start looking at them */
-+              handle = ext4_journal_start(inode, 1);
-+              if (IS_ERR(handle))
-+                      goto out;
-+
-+              inode->i_mtime = inode->i_ctime = CURRENT_TIME;
-+              ext4_mark_inode_dirty(handle, inode);
-+              ext4_journal_stop(handle);
-+      }
-+
-+out:
-+      for (type = 0; type < MAXQUOTAS; type++) {
-+              int ret;
-+              ret = vfs_quota_disable(sb, type,
-+                                  DQUOT_USAGE_ENABLED | DQUOT_LIMITS_ENABLED);
-+              if (!rc && ret)
-+                      rc = ret;
-+      }
-+      return rc;
-+}
-+
-+
-+
- /* Read data from quotafile - avoid pagecache and such because we cannot afford
-  * acquiring the locks... As quota files are never truncated and quota code
-  * itself serializes the operations (and noone else should touch the files)
diff --git a/ldiskfs/kernel_patches/patches/rhel6.3/ext4-quota-force-block-alloc-quotaoff.patch b/ldiskfs/kernel_patches/patches/rhel6.3/ext4-quota-force-block-alloc-quotaoff.patch
deleted file mode 100644 (file)
index d72dd05..0000000
+++ /dev/null
@@ -1,62 +0,0 @@
-commit ca0e05e4b15193aeba72b995e90de990db7f8304
-Author: Dmitry Monakhov <dmonakhov@openvz.org>
-Date:   Sun Aug 1 17:48:36 2010 -0400
-
-    ext4: force block allocation on quota_off
-    
-    Perform full sync procedure so that any delayed allocation blocks are
-    allocated so quota will be consistent.
-    
-    Signed-off-by: Dmitry Monakhov <dmonakhov@openvz.org>
-    Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
-
-Index: linux-stage/fs/ext4/super.c
-===================================================================
---- linux-stage.orig/fs/ext4/super.c   2012-06-26 09:37:06.039508000 +0200
-+++ linux-stage/fs/ext4/super.c        2012-06-26 11:35:09.824099000 +0200
-@@ -1104,6 +1104,7 @@ static int ext4_mark_dquot_dirty(struct
- static int ext4_write_info(struct super_block *sb, int type);
- static int ext4_quota_on(struct super_block *sb, int type, int format_id,
-                               char *path, int remount);
-+static int ext4_quota_off(struct super_block *sb, int type, int remount);
- static int ext4_quota_on_mount(struct super_block *sb, int type);
- static ssize_t ext4_quota_read(struct super_block *sb, int type, char *data,
-                              size_t len, loff_t off);
-@@ -1173,7 +1174,7 @@ static const struct dquot_operations ext
- static const struct quotactl_ops ext4_qctl_operations = {
-       .quota_on       = ext4_quota_on,
--      .quota_off      = vfs_quota_off,
-+      .quota_off      = ext4_quota_off,
-       .quota_sync     = vfs_quota_sync,
-       .get_info       = vfs_get_dqinfo,
-       .set_info       = vfs_set_dqinfo,
-@@ -4578,6 +4579,28 @@ static int ext4_quota_on(struct super_bl
-       return err;
- }
-+static int ext4_quota_off(struct super_block *sb, int type, int remount)
-+{
-+      struct quota_info *dqopt = sb_dqopt(sb);
-+
-+      mutex_lock(&dqopt->dqonoff_mutex);
-+      if (!sb_any_quota_loaded(sb)) {
-+              /* nothing to do */
-+              mutex_unlock(&dqopt->dqonoff_mutex);
-+              return 0;
-+      }
-+      mutex_unlock(&dqopt->dqonoff_mutex);
-+
-+      /* Force all delayed allocation blocks to be allocated. */
-+      if (test_opt(sb, DELALLOC)) {
-+              down_read(&sb->s_umount);
-+              sync_filesystem(sb);
-+              up_read(&sb->s_umount);
-+      }
-+
-+      return vfs_quota_off(sb, type, remount);
-+}
-+
- /* Read data from quotafile - avoid pagecache and such because we cannot afford
-  * acquiring the locks... As quota files are never truncated and quota code
-  * itself serializes the operations (and noone else should touch the files)
diff --git a/ldiskfs/kernel_patches/patches/rhel6.3/ext4-recalc-percpu-counters-after-journal.patch b/ldiskfs/kernel_patches/patches/rhel6.3/ext4-recalc-percpu-counters-after-journal.patch
deleted file mode 100644 (file)
index f54fc1a..0000000
+++ /dev/null
@@ -1,21 +0,0 @@
---- linux-stage.orig/fs/ext4/super.c
-+++ linux-stage/fs/ext4/super.c
-@@ -3613,6 +3613,18 @@ static int ext4_fill_super(struct super_
-       sbi->s_journal->j_commit_callback = ext4_journal_commit_callback;
-+      /*
-+       * The journal may have updated the bg summary counts, so we
-+       * need to update the global counters.
-+       */
-+      percpu_counter_set(&sbi->s_freeblocks_counter,
-+                         ext4_count_free_blocks(sb));
-+      percpu_counter_set(&sbi->s_freeinodes_counter,
-+                         ext4_count_free_inodes(sb));
-+      percpu_counter_set(&sbi->s_dirs_counter,
-+                         ext4_count_dirs(sb));
-+      percpu_counter_set(&sbi->s_dirtyblocks_counter, 0);
-+
- no_journal:
-       if (test_opt(sb, NOBH)) {
diff --git a/ldiskfs/kernel_patches/patches/rhel6.3/ext4-store-tree-generation-at-find.patch b/ldiskfs/kernel_patches/patches/rhel6.3/ext4-store-tree-generation-at-find.patch
deleted file mode 100644 (file)
index 9c87a92..0000000
+++ /dev/null
@@ -1,66 +0,0 @@
-Index: linux-stage/fs/ext4/ext4_extents.h
-===================================================================
---- linux-stage.orig/fs/ext4/ext4_extents.h
-+++ linux-stage/fs/ext4/ext4_extents.h
-@@ -113,6 +113,7 @@ struct ext4_extent_header {
-  * Truncate uses it to simulate recursive walking.
-  */
- struct ext4_ext_path {
-+      unsigned long                   p_generation;
-       ext4_fsblk_t                    p_block;
-       __u16                           p_depth;
-       struct ext4_extent              *p_ext;
-Index: linux-stage/fs/ext4/extents.c
-===================================================================
---- linux-stage.orig/fs/ext4/extents.c
-+++ linux-stage/fs/ext4/extents.c
-@@ -1855,7 +1855,7 @@ int ext4_ext_walk_space(struct inode *in
- {
-       struct ext4_ext_path *path = NULL;
-       struct ext4_ext_cache cbex;
--      struct ext4_extent *ex;
-+      struct ext4_extent _ex, *ex;
-       ext4_lblk_t next, start = 0, end = 0;
-       ext4_lblk_t last = block + num;
-       int depth, exists, err = 0;
-@@ -1868,21 +1868,29 @@ int ext4_ext_walk_space(struct inode *in
-               /* find extent for this block */
-               down_read(&EXT4_I(inode)->i_data_sem);
-               path = ext4_ext_find_extent(inode, block, path);
--              up_read(&EXT4_I(inode)->i_data_sem);
-               if (IS_ERR(path)) {
-+                      up_read(&EXT4_I(inode)->i_data_sem);
-                       err = PTR_ERR(path);
-                       path = NULL;
-                       break;
-               }
-+              path[0].p_generation = EXT4_I(inode)->i_ext_generation;
-+
-               depth = ext_depth(inode);
-               if (unlikely(path[depth].p_hdr == NULL)) {
-+                      up_read(&EXT4_I(inode)->i_data_sem);
-                       EXT4_ERROR_INODE(inode, "path[%d].p_hdr == NULL", depth);
-                       err = -EIO;
-                       break;
-               }
--              ex = path[depth].p_ext;
-+              ex = NULL;
-+              if (path[depth].p_ext) {
-+                      _ex = *path[depth].p_ext;
-+                      ex = &_ex;
-+              }
-               next = ext4_ext_next_allocated_block(path);
-+              up_read(&EXT4_I(inode)->i_data_sem);
-               exists = 0;
-               if (!ex) {
-@@ -1936,7 +1944,7 @@ int ext4_ext_walk_space(struct inode *in
-                       err = -EIO;
-                       break;
-               }
--              err = func(inode, path, &cbex, ex, cbdata);
-+              err = func(inode, path, &cbex, NULL, cbdata);
-               ext4_ext_drop_refs(path);
-               if (err < 0)
diff --git a/ldiskfs/kernel_patches/patches/rhel6.3/ext4-use-correct-inode.patch b/ldiskfs/kernel_patches/patches/rhel6.3/ext4-use-correct-inode.patch
deleted file mode 100644 (file)
index 5d86d19..0000000
+++ /dev/null
@@ -1,49 +0,0 @@
-From 5930ea643805feb50a2f8383ae12eb6f10935e49 Mon Sep 17 00:00:00 2001
-From: Theodore Ts'o <tytso@mit.edu>
-Date: Wed, 31 Aug 2011 12:02:51 -0400
-Subject: [PATCH] ext4: call ext4_handle_dirty_metadata with correct inode in
- ext4_dx_add_entry
-
-ext4_dx_add_entry manipulates bh2 and frames[0].bh, which are two buffer_heads
-that point to directory blocks assigned to the directory inode.  However, the
-function calls ext4_handle_dirty_metadata with the inode of the file that's
-being added to the directory, not the directory inode itself.  Therefore,
-correct the code to dirty the directory buffers with the directory inode, not
-the file inode.
-
-Signed-off-by: Darrick J. Wong <djwong@us.ibm.com>
-Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
-Cc: stable@kernel.org
----
- fs/ext4/namei.c | 4 ++--
- 1 file changed, 2 insertions(+), 2 deletions(-)
-
-diff --git a/fs/ext4/namei.c b/fs/ext4/namei.c
-index f0abe43..a067835 100644
---- a/fs/ext4/namei.c
-+++ b/fs/ext4/namei.c
-@@ -1585,7 +1585,7 @@ static int ext4_dx_add_entry(handle_t *handle, struct dentry *dentry,
-                       dxtrace(dx_show_index("node", frames[1].entries));
-                       dxtrace(dx_show_index("node",
-                              ((struct dx_node *) bh2->b_data)->entries));
--                      err = ext4_handle_dirty_metadata(handle, inode, bh2);
-+                      err = ext4_handle_dirty_metadata(handle, dir, bh2);
-                       if (err)
-                               goto journal_error;
-                       brelse (bh2);
-@@ -1611,7 +1611,11 @@ static int ext4_dx_add_entry(handle_t *handle, struct dentry *dentry,
-                       if (err)
-                               goto journal_error;
-               }
--              ext4_handle_dirty_metadata(handle, inode, frames[0].bh);
-+              err = ext4_handle_dirty_metadata(handle, dir, frames[0].bh);
-+              if (err) {
-+                      ext4_std_error(inode->i_sb, err);
-+                      goto cleanup;
-+              }
-       }
-       de = do_split(handle, dir, &bh, frame, &hinfo, &err);
-       if (!de)
--- 
-2.1.0
-
diff --git a/ldiskfs/kernel_patches/patches/rhel6.3/ext4-use-ext4_kvzalloc-ext4_kvmalloc-for-s_group_desc-and-s_group_info.patch b/ldiskfs/kernel_patches/patches/rhel6.3/ext4-use-ext4_kvzalloc-ext4_kvmalloc-for-s_group_desc-and-s_group_info.patch
deleted file mode 100644 (file)
index 8a68794..0000000
+++ /dev/null
@@ -1,114 +0,0 @@
-From f18a5f21c25707b4fe64b326e2b4d150565e7300 Mon Sep 17 00:00:00 2001
-From: Theodore Ts'o <tytso@mit.edu>
-Date: Mon, 1 Aug 2011 08:45:38 -0400
-Subject: ext4: use ext4_kvzalloc()/ext4_kvmalloc() for s_group_desc and s_group_info
-Git-commit: f18a5f21
-Patch-mainline: v3.1-rc1
-
-Upstream-Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
-Signed-off-by: Jeff Mahoney <jeffm@suse.com>
----
- fs/ext4/mballoc.c |    6 +++---
- fs/ext4/resize.c  |   13 +++++++------
- fs/ext4/super.c   |    9 +++++----
- 3 files changed, 15 insertions(+), 13 deletions(-)
-
---- a/fs/ext4/mballoc.c
-+++ b/fs/ext4/mballoc.c
-@@ -2307,7 +2307,7 @@ static int ext4_mb_init_backend(struct s
-       /* An 8TB filesystem with 64-bit pointers requires a 4096 byte
-        * kmalloc. A 128kb malloc should suffice for a 256TB filesystem.
-        * So a two level scheme suffices for now. */
--      sbi->s_group_info = kmalloc(array_size, GFP_KERNEL);
-+      sbi->s_group_info = ext4_kvzalloc(array_size, GFP_KERNEL);
-       if (sbi->s_group_info == NULL) {
-               printk(KERN_ERR "EXT4-fs: can't allocate buddy meta group\n");
-               return -ENOMEM;
-@@ -2339,7 +2339,7 @@ err_freebuddy:
-               kfree(sbi->s_group_info[i]);
-       iput(sbi->s_buddy_cache);
- err_freesgi:
--      kfree(sbi->s_group_info);
-+      ext4_kvfree(sbi->s_group_info);
-       return -ENOMEM;
- }
-
-@@ -2464,7 +2464,7 @@ int ext4_mb_release(struct super_block *
-                       EXT4_DESC_PER_BLOCK_BITS(sb);
-               for (i = 0; i < num_meta_group_infos; i++)
-                       kfree(sbi->s_group_info[i]);
--              kfree(sbi->s_group_info);
-+              ext4_kvfree(sbi->s_group_info);
-       }
-       kfree(sbi->s_mb_offsets);
-       kfree(sbi->s_mb_maxs);
---- a/fs/ext4/resize.c
-+++ b/fs/ext4/resize.c
-@@ -435,12 +435,13 @@ static int add_new_gdb(handle_t *handle,
-       if ((err = ext4_reserve_inode_write(handle, inode, &iloc)))
-               goto exit_dindj;
-
--      n_group_desc = kmalloc((gdb_num + 1) * sizeof(struct buffer_head *),
--                      GFP_NOFS);
-+      n_group_desc = ext4_kvmalloc((gdb_num + 1) *
-+                                   sizeof(struct buffer_head *),
-+                                   GFP_NOFS);
-       if (!n_group_desc) {
-               err = -ENOMEM;
--              ext4_warning(sb,
--                            "not enough memory for %lu groups", gdb_num + 1);
-+              ext4_warning(sb, "not enough memory for %lu groups",
-+                           gdb_num + 1);
-               goto exit_inode;
-       }
-
-@@ -467,7 +468,7 @@ static int add_new_gdb(handle_t *handle,
-       n_group_desc[gdb_num] = *primary;
-       EXT4_SB(sb)->s_group_desc = n_group_desc;
-       EXT4_SB(sb)->s_gdb_count++;
--      kfree(o_group_desc);
-+      ext4_kvfree(o_group_desc);
-
-       le16_add_cpu(&es->s_reserved_gdt_blocks, -1);
-       ext4_handle_dirty_metadata(handle, NULL, EXT4_SB(sb)->s_sbh);
-@@ -475,7 +476,7 @@ static int add_new_gdb(handle_t *handle,
-       return 0;
-
- exit_inode:
--      kfree(n_group_desc);
-+      ext4_kvfree(n_group_desc);
-       /* ext4_journal_release_buffer(handle, iloc.bh); */
-       brelse(iloc.bh);
- exit_dindj:
---- a/fs/ext4/super.c
-+++ b/fs/ext4/super.c
-@@ -705,7 +705,7 @@ static void ext4_put_super(struct super_
-
-       for (i = 0; i < sbi->s_gdb_count; i++)
-               brelse(sbi->s_group_desc[i]);
--      kfree(sbi->s_group_desc);
-+      ext4_kvfree(sbi->s_group_desc);
-       ext4_kvfree(sbi->s_flex_groups);
-       percpu_counter_destroy(&sbi->s_freeblocks_counter);
-       percpu_counter_destroy(&sbi->s_freeinodes_counter);
-@@ -3169,8 +3169,9 @@ static int ext4_fill_super(struct super_
-                       (EXT4_MAX_BLOCK_FILE_PHYS / EXT4_BLOCKS_PER_GROUP(sb)));
-       db_count = (sbi->s_groups_count + EXT4_DESC_PER_BLOCK(sb) - 1) /
-                  EXT4_DESC_PER_BLOCK(sb);
--      sbi->s_group_desc = kmalloc(db_count * sizeof(struct buffer_head *),
--                                  GFP_KERNEL);
-+      sbi->s_group_desc = ext4_kvmalloc(db_count *
-+                                        sizeof(struct buffer_head *),
-+                                        GFP_KERNEL);
-       if (sbi->s_group_desc == NULL) {
-               ext4_msg(sb, KERN_ERR, "not enough memory");
-               goto failed_mount;
-@@ -3495,7 +3496,7 @@ failed_mount3:
- failed_mount2:
-       for (i = 0; i < db_count; i++)
-               brelse(sbi->s_group_desc[i]);
--      kfree(sbi->s_group_desc);
-+      ext4_kvfree(sbi->s_group_desc);
- failed_mount:
-       if (sbi->s_proc) {
-               remove_proc_entry(sb->s_id, ext4_proc_root);
diff --git a/ldiskfs/kernel_patches/patches/rhel6.3/ext4-use-vzalloc-in-ext4_fill_flex_info.patch b/ldiskfs/kernel_patches/patches/rhel6.3/ext4-use-vzalloc-in-ext4_fill_flex_info.patch
deleted file mode 100644 (file)
index 764f8dd..0000000
+++ /dev/null
@@ -1,38 +0,0 @@
-From 94de56ab2062be59d80e2efb7c0dc60ecf616075 Mon Sep 17 00:00:00 2001
-From: Joe Perches <joe@perches.com>
-Date: Sun, 19 Dec 2010 22:21:02 -0500
-Subject: ext4: Use vzalloc in ext4_fill_flex_info()
-Git-commit: 94de56ab
-Patch-mainline: v2.6.38-rc1
-
-Signed-off-by: Joe Perches <joe@perches.com>
-Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
-Acked-by: Jeff Mahoney <jeffm@suse.com>
----
- fs/ext4/super.c |   15 +++++++--------
- 1 file changed, 7 insertions(+), 8 deletions(-)
-
---- a/fs/ext4/super.c
-+++ b/fs/ext4/super.c
-@@ -1817,14 +1817,13 @@ static int ext4_fill_flex_info(struct su
-       size = flex_group_count * sizeof(struct flex_groups);
-       sbi->s_flex_groups = kzalloc(size, GFP_KERNEL);
-       if (sbi->s_flex_groups == NULL) {
--              sbi->s_flex_groups = vmalloc(size);
--              if (sbi->s_flex_groups)
--                      memset(sbi->s_flex_groups, 0, size);
--      }
--      if (sbi->s_flex_groups == NULL) {
--              ext4_msg(sb, KERN_ERR, "not enough memory for "
--                              "%u flex groups", flex_group_count);
--              goto failed;
-+              sbi->s_flex_groups = vzalloc(size);
-+              if (sbi->s_flex_groups == NULL) {
-+                      ext4_msg(sb, KERN_ERR,
-+                               "not enough memory for %u flex groups",
-+                               flex_group_count);
-+                      goto failed;
-+              }
-       }
-
-       for (i = 0; i < sbi->s_groups_count; i++) {
diff --git a/ldiskfs/kernel_patches/patches/rhel6.4/ext4-back-dquot-to.patch b/ldiskfs/kernel_patches/patches/rhel6.4/ext4-back-dquot-to.patch
deleted file mode 100644 (file)
index f69a7c8..0000000
+++ /dev/null
@@ -1,60 +0,0 @@
-Index: linux-stage/fs/ext4/super.c
-===================================================================
---- linux-stage.orig/fs/ext4/super.c
-+++ linux-stage/fs/ext4/super.c
-@@ -1117,9 +1117,53 @@ static ssize_t ext4_quota_read(struct su
- static ssize_t ext4_quota_write(struct super_block *sb, int type,
-                               const char *data, size_t len, loff_t off);
-+static int ext4_dquot_initialize(struct inode *inode, int type)
-+{
-+      handle_t *handle;
-+      int ret, err;
-+
-+      if (IS_NOQUOTA(inode))
-+              return 0;
-+
-+      /* We may create quota structure so we need to reserve enough blocks */
-+      handle = ext4_journal_start(inode, 2*EXT4_QUOTA_INIT_BLOCKS(inode->i_sb));
-+      if (IS_ERR(handle))
-+              return PTR_ERR(handle);
-+      ret = dquot_initialize(inode, type);
-+      err = ext4_journal_stop(handle);
-+      if (!ret)
-+              ret = err;
-+      return ret;
-+}
-+
-+static int ext4_dquot_drop(struct inode *inode)
-+{
-+      handle_t *handle;
-+      int ret, err;
-+
-+      if (IS_NOQUOTA(inode))
-+              return 0;
-+
-+      /* We may delete quota structure so we need to reserve enough blocks */
-+      handle = ext4_journal_start(inode, 2*EXT4_QUOTA_DEL_BLOCKS(inode->i_sb));
-+      if (IS_ERR(handle)) {
-+              /*
-+               * We call dquot_drop() anyway to at least release references
-+               * to quota structures so that umount does not hang.
-+               */
-+              dquot_drop(inode);
-+              return PTR_ERR(handle);
-+      }
-+      ret = dquot_drop(inode);
-+      err = ext4_journal_stop(handle);
-+      if (!ret)
-+              ret = err;
-+      return ret;
-+}
-+
- static const struct dquot_operations ext4_quota_operations = {
--      .initialize     = dquot_initialize,
--      .drop           = dquot_drop,
-+      .initialize     = ext4_dquot_initialize,
-+      .drop           = ext4_dquot_drop,
-       .alloc_space    = dquot_alloc_space,
-       .reserve_space  = dquot_reserve_space,
-       .claim_space    = dquot_claim_space,
diff --git a/ldiskfs/kernel_patches/patches/rhel6.4/ext4-extra-isize.patch b/ldiskfs/kernel_patches/patches/rhel6.4/ext4-extra-isize.patch
deleted file mode 100644 (file)
index 3ab4c00..0000000
+++ /dev/null
@@ -1,13 +0,0 @@
-Index: linux-stage/fs/ext4/inode.c
-===================================================================
---- linux-stage.orig/fs/ext4/inode.c
-+++ linux-stage/fs/ext4/inode.c
-@@ -5654,7 +5654,7 @@ static int ext4_do_update_inode(handle_t
-               raw_inode->i_file_acl_high =
-                       cpu_to_le16(ei->i_file_acl >> 32);
-       raw_inode->i_file_acl_lo = cpu_to_le32(ei->i_file_acl);
--      if (ei->i_disksize != ext4_isize(raw_inode)) {
-+      if (ei->i_disksize != ext4_isize(inode->i_sb, raw_inode)) {
-               ext4_isize_set(raw_inode, ei->i_disksize);
-               need_datasync = 1;
-       }
diff --git a/ldiskfs/kernel_patches/patches/rhel6.4/ext4-fix-mbgroups-access.patch b/ldiskfs/kernel_patches/patches/rhel6.4/ext4-fix-mbgroups-access.patch
deleted file mode 100644 (file)
index 9c6bf5a..0000000
+++ /dev/null
@@ -1,16 +0,0 @@
-Index: linux-stage/fs/ext4/mballoc.c
-===================================================================
---- linux-stage.orig/fs/ext4/mballoc.c
-+++ linux-stage/fs/ext4/mballoc.c
-@@ -4825,6 +4825,11 @@ do_more:
-                * be used until this transaction is committed
-                */
-               new_entry = kmem_cache_alloc(ext4_free_data_cachep, GFP_NOFS);
-+              if (!new_entry) {
-+                      ext4_mb_release_desc(&e4b);
-+                      err = -ENOMEM;
-+                      goto error_return;
-+              }
-               new_entry->efd_start_blk = bit;
-               new_entry->efd_group  = block_group;
-               new_entry->efd_count = count;
diff --git a/ldiskfs/kernel_patches/patches/rhel6.4/ext4-max-dir-size-options.patch b/ldiskfs/kernel_patches/patches/rhel6.4/ext4-max-dir-size-options.patch
deleted file mode 100644 (file)
index 2e18ee6..0000000
+++ /dev/null
@@ -1,33 +0,0 @@
-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,6 +1268,7 @@ enum {
-       Opt_extents, Opt_noextents,
-       Opt_no_mbcache,
-       Opt_discard, Opt_nodiscard, Opt_init_itable, Opt_noinit_itable,
-+      Opt_max_dir_size_kb,
- };
- static const match_table_t tokens = {
-@@ -1350,6 +1350,7 @@ static const match_table_t tokens = {
-       {Opt_init_itable, "init_itable=%u"},
-       {Opt_init_itable, "init_itable"},
-       {Opt_noinit_itable, "noinit_itable"},
-+      {Opt_max_dir_size_kb, "max_dir_size_kb=%u"},
-       {Opt_err, NULL},
- };
-@@ -1736,6 +1737,13 @@ set_qf_format:
-               case Opt_nodelalloc:
-                       clear_opt(sbi->s_mount_opt, DELALLOC);
-                       break;
-+              case Opt_max_dir_size_kb:
-+                      if (match_int(&args[0], &option))
-+                              return 0;
-+                      if (option < 0)
-+                              return 0;
-+                      sbi->s_max_dir_size = option * 1024;
-+                      break;
-               case Opt_stripe:
-                       if (match_int(&args[0], &option))
-                               return 0;
diff --git a/ldiskfs/kernel_patches/patches/rhel6.4/ext4-mballoc-pa_free-mismatch.patch b/ldiskfs/kernel_patches/patches/rhel6.4/ext4-mballoc-pa_free-mismatch.patch
deleted file mode 100644 (file)
index d557c4b..0000000
+++ /dev/null
@@ -1,110 +0,0 @@
-Index: linux-stage/fs/ext4/mballoc.c
-===================================================================
---- linux-stage.orig/fs/ext4/mballoc.c
-+++ linux-stage/fs/ext4/mballoc.c
-@@ -3585,6 +3585,7 @@ ext4_mb_new_inode_pa(struct ext4_allocat
-       INIT_LIST_HEAD(&pa->pa_group_list);
-       pa->pa_deleted = 0;
-       pa->pa_type = MB_INODE_PA;
-+      pa->pa_error = 0;
-       mb_debug(1, "new inode pa %p: %llu/%u for %u\n", pa,
-                       pa->pa_pstart, pa->pa_len, pa->pa_lstart);
-@@ -3646,6 +3647,7 @@ ext4_mb_new_group_pa(struct ext4_allocat
-       INIT_LIST_HEAD(&pa->pa_group_list);
-       pa->pa_deleted = 0;
-       pa->pa_type = MB_GROUP_PA;
-+      pa->pa_error = 0;
-       mb_debug(1, "new group pa %p: %llu/%u for %u\n", pa,
-                       pa->pa_pstart, pa->pa_len, pa->pa_lstart);
-@@ -3708,7 +3710,9 @@ ext4_mb_release_inode_pa(struct ext4_bud
-       int err = 0;
-       int free = 0;
-+      assert_spin_locked(ext4_group_lock_ptr(sb, e4b->bd_group));
-       BUG_ON(pa->pa_deleted == 0);
-+      BUG_ON(pa->pa_inode == NULL);
-       ext4_get_group_no_and_offset(sb, pa->pa_pstart, &group, &bit);
-       grp_blk_start = pa->pa_pstart - bit;
-       BUG_ON(group != e4b->bd_group && pa->pa_len != 0);
-@@ -3744,19 +3748,27 @@ ext4_mb_release_inode_pa(struct ext4_bud
-               mb_free_blocks(pa->pa_inode, e4b, bit, next - bit);
-               bit = next + 1;
-       }
--      if (free != pa->pa_free) {
--              printk(KERN_CRIT "pa %p: logic %lu, phys. %lu, len %lu\n",
--                      pa, (unsigned long) pa->pa_lstart,
--                      (unsigned long) pa->pa_pstart,
--                      (unsigned long) pa->pa_len);
-+
-+      /* "free < pa->pa_free" means we maybe double alloc the same blocks,
-+       * otherwise maybe leave some free blocks unavailable, no need to BUG.*/
-+      if ((free > pa->pa_free && !pa->pa_error) || (free < pa->pa_free)) {
-+              ext4_error(sb, "pa free mismatch: [pa %p] "
-+                              "[phy %lu] [logic %lu] [len %u] [free %u] "
-+                              "[error %u] [inode %lu] [freed %u]", pa,
-+                              (unsigned long)pa->pa_pstart,
-+                              (unsigned long)pa->pa_lstart,
-+                              (unsigned)pa->pa_len, (unsigned)pa->pa_free,
-+                              (unsigned)pa->pa_error, pa->pa_inode->i_ino,
-+                              free);
-               ext4_grp_locked_error(sb, group,
--                                      __func__, "free %u, pa_free %u",
--                                      free, pa->pa_free);
-+                              __func__, "free %u, pa_free %u",
-+                              free, pa->pa_free);
-               /*
-                * pa is already deleted so we use the value obtained
-                * from the bitmap and continue.
-                */
-       }
-+      BUG_ON(pa->pa_free != free);
-       atomic_add(free, &sbi->s_mb_discarded);
-       return err;
-@@ -4541,6 +4553,24 @@ repeat:
-               ac->ac_b_ex.fe_len = 0;
-               ar->len = 0;
-               ext4_mb_show_ac(ac);
-+              if (ac->ac_pa) {
-+                      struct ext4_prealloc_space *pa = ac->ac_pa;
-+                      /* We can not make sure whether the bitmap has
-+                       * been updated or not when fail case. So can
-+                       * not revert pa_free back, just mark pa_error*/
-+                      pa->pa_error++;
-+                      ext4_error(sb,
-+                              "Updating bitmap error: [err %d] "
-+                              "[pa %p] [phy %lu] [logic %lu] "
-+                              "[len %u] [free %u] [error %u] "
-+                              "[inode %lu]", *errp, pa,
-+                              (unsigned long)pa->pa_pstart,
-+                              (unsigned long)pa->pa_lstart,
-+                              (unsigned)pa->pa_len,
-+                              (unsigned)pa->pa_free,
-+                              (unsigned)pa->pa_error,
-+                              pa->pa_inode ? pa->pa_inode->i_ino : 0);
-+              }
-       }
-       ext4_mb_release_context(ac);
- out:
-Index: linux-stage/fs/ext4/mballoc.h
-===================================================================
---- linux-stage.orig/fs/ext4/mballoc.h
-+++ linux-stage/fs/ext4/mballoc.h
-@@ -20,6 +20,7 @@
- #include <linux/version.h>
- #include <linux/blkdev.h>
- #include <linux/mutex.h>
-+#include <linux/genhd.h>
- #include "ext4_jbd2.h"
- #include "ext4.h"
-@@ -130,6 +131,7 @@ struct ext4_prealloc_space {
-       ext4_grpblk_t           pa_free;        /* how many blocks are free */
-       unsigned short          pa_type;        /* pa type. inode or group */
-       spinlock_t              *pa_obj_lock;
-+      unsigned short          pa_error;
-       struct inode            *pa_inode;      /* hack, for history only */
- };
diff --git a/ldiskfs/kernel_patches/patches/rhel6.4/ext4-misc.patch b/ldiskfs/kernel_patches/patches/rhel6.4/ext4-misc.patch
deleted file mode 100644 (file)
index e295a95..0000000
+++ /dev/null
@@ -1,173 +0,0 @@
-Index: linux-stage/fs/ext4/ext4.h
-===================================================================
---- linux-stage.orig/fs/ext4/ext4.h
-+++ linux-stage/fs/ext4/ext4.h
-@@ -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 *);
-+extern void ext4_mb_discard_inode_preallocations(struct inode *);
-+
-+
- /* inode.c */
- int ext4_forget(handle_t *handle, int is_metadata, struct inode *inode,
-               struct buffer_head *bh, ext4_fsblk_t blocknr);
-Index: linux-stage/fs/ext4/ext4_extents.h
-===================================================================
---- linux-stage.orig/fs/ext4/ext4_extents.h
-+++ linux-stage/fs/ext4/ext4_extents.h
-@@ -58,6 +58,12 @@
-  */
- #define EXT_STATS_
-+/*
-+ * define EXT4_ALLOC_NEEDED to 0 since block bitmap, group desc. and sb
-+ * are now accounted in ext4_ext_calc_credits_for_insert()
-+ */
-+#define EXT4_ALLOC_NEEDED 0
-+#define HAVE_EXT_PREPARE_CB_EXTENT
- /*
-  * ext4_inode has i_block array (60 bytes total).
-@@ -291,6 +297,8 @@ extern int ext4_extent_tree_init(handle_
- extern int ext4_ext_calc_credits_for_single_extent(struct inode *inode,
-                                                  int num,
-                                                  struct ext4_ext_path *path);
-+extern int ext4_ext_calc_credits_for_insert(struct inode *,
-+                                          struct ext4_ext_path *);
- extern int ext4_can_extents_be_merged(struct inode *inode,
-                                     struct ext4_extent *ex1,
-                                     struct ext4_extent *ex2);
-Index: linux-stage/fs/ext4/ext4_jbd2.c
-===================================================================
---- linux-stage.orig/fs/ext4/ext4_jbd2.c
-+++ linux-stage/fs/ext4/ext4_jbd2.c
-@@ -31,6 +31,7 @@ int __ext4_journal_get_write_access(cons
-       }
-       return err;
- }
-+EXPORT_SYMBOL(__ext4_journal_get_write_access);
- int __ext4_journal_forget(const char *where, handle_t *handle,
-                               struct buffer_head *bh)
-@@ -107,3 +108,4 @@ int __ext4_handle_dirty_metadata(const c
-       }
-       return err;
- }
-+EXPORT_SYMBOL(__ext4_handle_dirty_metadata);
-Index: linux-stage/fs/ext4/extents.c
-===================================================================
---- linux-stage.orig/fs/ext4/extents.c
-+++ linux-stage/fs/ext4/extents.c
-@@ -2200,6 +2200,55 @@ int ext4_ext_calc_credits_for_single_ext
- }
- /*
-+ * This routine returns max. credits extent tree can consume.
-+ * It should be OK for low-performance paths like ->writepage()
-+ * To allow many writing process to fit a single transaction,
-+ * caller should calculate credits under truncate_mutex and
-+ * pass actual path.
-+ */
-+int ext4_ext_calc_credits_for_insert(struct inode *inode,
-+                                   struct ext4_ext_path *path)
-+{
-+      int depth, needed;
-+
-+      if (path) {
-+              /* probably there is space in leaf? */
-+              depth = path->p_depth;
-+              if (le16_to_cpu(path[depth].p_hdr->eh_entries)
-+                              < le16_to_cpu(path[depth].p_hdr->eh_max))
-+                      return 1;
-+      }
-+
-+      /*
-+       * given 32bit logical block (4294967296 blocks), max. tree
-+       * can be 4 levels in depth -- 4 * 340^4 == 53453440000.
-+       * let's also add one more level for imbalance.
-+       */
-+      depth = 5;
-+
-+      /* allocation of new data block(s) */
-+      needed = 2;
-+
-+      /*
-+       * tree can be full, so it'd need to grow in depth:
-+       * we need one credit to modify old root, credits for
-+       * new root will be added in split accounting
-+       */
-+      needed += 1;
-+      /*
-+       * Index split can happen, we'd need:
-+       *    allocate intermediate indexes (bitmap + group)
-+       *  + change two blocks at each level, but root (already included)
-+       */
-+      needed += (depth * 2) + (depth * 2);
-+
-+      /* any allocation modifies superblock */
-+      needed += 1;
-+
-+      return needed;
-+}
-+
-+/*
-  * 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
-@@ -4488,3 +4537,12 @@ int ext4_fiemap(struct inode *inode, str
-       return error;
- }
-+EXPORT_SYMBOL(ext4_ext_search_right);
-+EXPORT_SYMBOL(ext4_ext_search_left);
-+EXPORT_SYMBOL(ext4_ext_insert_extent);
-+EXPORT_SYMBOL(ext4_mb_new_blocks);
-+EXPORT_SYMBOL(ext4_ext_calc_credits_for_insert);
-+EXPORT_SYMBOL(ext4_mark_inode_dirty);
-+EXPORT_SYMBOL(ext4_ext_walk_space);
-+EXPORT_SYMBOL(ext4_ext_find_extent);
-+EXPORT_SYMBOL(ext4_ext_drop_refs);
-Index: linux-stage/fs/ext4/inode.c
-===================================================================
---- linux-stage.orig/fs/ext4/inode.c
-+++ linux-stage/fs/ext4/inode.c
-@@ -5549,6 +5549,7 @@ bad_inode:
-       iget_failed(inode);
-       return ERR_PTR(ret);
- }
-+EXPORT_SYMBOL(ext4_iget);
- static int ext4_inode_blocks_set(handle_t *handle,
-                               struct ext4_inode *raw_inode,
-Index: linux-stage/fs/ext4/mballoc.c
-===================================================================
---- linux-stage.orig/fs/ext4/mballoc.c
-+++ linux-stage/fs/ext4/mballoc.c
-@@ -4031,6 +4031,7 @@ repeat:
-       if (ac)
-               kmem_cache_free(ext4_ac_cachep, ac);
- }
-+EXPORT_SYMBOL(ext4_discard_preallocations);
- /*
-  * finds all preallocated spaces and return blocks being freed to them
-@@ -5189,3 +5190,6 @@ out:
-       range->len = trimmed * sb->s_blocksize;
-       return ret;
- }
-+
-+EXPORT_SYMBOL(ext4_free_blocks);
-+
-Index: linux-stage/fs/ext4/super.c
-===================================================================
---- linux-stage.orig/fs/ext4/super.c
-+++ linux-stage/fs/ext4/super.c
-@@ -137,6 +137,7 @@ __u32 ext4_itable_unused_count(struct su
-               (EXT4_DESC_SIZE(sb) >= EXT4_MIN_DESC_SIZE_64BIT ?
-                (__u32)le16_to_cpu(bg->bg_itable_unused_hi) << 16 : 0);
- }
-+EXPORT_SYMBOL(ext4_itable_unused_count);
- void ext4_block_bitmap_set(struct super_block *sb,
-                          struct ext4_group_desc *bg, ext4_fsblk_t blk)
diff --git a/ldiskfs/kernel_patches/patches/rhel6.4/ext4-mmp.patch b/ldiskfs/kernel_patches/patches/rhel6.4/ext4-mmp.patch
deleted file mode 100644 (file)
index 70f04bb..0000000
+++ /dev/null
@@ -1,581 +0,0 @@
-Prevent an ext4 filesystem from being mounted multiple times.
-A sequence number is stored on disk and is periodically updated (every 5
-seconds by default) by a mounted filesystem.
-At mount time, we now wait for s_mmp_update_interval seconds to make sure
-that the MMP sequence does not change.
-In case of failure, the nodename, bdevname and the time at which the MMP
-block was last updated is displayed.
-Move all mmp code to a dedicated file (mmp.c).
-
-Signed-off-by: Andreas Dilger <adilger <at> whamcloud.com>
-Signed-off-by: Johann Lombardi <johann <at> whamcloud.com>
----
- fs/ext4/Makefile |    3 +-
- fs/ext4/ext4.h   |   76 ++++++++++++-
- fs/ext4/mmp.c    |  354 ++++++++++++++++++++++++++++++++++++++++++++++++++++++
- fs/ext4/super.c  |   18 +++-
- 4 files changed, 447 insertions(+), 4 deletions(-)
- create mode 100644 fs/ext4/mmp.c
-
-Index: linux-stage/fs/ext4/Makefile
-===================================================================
---- linux-stage.orig/fs/ext4/Makefile
-+++ linux-stage/fs/ext4/Makefile
-@@ -6,7 +6,8 @@ obj-$(CONFIG_EXT4_FS) += ext4.o
- ext4-y        := balloc.o bitmap.o dir.o file.o fsync.o ialloc.o inode.o \
-               ioctl.o namei.o super.o symlink.o hash.o resize.o extents.o \
--              ext4_jbd2.o migrate.o mballoc.o block_validity.o move_extent.o
-+              ext4_jbd2.o migrate.o mballoc.o block_validity.o move_extent.o \
-+              mmp.o
- ext4-$(CONFIG_EXT4_FS_XATTR)          += xattr.o xattr_user.o xattr_trusted.o
- ext4-$(CONFIG_EXT4_FS_POSIX_ACL)      += acl.o
-Index: linux-stage/fs/ext4/ext4.h
-===================================================================
---- linux-stage.orig/fs/ext4/ext4.h
-+++ linux-stage/fs/ext4/ext4.h
-@@ -1009,7 +1009,7 @@ struct ext4_super_block {
-       __le16  s_want_extra_isize;     /* New inodes should reserve # bytes */
-       __le32  s_flags;                /* Miscellaneous flags */
-       __le16  s_raid_stride;          /* RAID stride */
--      __le16  s_mmp_interval;         /* # seconds to wait in MMP checking */
-+      __le16  s_mmp_update_interval;  /* # seconds to wait in MMP checking */
-       __le64  s_mmp_block;            /* Block for multi-mount protection */
-       __le32  s_raid_stripe_width;    /* blocks on all data disks (N*stride)*/
-       __u8    s_log_groups_per_flex;  /* FLEX_BG group size */
-@@ -1177,6 +1177,9 @@ struct ext4_sb_info {
-       /* workqueue for dio unwritten */
-       struct workqueue_struct *dio_unwritten_wq;
-+      /* Kernel thread for multiple mount protection */
-+      struct task_struct *s_mmp_tsk;
-+
-       /* Lazy inode table initialization info */
-       struct ext4_li_request *s_li_request;
-       /* Wait multiplier for lazy initialization thread */
-@@ -1322,7 +1325,8 @@ EXT4_INODE_BIT_FNS(state, state_flags)
-                                        EXT4_FEATURE_INCOMPAT_META_BG| \
-                                        EXT4_FEATURE_INCOMPAT_EXTENTS| \
-                                        EXT4_FEATURE_INCOMPAT_64BIT| \
--                                       EXT4_FEATURE_INCOMPAT_FLEX_BG)
-+                                       EXT4_FEATURE_INCOMPAT_FLEX_BG| \
-+                                       EXT4_FEATURE_INCOMPAT_MMP)
- #define EXT4_FEATURE_RO_COMPAT_SUPP   (EXT4_FEATURE_RO_COMPAT_SPARSE_SUPER| \
-                                        EXT4_FEATURE_RO_COMPAT_LARGE_FILE| \
-                                        EXT4_FEATURE_RO_COMPAT_GDT_CSUM| \
-@@ -1576,6 +1580,67 @@ struct ext4_features {
- };
- /*
-+ * This structure will be used for multiple mount protection. It will be
-+ * written into the block number saved in the s_mmp_block field in the
-+ * superblock. Programs that check MMP should assume that if
-+ * SEQ_FSCK (or any unknown code above SEQ_MAX) is present then it is NOT safe
-+ * to use the filesystem, regardless of how old the timestamp is.
-+ */
-+#define EXT4_MMP_MAGIC     0x004D4D50U /* ASCII for MMP */
-+#define EXT4_MMP_SEQ_CLEAN 0xFF4D4D50U /* mmp_seq value for clean unmount */
-+#define EXT4_MMP_SEQ_FSCK  0xE24D4D50U /* mmp_seq value when being fscked */
-+#define EXT4_MMP_SEQ_MAX   0xE24D4D4FU /* maximum valid mmp_seq value */
-+
-+struct mmp_struct {
-+       __le32  mmp_magic;              /* Magic number for MMP */
-+       __le32  mmp_seq;                /* Sequence no. updated periodically */
-+
-+       /*
-+        * mmp_time, mmp_nodename & mmp_bdevname are only used for information
-+        * purposes and do not affect the correctness of the algorithm
-+        */
-+       __le64  mmp_time;               /* Time last updated */
-+       char    mmp_nodename[64];       /* Node which last updated MMP block */
-+       char    mmp_bdevname[32];       /* Bdev which last updated MMP block */
-+
-+       /*
-+        * mmp_check_interval is used to verify if the MMP block has been
-+        * updated on the block device. The value is updated based on the
-+        * maximum time to write the MMP block during an update cycle.
-+        */
-+       __le16  mmp_check_interval;
-+
-+       __le16  mmp_pad1;
-+       __le32  mmp_pad2[227];
-+};
-+
-+/* arguments passed to the mmp thread */
-+struct mmpd_data {
-+       struct buffer_head *bh; /* bh from initial read_mmp_block() */
-+       struct super_block *sb;  /* super block of the fs */
-+};
-+
-+/*
-+ * Check interval multiplier
-+ * The MMP block is written every update interval and initially checked every
-+ * update interval x the multiplier (the value is then adapted based on the
-+ * write latency). The reason is that writes can be delayed under load and we
-+ * don't want readers to incorrectly assume that the filesystem is no longer
-+ * in use.
-+ */
-+#define EXT4_MMP_CHECK_MULT            2UL
-+
-+/*
-+ * Minimum interval for MMP checking in seconds.
-+ */
-+#define EXT4_MMP_MIN_CHECK_INTERVAL    5UL
-+
-+/*
-+ * Maximum interval for MMP checking in seconds.
-+ */
-+#define EXT4_MMP_MAX_CHECK_INTERVAL    300UL
-+
-+/*
-  * Function prototypes
-  */
-@@ -1757,6 +1822,10 @@ extern void __ext4_warning(struct super_
- #define ext4_warning(sb, message...)  __ext4_warning(sb, __func__, ## message)
- extern void ext4_msg(struct super_block *, const char *, const char *, ...)
-       __attribute__ ((format (printf, 3, 4)));
-+extern void __dump_mmp_msg(struct super_block *, struct mmp_struct *mmp,
-+                         const char *, const char *);
-+#define dump_mmp_msg(sb, mmp, msg)     __dump_mmp_msg(sb, mmp, __func__, \
-+                                                      msg)
- extern void ext4_grp_locked_error(struct super_block *, ext4_group_t,
-                               const char *, const char *, ...)
-       __attribute__ ((format (printf, 4, 5)));
-@@ -2050,6 +2119,8 @@ extern int ext4_move_extents(struct file
-                            __u64 start_orig, __u64 start_donor,
-                            __u64 len, __u64 *moved_len);
-+/* mmp.c */
-+extern int ext4_multi_mount_protect(struct super_block *, ext4_fsblk_t);
- /*
-  * Add new method to test wether block and inode bitmaps are properly
-Index: linux-stage/fs/ext4/mmp.c
-===================================================================
---- /dev/null
-+++ linux-stage/fs/ext4/mmp.c
-@@ -0,0 +1,357 @@
-+#include <linux/fs.h>
-+#include <linux/random.h>
-+#include <linux/buffer_head.h>
-+#include <linux/utsname.h>
-+#include <linux/kthread.h>
-+
-+#include "ext4.h"
-+
-+/*
-+ * Write the MMP block using WRITE_SYNC to try to get the block on-disk
-+ * faster.
-+ */
-+static int write_mmp_block(struct buffer_head *bh)
-+{
-+       mark_buffer_dirty(bh);
-+       lock_buffer(bh);
-+       bh->b_end_io = end_buffer_write_sync;
-+       get_bh(bh);
-+       submit_bh(WRITE_SYNC, bh);
-+       wait_on_buffer(bh);
-+       if (unlikely(!buffer_uptodate(bh)))
-+               return 1;
-+
-+       return 0;
-+}
-+
-+/*
-+ * Read the MMP block. It _must_ be read from disk and hence we clear the
-+ * uptodate flag on the buffer.
-+ */
-+static int read_mmp_block(struct super_block *sb, struct buffer_head **bh,
-+                         ext4_fsblk_t mmp_block)
-+{
-+       struct mmp_struct *mmp;
-+
-+       if (*bh)
-+               clear_buffer_uptodate(*bh);
-+
-+       /* This would be sb_bread(sb, mmp_block), except we need to be sure
-+        * that the MD RAID device cache has been bypassed, and that the read
-+        * is not blocked in the elevator. */
-+       if (!*bh)
-+               *bh = sb_getblk(sb, mmp_block);
-+       if (*bh) {
-+               get_bh(*bh);
-+               lock_buffer(*bh);
-+               (*bh)->b_end_io = end_buffer_read_sync;
-+               submit_bh(READ_SYNC, *bh);
-+               wait_on_buffer(*bh);
-+               if (!buffer_uptodate(*bh)) {
-+                       brelse(*bh);
-+                       *bh = NULL;
-+               }
-+       }
-+       if (!*bh) {
-+               ext4_warning(sb, "Error while reading MMP block %llu",
-+                            mmp_block);
-+               return -EIO;
-+       }
-+
-+       mmp = (struct mmp_struct *)((*bh)->b_data);
-+       if (le32_to_cpu(mmp->mmp_magic) != EXT4_MMP_MAGIC) {
-+              brelse(*bh);
-+              *bh = NULL;
-+               return -EINVAL;
-+      }
-+
-+       return 0;
-+}
-+
-+/*
-+ * Dump as much information as possible to help the admin.
-+ */
-+void __dump_mmp_msg(struct super_block *sb, struct mmp_struct *mmp,
-+                   const char *function, const char *msg)
-+{
-+       __ext4_warning(sb, function, msg);
-+       __ext4_warning(sb, function,
-+                      "MMP failure info: last update time: %llu, last update "
-+                      "node: %s, last update device: %s\n",
-+                      (long long unsigned int) le64_to_cpu(mmp->mmp_time),
-+                      mmp->mmp_nodename, mmp->mmp_bdevname);
-+}
-+
-+/*
-+ * kmmpd will update the MMP sequence every s_mmp_update_interval seconds
-+ */
-+static int kmmpd(void *data)
-+{
-+       struct super_block *sb = ((struct mmpd_data *) data)->sb;
-+       struct buffer_head *bh = ((struct mmpd_data *) data)->bh;
-+       struct ext4_super_block *es = EXT4_SB(sb)->s_es;
-+       struct mmp_struct *mmp;
-+       ext4_fsblk_t mmp_block;
-+       u32 seq = 0;
-+       unsigned long failed_writes = 0;
-+       int mmp_update_interval = le16_to_cpu(es->s_mmp_update_interval);
-+       unsigned mmp_check_interval;
-+       unsigned long last_update_time;
-+       unsigned long diff;
-+       int retval;
-+
-+       mmp_block = le64_to_cpu(es->s_mmp_block);
-+       mmp = (struct mmp_struct *)(bh->b_data);
-+       mmp->mmp_time = cpu_to_le64(get_seconds());
-+       /*
-+        * Start with the higher mmp_check_interval and reduce it if
-+        * the MMP block is being updated on time.
-+        */
-+       mmp_check_interval = max(EXT4_MMP_CHECK_MULT * mmp_update_interval,
-+                                EXT4_MMP_MIN_CHECK_INTERVAL);
-+       mmp->mmp_check_interval = cpu_to_le16(mmp_check_interval);
-+       bdevname(bh->b_bdev, mmp->mmp_bdevname);
-+
-+       memcpy(mmp->mmp_nodename, init_utsname()->nodename,
-+              sizeof(mmp->mmp_nodename));
-+
-+       while (!kthread_should_stop()) {
-+               if (++seq > EXT4_MMP_SEQ_MAX)
-+                       seq = 1;
-+
-+               mmp->mmp_seq = cpu_to_le32(seq);
-+               mmp->mmp_time = cpu_to_le64(get_seconds());
-+               last_update_time = jiffies;
-+
-+               retval = write_mmp_block(bh);
-+               /*
-+                * Don't spew too many error messages. Print one every
-+                * (s_mmp_update_interval * 60) seconds.
-+                */
-+               if (retval) {
-+                       if ((failed_writes % 60) == 0)
-+                               ext4_error(sb, "Error writing to MMP block");
-+                       failed_writes++;
-+               }
-+
-+               if (!(le32_to_cpu(es->s_feature_incompat) &
-+                   EXT4_FEATURE_INCOMPAT_MMP)) {
-+                       ext4_warning(sb, "kmmpd being stopped since MMP feature"
-+                                    " has been disabled.");
-+                       EXT4_SB(sb)->s_mmp_tsk = NULL;
-+                       goto failed;
-+               }
-+
-+               if (sb->s_flags & MS_RDONLY) {
-+                       ext4_warning(sb, "kmmpd being stopped since filesystem "
-+                                    "has been remounted as readonly.");
-+                       EXT4_SB(sb)->s_mmp_tsk = NULL;
-+                       goto failed;
-+               }
-+
-+              diff = jiffies - last_update_time;
-+              if (diff < mmp_update_interval * msecs_to_jiffies(MSEC_PER_SEC))
-+                      schedule_timeout_interruptible(mmp_update_interval *
-+                              msecs_to_jiffies(MSEC_PER_SEC) - diff);
-+
-+               /*
-+                * We need to make sure that more than mmp_check_interval
-+                * seconds have not passed since writing. If that has happened
-+                * we need to check if the MMP block is as we left it.
-+                */
-+               diff = jiffies - last_update_time;
-+               if (diff > mmp_check_interval * msecs_to_jiffies(MSEC_PER_SEC)) {
-+                       struct buffer_head *bh_check = NULL;
-+                       struct mmp_struct *mmp_check;
-+
-+                       retval = read_mmp_block(sb, &bh_check, mmp_block);
-+                       if (retval) {
-+                               ext4_error(sb, "error reading MMP data: %d",
-+                                          retval);
-+                               EXT4_SB(sb)->s_mmp_tsk = NULL;
-+                               goto failed;
-+                       }
-+
-+                       mmp_check = (struct mmp_struct *)(bh_check->b_data);
-+                       if (mmp->mmp_seq != mmp_check->mmp_seq ||
-+                           memcmp(mmp->mmp_nodename, mmp_check->mmp_nodename,
-+                                  sizeof(mmp->mmp_nodename))) {
-+                               dump_mmp_msg(sb, mmp_check,
-+                                            "Error while updating MMP info. "
-+                                            "The filesystem seems to have been"
-+                                            " multiply mounted.");
-+                               ext4_error(sb, "abort");
-+                              put_bh(bh_check);
-+                               goto failed;
-+                       }
-+                       put_bh(bh_check);
-+               }
-+
-+              /*
-+               * Adjust the mmp_check_interval depending on how much time
-+               * it took for the MMP block to be written.
-+               */
-+              mmp_check_interval = max(min(EXT4_MMP_CHECK_MULT * diff /
-+                                           msecs_to_jiffies(MSEC_PER_SEC),
-+                                           EXT4_MMP_MAX_CHECK_INTERVAL),
-+                                       EXT4_MMP_MIN_CHECK_INTERVAL);
-+              mmp->mmp_check_interval = cpu_to_le16(mmp_check_interval);
-+       }
-+
-+       /*
-+        * Unmount seems to be clean.
-+        */
-+       mmp->mmp_seq = cpu_to_le32(EXT4_MMP_SEQ_CLEAN);
-+       mmp->mmp_time = cpu_to_le64(get_seconds());
-+
-+       retval = write_mmp_block(bh);
-+
-+failed:
-+       kfree(data);
-+       brelse(bh);
-+       return retval;
-+}
-+
-+/*
-+ * Get a random new sequence number but make sure it is not greater than
-+ * EXT4_MMP_SEQ_MAX.
-+ */
-+static unsigned int mmp_new_seq(void)
-+{
-+       u32 new_seq;
-+
-+       do {
-+               get_random_bytes(&new_seq, sizeof(u32));
-+       } while (new_seq > EXT4_MMP_SEQ_MAX);
-+
-+       return new_seq;
-+}
-+
-+/*
-+ * Protect the filesystem from being mounted more than once.
-+ */
-+int ext4_multi_mount_protect(struct super_block *sb,
-+                                   ext4_fsblk_t mmp_block)
-+{
-+       struct ext4_super_block *es = EXT4_SB(sb)->s_es;
-+       struct buffer_head *bh = NULL;
-+       struct mmp_struct *mmp = NULL;
-+       struct mmpd_data *mmpd_data;
-+       u32 seq;
-+       unsigned int mmp_check_interval = le16_to_cpu(es->s_mmp_update_interval);
-+       unsigned int wait_time = 0;
-+       int retval;
-+
-+       if (mmp_block < le32_to_cpu(es->s_first_data_block) ||
-+           mmp_block >= ext4_blocks_count(es)) {
-+               ext4_warning(sb, "Invalid MMP block in superblock");
-+               goto failed;
-+       }
-+
-+       retval = read_mmp_block(sb, &bh, mmp_block);
-+       if (retval)
-+               goto failed;
-+
-+       mmp = (struct mmp_struct *)(bh->b_data);
-+
-+       if (mmp_check_interval < EXT4_MMP_MIN_CHECK_INTERVAL)
-+               mmp_check_interval = EXT4_MMP_MIN_CHECK_INTERVAL;
-+
-+       /*
-+        * If check_interval in MMP block is larger, use that instead of
-+        * update_interval from the superblock.
-+        */
-+       if (mmp->mmp_check_interval > mmp_check_interval)
-+               mmp_check_interval = mmp->mmp_check_interval;
-+
-+       seq = le32_to_cpu(mmp->mmp_seq);
-+       if (seq == EXT4_MMP_SEQ_CLEAN)
-+               goto skip;
-+
-+       if (seq == EXT4_MMP_SEQ_FSCK) {
-+               dump_mmp_msg(sb, mmp, "fsck is running on the filesystem");
-+               goto failed;
-+       }
-+
-+       wait_time = min(mmp_check_interval * 2 + 1,
-+                       mmp_check_interval + 60);
-+
-+       /* Print MMP interval if more than 20 secs. */
-+       if (wait_time > EXT4_MMP_MIN_CHECK_INTERVAL * 4)
-+               ext4_warning(sb, "MMP interval %u higher than expected, please"
-+                            " wait.\n", wait_time * 2);
-+
-+      if (schedule_timeout_interruptible(msecs_to_jiffies(MSEC_PER_SEC) *
-+                                         wait_time) != 0) {
-+              ext4_warning(sb, "MMP startup interrupted, failing mount\n");
-+              goto failed;
-+      }
-+
-+       retval = read_mmp_block(sb, &bh, mmp_block);
-+       if (retval)
-+               goto failed;
-+       mmp = (struct mmp_struct *)(bh->b_data);
-+       if (seq != le32_to_cpu(mmp->mmp_seq)) {
-+               dump_mmp_msg(sb, mmp,
-+                            "Device is already active on another node.");
-+               goto failed;
-+       }
-+
-+skip:
-+       /*
-+        * write a new random sequence number.
-+        */
-+       mmp->mmp_seq = seq = cpu_to_le32(mmp_new_seq());
-+
-+       retval = write_mmp_block(bh);
-+       if (retval)
-+               goto failed;
-+
-+      /*
-+       * wait for MMP interval and check mmp_seq.
-+       */
-+      if (schedule_timeout_interruptible(msecs_to_jiffies(MSEC_PER_SEC) *
-+                                         wait_time) != 0) {
-+              ext4_warning(sb, "MMP startup interrupted, failing mount\n");
-+              goto failed;
-+      }
-+
-+       retval = read_mmp_block(sb, &bh, mmp_block);
-+       if (retval)
-+               goto failed;
-+       mmp = (struct mmp_struct *)(bh->b_data);
-+       if (seq != le32_to_cpu(mmp->mmp_seq)) {
-+               dump_mmp_msg(sb, mmp,
-+                            "Device is already active on another node.");
-+               goto failed;
-+       }
-+
-+       mmpd_data = kmalloc(sizeof(struct mmpd_data), GFP_KERNEL);
-+       if (!mmpd_data) {
-+               ext4_warning(sb, "not enough memory for mmpd_data");
-+               goto failed;
-+       }
-+       mmpd_data->sb = sb;
-+       mmpd_data->bh = bh;
-+
-+       /*
-+        * Start a kernel thread to update the MMP block periodically.
-+        */
-+       EXT4_SB(sb)->s_mmp_tsk = kthread_run(kmmpd, mmpd_data, "kmmpd-%s",
-+                                            bdevname(bh->b_bdev,
-+                                                     mmp->mmp_bdevname));
-+       if (IS_ERR(EXT4_SB(sb)->s_mmp_tsk)) {
-+               EXT4_SB(sb)->s_mmp_tsk = NULL;
-+               kfree(mmpd_data);
-+               ext4_warning(sb, "Unable to create kmmpd thread for %s.",
-+                            sb->s_id);
-+               goto failed;
-+       }
-+
-+       return 0;
-+
-+failed:
-+       brelse(bh);
-+       return 1;
-+}
-+
-Index: linux-stage/fs/ext4/super.c
-===================================================================
---- linux-stage.orig/fs/ext4/super.c
-+++ linux-stage/fs/ext4/super.c
-@@ -40,6 +40,8 @@
- #include <linux/log2.h>
- #include <linux/crc16.h>
- #include <asm/uaccess.h>
-+#include <linux/kthread.h>
-+#include <linux/utsname.h>
- #include <linux/kthread.h>
- #include <linux/freezer.h>
-@@ -716,6 +718,8 @@ static void ext4_put_super(struct super_
-               invalidate_bdev(sbi->journal_bdev);
-               ext4_blkdev_remove(sbi);
-       }
-+      if (sbi->s_mmp_tsk)
-+              kthread_stop(sbi->s_mmp_tsk);
-       sb->s_fs_info = NULL;
-       /*
-        * Now that we are completely done shutting down the
-@@ -3241,6 +3245,10 @@ static int ext4_fill_super(struct super_
-       needs_recovery = (es->s_last_orphan != 0 ||
-                         EXT4_HAS_INCOMPAT_FEATURE(sb,
-                                   EXT4_FEATURE_INCOMPAT_RECOVER));
-+      if (EXT4_HAS_INCOMPAT_FEATURE(sb, EXT4_FEATURE_INCOMPAT_MMP) &&
-+          !(sb->s_flags & MS_RDONLY))
-+              if (ext4_multi_mount_protect(sb, le64_to_cpu(es->s_mmp_block)))
-+                      goto failed_mount3;
-       /*
-        * The first inode we look at is the journal inode.  Don't try
-@@ -3491,6 +3499,8 @@ failed_mount3:
-       percpu_counter_destroy(&sbi->s_freeinodes_counter);
-       percpu_counter_destroy(&sbi->s_dirs_counter);
-       percpu_counter_destroy(&sbi->s_dirtyblocks_counter);
-+      if (sbi->s_mmp_tsk)
-+              kthread_stop(sbi->s_mmp_tsk);
- failed_mount2:
-       for (i = 0; i < db_count; i++)
-               brelse(sbi->s_group_desc[i]);
-@@ -4001,7 +4011,7 @@ static int ext4_remount(struct super_blo
-       int enable_quota = 0;
-       ext4_group_t g;
-       unsigned int journal_ioprio = DEFAULT_JOURNAL_IOPRIO;
--      int err;
-+      int err = 0;
- #ifdef CONFIG_QUOTA
-       int i;
- #endif
-@@ -4129,6 +4139,13 @@ static int ext4_remount(struct super_blo
-                               goto restore_opts;
-                       if (!ext4_setup_super(sb, es, 0))
-                               sb->s_flags &= ~MS_RDONLY;
-+                      if (EXT4_HAS_INCOMPAT_FEATURE(sb,
-+                                                  EXT4_FEATURE_INCOMPAT_MMP))
-+                              if (ext4_multi_mount_protect(sb,
-+                                              le64_to_cpu(es->s_mmp_block))) {
-+                                      err = -EROFS;
-+                                      goto restore_opts;
-+                              }
-                       enable_quota = 1;
-               }
-       }
diff --git a/ldiskfs/kernel_patches/patches/rhel6.4/ext4-prealloc.patch b/ldiskfs/kernel_patches/patches/rhel6.4/ext4-prealloc.patch
deleted file mode 100644 (file)
index