Skip to content

Commit

Permalink
f2fs: don't submit irrelevant page
Browse files Browse the repository at this point in the history
While we call ->writepages, there are two cases:
a. we didn't writeout any dirty pages, since they are writebacked by other
thread concurrently.
b. we writeout dirty pages, and have already submitted bio to block layer.

In these cases, we don't need to do additional bio flushing unnecessarily,
it may split bio in cache into smaller one.

Signed-off-by: Chao Yu <yuchao0@huawei.com>
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
  • Loading branch information
Chao Yu authored and Jaegeuk Kim committed Oct 1, 2016
1 parent 3f5f495 commit 6ca56ca
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion fs/f2fs/data.c
Original file line number Diff line number Diff line change
Expand Up @@ -1355,6 +1355,7 @@ static int f2fs_write_cache_pages(struct address_space *mapping,
int cycled;
int range_whole = 0;
int tag;
int nwritten = 0;

pagevec_init(&pvec, 0);

Expand Down Expand Up @@ -1429,6 +1430,8 @@ static int f2fs_write_cache_pages(struct address_space *mapping,
done_index = page->index + 1;
done = 1;
break;
} else {
nwritten++;
}

if (--wbc->nr_to_write <= 0 &&
Expand All @@ -1450,6 +1453,10 @@ static int f2fs_write_cache_pages(struct address_space *mapping,
if (wbc->range_cyclic || (range_whole && wbc->nr_to_write > 0))
mapping->writeback_index = done_index;

if (nwritten)
f2fs_submit_merged_bio_cond(F2FS_M_SB(mapping), mapping->host,
NULL, 0, DATA, WRITE);

return ret;
}

Expand Down Expand Up @@ -1491,7 +1498,6 @@ static int f2fs_write_data_pages(struct address_space *mapping,
* if some pages were truncated, we cannot guarantee its mapping->host
* to detect pending bios.
*/
f2fs_submit_merged_bio(sbi, DATA, WRITE);

remove_dirty_inode(inode);
return ret;
Expand Down

0 comments on commit 6ca56ca

Please sign in to comment.