summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJaegeuk Kim <jaegeuk@kernel.org>2016-07-12 18:07:52 (GMT)
committerJaegeuk Kim <jaegeuk@kernel.org>2016-07-15 22:21:20 (GMT)
commit5f281fab9b9a30073616c5e25da2111dec2fe482 (patch)
treefcb4562c2ee2ea20b313401b034b67df789f69c5
parent0a2aa8fbb9693020b822ac7a23755591554eaea5 (diff)
downloadlinux-5f281fab9b9a30073616c5e25da2111dec2fe482.tar.xz
f2fs: disable extent_cache for fcollapse/finsert inodes
This reduces the elapsed time to do xfstests/generic/017. Before: 458 s After: 390 s Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
-rw-r--r--fs/f2fs/extent_cache.c13
-rw-r--r--fs/f2fs/f2fs.h1
-rw-r--r--fs/f2fs/file.c5
3 files changed, 19 insertions, 0 deletions
diff --git a/fs/f2fs/extent_cache.c b/fs/f2fs/extent_cache.c
index 5b4b6d4..2b06d4f 100644
--- a/fs/f2fs/extent_cache.c
+++ b/fs/f2fs/extent_cache.c
@@ -631,6 +631,19 @@ unsigned int f2fs_destroy_extent_node(struct inode *inode)
return node_cnt;
}
+void f2fs_drop_extent_tree(struct inode *inode)
+{
+ struct f2fs_sb_info *sbi = F2FS_I_SB(inode);
+ struct extent_tree *et = F2FS_I(inode)->extent_tree;
+
+ set_inode_flag(inode, FI_NO_EXTENT);
+
+ write_lock(&et->lock);
+ __free_extent_tree(sbi, et);
+ __drop_largest_extent(inode, 0, UINT_MAX);
+ write_unlock(&et->lock);
+}
+
void f2fs_destroy_extent_tree(struct inode *inode)
{
struct f2fs_sb_info *sbi = F2FS_I_SB(inode);
diff --git a/fs/f2fs/f2fs.h b/fs/f2fs/f2fs.h
index 0e46dd0..b4a46b6 100644
--- a/fs/f2fs/f2fs.h
+++ b/fs/f2fs/f2fs.h
@@ -2297,6 +2297,7 @@ void f2fs_leave_shrinker(struct f2fs_sb_info *);
*/
unsigned int f2fs_shrink_extent_tree(struct f2fs_sb_info *, int);
bool f2fs_init_extent_tree(struct inode *, struct f2fs_extent *);
+void f2fs_drop_extent_tree(struct inode *);
unsigned int f2fs_destroy_extent_node(struct inode *);
void f2fs_destroy_extent_tree(struct inode *);
bool f2fs_lookup_extent_cache(struct inode *, pgoff_t, struct extent_info *);
diff --git a/fs/f2fs/file.c b/fs/f2fs/file.c
index b1dc972..72e52cd 100644
--- a/fs/f2fs/file.c
+++ b/fs/f2fs/file.c
@@ -1044,6 +1044,9 @@ static int f2fs_do_collapse(struct inode *inode, pgoff_t start, pgoff_t end)
f2fs_balance_fs(sbi, true);
f2fs_lock_op(sbi);
+
+ f2fs_drop_extent_tree(inode);
+
ret = __exchange_data_block(inode, inode, end, start, nrpages - end, true);
f2fs_unlock_op(sbi);
return ret;
@@ -1278,6 +1281,8 @@ static int f2fs_insert_range(struct inode *inode, loff_t offset, loff_t len)
idx -= nr;
f2fs_lock_op(sbi);
+ f2fs_drop_extent_tree(inode);
+
ret = __exchange_data_block(inode, inode, idx,
idx + delta, nr, false);
f2fs_unlock_op(sbi);