diff options
author | Qu Wenruo <quwenruo@cn.fujitsu.com> | 2014-01-13 00:36:06 -0500 |
---|---|---|
committer | Chris Mason <clm@fb.com> | 2014-01-28 16:20:33 -0500 |
commit | 3818aea275423236db38a2d2d0a4951bc6da2e01 (patch) | |
tree | 8f6c5e005a8be46049554306acf32786eb3c7d32 /fs/btrfs/transaction.c | |
parent | ade2e0b3eeca941a5cd486bac21599ff87f288c8 (diff) |
btrfs: Add noinode_cache mount option
Add noinode_cache mount option for btrfs.
Since inode map cache involves all the btrfs_find_free_ino/return_ino
things and if just trigger the mount_opt,
an inode number get from inode map cache will not returned to inode map
cache.
To keep the find and return inode both in the same behavior,
a new bit in mount_opt, CHANGE_INODE_CACHE, is introduced for this idea.
CHANGE_INODE_CACHE is set/cleared in remounting, and the original
INODE_MAP_CACHE is set/cleared according to CHANGE_INODE_CACHE after a
success transaction.
Since find/return inode is all done between btrfs_start_transaction and
btrfs_commit_transaction, this will keep consistent behavior.
Also noinode_cache mount option will not stop the caching_kthread.
Cc: David Sterba <dsterba@suse.cz>
Signed-off-by: Miao Xie <miaox@cn.fujitsu.com>
Signed-off-by: Qu Wenruo <quwenruo@cn.fujitsu.com>
Signed-off-by: Josef Bacik <jbacik@fb.com>
Signed-off-by: Chris Mason <clm@fb.com>
Diffstat (limited to 'fs/btrfs/transaction.c')
-rw-r--r-- | fs/btrfs/transaction.c | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/fs/btrfs/transaction.c b/fs/btrfs/transaction.c index 5e2bfdaf8d14..34cd83184c4a 100644 --- a/fs/btrfs/transaction.c +++ b/fs/btrfs/transaction.c | |||
@@ -1826,6 +1826,15 @@ int btrfs_commit_transaction(struct btrfs_trans_handle *trans, | |||
1826 | goto cleanup_transaction; | 1826 | goto cleanup_transaction; |
1827 | } | 1827 | } |
1828 | 1828 | ||
1829 | /* | ||
1830 | * Since the transaction is done, we should set the inode map cache flag | ||
1831 | * before any other comming transaction. | ||
1832 | */ | ||
1833 | if (btrfs_test_opt(root, CHANGE_INODE_CACHE)) | ||
1834 | btrfs_set_opt(root->fs_info->mount_opt, INODE_MAP_CACHE); | ||
1835 | else | ||
1836 | btrfs_clear_opt(root->fs_info->mount_opt, INODE_MAP_CACHE); | ||
1837 | |||
1829 | /* commit_fs_roots gets rid of all the tree log roots, it is now | 1838 | /* commit_fs_roots gets rid of all the tree log roots, it is now |
1830 | * safe to free the root of tree log roots | 1839 | * safe to free the root of tree log roots |
1831 | */ | 1840 | */ |