ldiskfs_journal_dirty_meatdata only exist in ext3 code.
In the ext4 ldiskfs_handle_dirty_metadata instead of it.
As we won't support ext3 any more, Cleanup its usage
from ldiskfs & osd.
Signed-off-by: Yang Sheng <yang.sheng@intel.com>
Change-Id: I7a1f65bd41fb552cb099831fc0254926ae5c2df3
Reviewed-on: http://review.whamcloud.com/13067
Tested-by: Jenkins
Reviewed-by: Bob Glossman <bob.glossman@intel.com>
Tested-by: Maloo <hpdd-maloo@intel.com>
Reviewed-by: Bobi Jam <bobijam@hotmail.com>
Reviewed-by: Oleg Drokin <oleg.drokin@intel.com>
if (ext4_should_order_data(inode))
ext4_begin_ordered_truncate(inode, 0);
-@@ -230,12 +231,15 @@ void ext4_delete_inode(struct inode *ino
+@@ -230,7 +231,10 @@ void ext4_delete_inode(struct inode *ino
if (is_bad_inode(inode))
goto no_delete;
+- handle = ext4_journal_start(inode, blocks_for_truncate(inode)+3);
+ if (!IS_NOQUOTA(inode))
+ extra_credits += 2 * EXT4_QUOTA_DEL_BLOCKS(inode->i_sb);
- /*
- * Protect us against freezing - iput() caller didn't have to have any
- * protection against it
- */
- sb_start_intwrite(inode->i_sb);
-- handle = ext4_journal_start(inode, blocks_for_truncate(inode)+3);
+ handle = ext4_journal_start(inode,
+ blocks_for_truncate(inode) + extra_credits);
if (IS_ERR(handle)) {
+
+ memcpy(bh->b_data, buf, csize);
+ set_buffer_uptodate(bh);
-+ ext4_journal_dirty_metadata(handle, bh);
++ ext4_handle_dirty_metadata(handle, ea_inode, bh);
+
+ buf += csize;
+ wsize += csize;
return err;
}
+EXPORT_SYMBOL(__ext4_handle_dirty_metadata);
-Index: linux-stage/fs/ext4/ext4_jbd2.h
-===================================================================
---- linux-stage.orig/fs/ext4/ext4_jbd2.h 2011-05-20 10:59:29.000000000 +0300
-+++ linux-stage/fs/ext4/ext4_jbd2.h 2011-05-20 11:00:01.000000000 +0300
-@@ -35,6 +35,8 @@
- (EXT4_HAS_INCOMPAT_FEATURE(sb, EXT4_FEATURE_INCOMPAT_EXTENTS) \
- ? 27U : 8U)
-
-+#define ext4_journal_dirty_metadata(handle, bh) \
-+ ext4_handle_dirty_metadata(handle, NULL, bh)
- /* Extended attribute operations touch at most two data buffers,
- * two bitmap buffers, and two group summaries, in addition to the inode
- * and the superblock, which are already accounted for. */
Index: linux-stage/fs/ext4/extents.c
===================================================================
--- linux-stage.orig/fs/ext4/extents.c
--- /dev/null
+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,
+Index: linux-stage/fs/ext4/inode.c
+===================================================================
+--- linux-stage.orig/fs/ext4/inode.c
++++ linux-stage/fs/ext4/inode.c
+@@ -222,6 +222,7 @@ void ext4_delete_inode(struct inode *ino
+ {
+ handle_t *handle;
+ int err;
++ int extra_credits = 3;
+
+ if (ext4_should_order_data(inode))
+ ext4_begin_ordered_truncate(inode, 0);
+@@ -230,12 +231,15 @@ void ext4_delete_inode(struct inode *ino
+ if (is_bad_inode(inode))
+ goto no_delete;
+
++ if (!IS_NOQUOTA(inode))
++ extra_credits += 2 * EXT4_QUOTA_DEL_BLOCKS(inode->i_sb);
+ /*
+ * Protect us against freezing - iput() caller didn't have to have any
+ * protection against it
+ */
+ sb_start_intwrite(inode->i_sb);
+- handle = ext4_journal_start(inode, blocks_for_truncate(inode)+3);
++ handle = ext4_journal_start(inode,
++ blocks_for_truncate(inode) + extra_credits);
+ if (IS_ERR(handle)) {
+ ext4_std_error(inode->i_sb, PTR_ERR(handle));
+ /*
+@@ -266,10 +270,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);
return err;
}
+EXPORT_SYMBOL(__ext4_handle_dirty_metadata);
-Index: linux-stage/fs/ext4/ext4_jbd2.h
-===================================================================
---- linux-stage.orig/fs/ext4/ext4_jbd2.h
-+++ linux-stage/fs/ext4/ext4_jbd2.h
-@@ -35,6 +35,8 @@
- (EXT4_HAS_INCOMPAT_FEATURE(sb, EXT4_FEATURE_INCOMPAT_EXTENTS) \
- ? 27U : 8U)
-
-+#define ext4_journal_dirty_metadata(handle, bh) \
-+ ext4_handle_dirty_metadata(handle, NULL, bh)
- /* Extended attribute operations touch at most two data buffers,
- * two bitmap buffers, and two group summaries, in addition to the inode
- * and the superblock, which are already accounted for. */
Index: linux-stage/fs/ext4/extents.c
===================================================================
--- linux-stage.orig/fs/ext4/extents.c
-diff -u -r linux-stage.orig/fs/ext4/ext4.h linux-stage/fs/ext4/ext4.h
---- linux-stage.orig/fs/ext4/ext4.h 2012-12-31 15:07:27.000000000 -0500
-+++ linux-stage/fs/ext4/ext4.h 2012-12-31 15:14:03.000000000 -0500
-@@ -912,6 +912,7 @@
+Index: linux-3.0.101-0.5/fs/ext4/ext4.h
+===================================================================
+--- linux-3.0.101-0.5.orig/fs/ext4/ext4.h
++++ linux-3.0.101-0.5/fs/ext4/ext4.h
+@@ -911,6 +911,7 @@ struct ext4_inode_info {
#define EXT4_MOUNT_POSIX_ACL 0x08000 /* POSIX Access Control Lists */
#define EXT4_MOUNT_NO_AUTO_DA_ALLOC 0x10000 /* No auto delalloc mapping */
#define EXT4_MOUNT_BARRIER 0x20000 /* Use block barriers */
#define EXT4_MOUNT_QUOTA 0x80000 /* Some quota option set */
#define EXT4_MOUNT_USRQUOTA 0x100000 /* "old" user quota */
#define EXT4_MOUNT_GRPQUOTA 0x200000 /* "old" group quota */
-diff -u -r linux-stage.orig/fs/ext4/ext4_jbd2.h linux-stage/fs/ext4/ext4_jbd2.h
---- linux-stage.orig/fs/ext4/ext4_jbd2.h 2012-12-31 15:07:27.000000000 -0500
-+++ linux-stage/fs/ext4/ext4_jbd2.h 2012-12-31 15:07:34.000000000 -0500
+Index: linux-3.0.101-0.5/fs/ext4/ext4_jbd2.h
+===================================================================
+--- linux-3.0.101-0.5.orig/fs/ext4/ext4_jbd2.h
++++ linux-3.0.101-0.5/fs/ext4/ext4_jbd2.h
@@ -33,7 +33,7 @@
-
+
#define EXT4_SINGLEDATA_TRANS_BLOCKS(sb) \
(EXT4_HAS_INCOMPAT_FEATURE(sb, EXT4_FEATURE_INCOMPAT_EXTENTS) \
- ? 27U : 8U)
+ || test_opt(sb, EXTENTS) ? 27U : 8U)
-
- #define ext4_journal_dirty_metadata(handle, bh) \
- ext4_handle_dirty_metadata(handle, NULL, bh)
-diff -u -r linux-stage.orig/fs/ext4/extents.c linux-stage/fs/ext4/extents.c
---- linux-stage.orig/fs/ext4/extents.c 2012-12-31 15:07:27.000000000 -0500
-+++ linux-stage/fs/ext4/extents.c 2012-12-31 15:07:34.000000000 -0500
-@@ -2733,7 +2733,7 @@
+
+ /* Extended attribute operations touch at most two data buffers,
+ * two bitmap buffers, and two group summaries, in addition to the inode
+Index: linux-3.0.101-0.5/fs/ext4/extents.c
+===================================================================
+--- linux-3.0.101-0.5.orig/fs/ext4/extents.c
++++ linux-3.0.101-0.5/fs/ext4/extents.c
+@@ -2751,7 +2751,7 @@ void ext4_ext_init(struct super_block *s
* possible initialization would be here
*/
-
+
- if (EXT4_HAS_INCOMPAT_FEATURE(sb, EXT4_FEATURE_INCOMPAT_EXTENTS)) {
+ if (test_opt(sb, EXTENTS)) {
#if defined(AGGRESSIVE_TEST) || defined(CHECK_BINSEARCH) || defined(EXTENTS_STATS)
printk(KERN_INFO "EXT4-fs: file extents enabled");
#ifdef AGGRESSIVE_TEST
-@@ -2760,7 +2760,7 @@
+@@ -2778,7 +2778,7 @@ void ext4_ext_init(struct super_block *s
*/
void ext4_ext_release(struct super_block *sb)
{
- if (!EXT4_HAS_INCOMPAT_FEATURE(sb, EXT4_FEATURE_INCOMPAT_EXTENTS))
+ if (!test_opt(sb, EXTENTS))
return;
-
+
#ifdef EXTENTS_STATS
-diff -u -r linux-stage.orig/fs/ext4/ialloc.c linux-stage/fs/ext4/ialloc.c
---- linux-stage.orig/fs/ext4/ialloc.c 2012-12-31 15:07:27.000000000 -0500
-+++ linux-stage/fs/ext4/ialloc.c 2012-12-31 15:07:34.000000000 -0500
-@@ -1057,7 +1057,7 @@
+Index: linux-3.0.101-0.5/fs/ext4/ialloc.c
+===================================================================
+--- linux-3.0.101-0.5.orig/fs/ext4/ialloc.c
++++ linux-3.0.101-0.5/fs/ext4/ialloc.c
+@@ -1054,7 +1054,7 @@ got:
if (err)
goto fail_free_drop;
-
+
- if (EXT4_HAS_INCOMPAT_FEATURE(sb, EXT4_FEATURE_INCOMPAT_EXTENTS)) {
+ if (test_opt(sb, EXTENTS)) {
/* set extent flag only for directory, file and normal symlink*/
if (S_ISDIR(mode) || S_ISREG(mode) || S_ISLNK(mode)) {
ext4_set_inode_flag(inode, EXT4_INODE_EXTENTS);
-diff -u -r linux-stage.orig/fs/ext4/migrate.c linux-stage/fs/ext4/migrate.c
---- linux-stage.orig/fs/ext4/migrate.c 2012-12-31 15:07:27.000000000 -0500
-+++ linux-stage/fs/ext4/migrate.c 2012-12-31 15:07:34.000000000 -0500
-@@ -469,13 +469,10 @@
+Index: linux-3.0.101-0.5/fs/ext4/migrate.c
+===================================================================
+--- linux-3.0.101-0.5.orig/fs/ext4/migrate.c
++++ linux-3.0.101-0.5/fs/ext4/migrate.c
+@@ -469,13 +469,10 @@ int ext4_ext_migrate(struct inode *inode
unsigned long max_entries;
__u32 goal;
-
+
- /*
- * If the filesystem does not support extents, or the inode
- * already is extent-based, error out.
+ * if mounted with noextents we don't allow the migrate
+ */
return -EINVAL;
-
+
if (S_ISLNK(inode->i_mode) && inode->i_blocks == 0)
-diff -u -r linux-stage.orig/fs/ext4/super.c linux-stage/fs/ext4/super.c
---- linux-stage.orig/fs/ext4/super.c 2012-12-31 15:07:27.000000000 -0500
-+++ linux-stage/fs/ext4/super.c 2012-12-31 15:15:49.000000000 -0500
-@@ -1078,6 +1078,8 @@
+Index: linux-3.0.101-0.5/fs/ext4/super.c
+===================================================================
+--- linux-3.0.101-0.5.orig/fs/ext4/super.c
++++ linux-3.0.101-0.5/fs/ext4/super.c
+@@ -1128,6 +1128,8 @@ static int ext4_show_options(struct seq_
seq_puts(seq, ",journal_async_commit");
else if (test_opt(sb, JOURNAL_CHECKSUM))
seq_puts(seq, ",journal_checksum");
if (test_opt(sb, I_VERSION))
seq_puts(seq, ",i_version");
if (!test_opt(sb, DELALLOC) &&
-@@ -1303,6 +1305,7 @@
+@@ -1369,6 +1371,7 @@ enum {
Opt_inode_readahead_blks, Opt_journal_ioprio,
Opt_dioread_nolock, Opt_dioread_lock,
Opt_mballoc, Opt_bigendian_extents, Opt_force_over_128tb,
+ Opt_extents, Opt_noextents,
Opt_discard, Opt_nodiscard, Opt_init_itable, Opt_noinit_itable,
};
-
-@@ -1380,6 +1383,8 @@
+
+@@ -1446,6 +1449,8 @@ static const match_table_t tokens = {
{Opt_bigendian_extents, "bigendian_extents"},
{Opt_force_over_128tb, "force_over_128tb"},
{Opt_mballoc, "mballoc"},
{Opt_discard, "discard"},
{Opt_nodiscard, "nodiscard"},
{Opt_init_itable, "init_itable=%u"},
-@@ -1472,6 +1477,7 @@
+@@ -1538,6 +1543,7 @@ static int clear_qf_name(struct super_bl
return 1;
}
#endif
+ ext4_fsblk_t last_block;
-
+
static int parse_options(char *options, struct super_block *sb,
unsigned long *journal_devnum,
-@@ -1887,6 +1893,32 @@
+@@ -1953,6 +1959,32 @@ set_qf_format:
case Opt_force_over_128tb:
force_over_128tb = 1;
break;
default:
ext4_msg(sb, KERN_ERR,
"Unrecognized mount option \"%s\" "
-@@ -3206,6 +3238,14 @@
+@@ -3276,6 +3308,14 @@ static int ext4_fill_super(struct super_
set_opt(sb, BARRIER);
-
+
/*
+ * turn on extents feature by default in ext4 filesystem
+ * only if feature flag already set by mkfs or tune2fs.
+
+ memcpy(bh->b_data, buf, csize);
+ set_buffer_uptodate(bh);
-+ ext4_journal_dirty_metadata(handle, bh);
++ ext4_handle_dirty_metadata(handle, ea_inode, bh);
+
+ buf += csize;
+ wsize += csize;
struct ext4_extent *ex2);
--- a/fs/ext4/ext4_jbd2.h
+++ b/fs/ext4/ext4_jbd2.h
-@@ -35,6 +35,8 @@
- (EXT4_HAS_INCOMPAT_FEATURE(sb, EXT4_FEATURE_INCOMPAT_EXTENTS) \
- ? 27U : 8U)
-
-+#define ext4_journal_dirty_metadata(handle, bh) \
-+ ext4_handle_dirty_metadata(handle, NULL, bh)
- /* Extended attribute operations touch at most two data buffers,
- * two bitmap buffers, and two group summaries, in addition to the inode
- * and the superblock, which are already accounted for. */
@@ -175,6 +177,7 @@ static inline void ext4_journal_callback
list_del_init(&jce->jce_list);
spin_unlock(&sbi->s_md_lock);
rhel6.3/ext4-data-in-dirent.patch
rhel6.3/ext4-large-eas.patch
rhel6.3/ext4-disable-mb-cache.patch
-rhel6.3/ext4-back-dquot-to.patch
+rhel6.4/ext4-back-dquot-to.patch
rhel6.3/ext4-nocmtime-2.6.patch
rhel6.3/ext4-journal-callback.patch
rhel6.3/ext4-store-tree-generation-at-find.patch
rhel6.3/ext4-data-in-dirent.patch
rhel6.3/ext4-large-eas.patch
rhel6.3/ext4-disable-mb-cache.patch
-rhel6.3/ext4-back-dquot-to.patch
+rhel6.4/ext4-back-dquot-to.patch
rhel6.3/ext4-nocmtime-2.6.patch
rhel6.3/ext4-journal-callback.patch
rhel6.5/ext4-ext-walk-space.patch
rhel6.3/ext4-data-in-dirent.patch
rhel6.3/ext4-large-eas.patch
rhel6.3/ext4-disable-mb-cache.patch
-rhel6.3/ext4-back-dquot-to.patch
+rhel6.4/ext4-back-dquot-to.patch
rhel6.3/ext4-nocmtime-2.6.patch
rhel6.3/ext4-journal-callback.patch
rhel6.5/ext4-ext-walk-space.patch
rhel6.3/ext4-data-in-dirent.patch
rhel6.3/ext4-large-eas.patch
rhel6.3/ext4-disable-mb-cache.patch
-rhel6.3/ext4-back-dquot-to.patch
+rhel6.4/ext4-back-dquot-to.patch
rhel6.3/ext4-nocmtime-2.6.patch
rhel6.3/ext4-export-64bit-name-hash.patch
rhel6.3/ext4-journal-callback.patch
GOTO(out, rc);
de->inode = cpu_to_le32(id->oii_ino);
- rc = ldiskfs_journal_dirty_metadata(th, bh);
+ rc = ldiskfs_handle_dirty_metadata(th, NULL, bh);
GOTO(out, rc);
else
de->file_type = LDISKFS_DIRENT_LUFID |
LDISKFS_FT_DIR;
- ldiskfs_journal_dirty_metadata(oth->ot_handle,
- bh);
+ ldiskfs_handle_dirty_metadata(oth->ot_handle,
+ NULL, bh);
brelse(bh);
}
}
rec = (struct osd_fid_pack *)(de->name + de->name_len + 1);
fid_cpu_to_be((struct lu_fid *)rec->fp_area, fid);
- rc = ldiskfs_journal_dirty_metadata(jh, bh);
+ rc = ldiskfs_handle_dirty_metadata(jh, NULL, bh);
RETURN(rc);
}
fid_cpu_to_be((struct lu_fid *)rec->fp_area, fid);
de->file_type |= LDISKFS_DIRENT_LUFID;
- rc = ldiskfs_journal_dirty_metadata(jh, bh);
+ rc = ldiskfs_handle_dirty_metadata(jh, NULL, bh);
RETURN(rc);
}
{
int result;
- result = ldiskfs_journal_dirty_metadata(handle, bh);
+ result = ldiskfs_handle_dirty_metadata(handle, NULL, bh);
if (result != 0)
ldiskfs_std_error(iam_path_obj(path)->i_sb, result);
return result;
--count;
*b = le32_to_cpu(head->iih_blks[count]);
head->iih_count = cpu_to_le16(count);
- *e = ldiskfs_journal_dirty_metadata(h, c->ic_idle_bh);
+ *e = ldiskfs_handle_dirty_metadata(h, inode, c->ic_idle_bh);
if (*e != 0)
goto fail;
iam_lock_bh(c->ic_root_bh);
*idle_blocks = head->iih_next;
iam_unlock_bh(c->ic_root_bh);
- *e = ldiskfs_journal_dirty_metadata(h, c->ic_root_bh);
+ *e = ldiskfs_handle_dirty_metadata(h, inode, c->ic_root_bh);
if (*e != 0) {
iam_lock_bh(c->ic_root_bh);
*idle_blocks = cpu_to_le32(*b);
++ frame;
assert_inv(dx_node_check(path, frame));
bh_new[0] = NULL; /* buffer head is "consumed" */
- err = ldiskfs_journal_dirty_metadata(handle, bh2);
+ err = ldiskfs_handle_dirty_metadata(handle, NULL, bh2);
if (err)
goto journal_error;
do_corr(schedule());
dxtrace(dx_show_index ("node", frame->entries));
dxtrace(dx_show_index ("node",
((struct dx_node *) bh2->b_data)->entries));
- err = ldiskfs_journal_dirty_metadata(handle, bh2);
+ err = ldiskfs_handle_dirty_metadata(handle, NULL, bh2);
if (err)
goto journal_error;
do_corr(schedule());
- err = ldiskfs_journal_dirty_metadata(handle, parent->bh);
+ err = ldiskfs_handle_dirty_metadata(handle, NULL,
+ parent->bh);
if (err)
goto journal_error;
}
do_corr(schedule());
- err = ldiskfs_journal_dirty_metadata(handle, bh);
+ err = ldiskfs_handle_dirty_metadata(handle, NULL, bh);
if (err)
goto journal_error;
}
lfix_root(root_node->b_data, bsize, keysize, ptrsize, recsize);
lfix_leaf(leaf_node->b_data, bsize, keysize, ptrsize, recsize);
ldiskfs_mark_inode_dirty(handle, obj);
- result = ldiskfs_journal_dirty_metadata(handle, root_node);
- if (result == 0)
- result = ldiskfs_journal_dirty_metadata(handle, leaf_node);
+ result = ldiskfs_handle_dirty_metadata(handle, NULL, root_node);
+ if (result == 0)
+ result = ldiskfs_handle_dirty_metadata(handle, NULL,
+ leaf_node);
if (result != 0)
ldiskfs_std_error(sb, result);
}
lvar_root(root_node->b_data, bsize, keysize, ptrsize, recsize);
lvar_leaf(leaf_node->b_data, bsize, keysize, ptrsize, recsize);
ldiskfs_mark_inode_dirty(handle, obj);
- result = ldiskfs_journal_dirty_metadata(handle, root_node);
- if (result == 0)
- result = ldiskfs_journal_dirty_metadata(handle, leaf_node);
+ result = ldiskfs_handle_dirty_metadata(handle, NULL, root_node);
+ if (result == 0)
+ result = ldiskfs_handle_dirty_metadata(handle, NULL,
+ leaf_node);
if (result != 0)
ldiskfs_std_error(sb, result);
}
"boffs %d size %d bh->b_size %lu\n",
boffs, size, (unsigned long)bh->b_size);
memcpy(bh->b_data + boffs, buf, size);
- err = ldiskfs_journal_dirty_metadata(handle, bh);
+ err = ldiskfs_handle_dirty_metadata(handle, NULL, bh);
if (err)
break;