summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJaegeuk Kim <jaegeuk@kernel.org>2016-03-30 01:13:45 +0200
committerJaegeuk Kim <jaegeuk@kernel.org>2016-04-15 17:49:47 +0200
commitff37355886ac2082cee594aa949c08e2cfb33aa0 (patch)
tree2e8c8c1266bb00d67d241e1b514a905d61d85d4d
parentf2fs: use PGP_LOCK to check its truncation (diff)
downloadlinux-ff37355886ac2082cee594aa949c08e2cfb33aa0.tar.xz
linux-ff37355886ac2082cee594aa949c08e2cfb33aa0.zip
f2fs: add BUG_ON to avoid unnecessary flow
This patch adds BUG_ON instead of retrying loop. In the case of node pages, we already got this inode page, but unlocked it. By the fact that we don't truncate any node pages in operations, the page's mapping should be unchangeable. Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
-rw-r--r--fs/f2fs/node.c7
1 files changed, 2 insertions, 5 deletions
diff --git a/fs/f2fs/node.c b/fs/f2fs/node.c
index ade221c9756b..095fc2c96e16 100644
--- a/fs/f2fs/node.c
+++ b/fs/f2fs/node.c
@@ -832,7 +832,7 @@ int truncate_inode_blocks(struct inode *inode, pgoff_t from)
trace_f2fs_truncate_inode_blocks_enter(inode, from);
level = get_node_path(inode, from, offset, noffset);
-restart:
+
page = get_node_page(sbi, inode->i_ino);
if (IS_ERR(page)) {
trace_f2fs_truncate_inode_blocks_exit(inode, PTR_ERR(page));
@@ -896,10 +896,7 @@ skip_partial:
if (offset[1] == 0 &&
ri->i_nid[offset[0] - NODE_DIR1_BLOCK]) {
lock_page(page);
- if (unlikely(page->mapping != NODE_MAPPING(sbi))) {
- f2fs_put_page(page, 1);
- goto restart;
- }
+ BUG_ON(page->mapping != NODE_MAPPING(sbi));
f2fs_wait_on_page_writeback(page, NODE, true);
ri->i_nid[offset[0] - NODE_DIR1_BLOCK] = 0;
set_page_dirty(page);