diff options
author | David Sterba <dsterba@suse.cz> | 2014-02-05 15:26:17 +0100 |
---|---|---|
committer | David Sterba <dsterba@suse.cz> | 2014-11-12 16:53:13 +0100 |
commit | 7e1876aca815029d5c3023a66a91e249eca3e533 (patch) | |
tree | 95b45315399590654ef882d2f55cb9944d732598 /fs/btrfs/transaction.c | |
parent | 6b5fe46dfa52441f49c7432b1c1b1cb767834708 (diff) | |
download | linux-7e1876aca815029d5c3023a66a91e249eca3e533.tar.gz linux-7e1876aca815029d5c3023a66a91e249eca3e533.tar.bz2 linux-7e1876aca815029d5c3023a66a91e249eca3e533.zip |
btrfs: switch inode_cache option handling to pending changes
The pending mount option(s) now share namespace and bits with the normal
options, and the existing one for (inode_cache) is unset unconditionally
at each transaction commit.
Introduce a separate namespace for pending changes and enhance the
descriptions of the intended change to use separate bits for each
action.
Signed-off-by: David Sterba <dsterba@suse.cz>
Diffstat (limited to 'fs/btrfs/transaction.c')
-rw-r--r-- | fs/btrfs/transaction.c | 19 |
1 files changed, 12 insertions, 7 deletions
diff --git a/fs/btrfs/transaction.c b/fs/btrfs/transaction.c index 7a4024a55e5c..703238ed7337 100644 --- a/fs/btrfs/transaction.c +++ b/fs/btrfs/transaction.c @@ -1842,14 +1842,9 @@ int btrfs_commit_transaction(struct btrfs_trans_handle *trans, } /* - * Since the transaction is done, we should set the inode map cache flag - * before any other comming transaction. + * Since the transaction is done, we can apply the pending changes + * before the next transaction. */ - if (btrfs_test_opt(root, CHANGE_INODE_CACHE)) - btrfs_set_opt(root->fs_info->mount_opt, INODE_MAP_CACHE); - else - btrfs_clear_opt(root->fs_info->mount_opt, INODE_MAP_CACHE); - btrfs_apply_pending_changes(root->fs_info); /* commit_fs_roots gets rid of all the tree log roots, it is now @@ -2031,6 +2026,16 @@ void btrfs_apply_pending_changes(struct btrfs_fs_info *fs_info) if (!prev) return; + bit = 1 << BTRFS_PENDING_SET_INODE_MAP_CACHE; + if (prev & bit) + btrfs_set_opt(fs_info->mount_opt, INODE_MAP_CACHE); + prev &= ~bit; + + bit = 1 << BTRFS_PENDING_CLEAR_INODE_MAP_CACHE; + if (prev & bit) + btrfs_clear_opt(fs_info->mount_opt, INODE_MAP_CACHE); + prev &= ~bit; + if (prev) btrfs_warn(fs_info, "unknown pending changes left 0x%lx, ignoring", prev); |