summaryrefslogtreecommitdiffstats
path: root/fs/f2fs/segment.c
diff options
context:
space:
mode:
authorChao Yu <chao2.yu@samsung.com>2014-03-22 02:57:23 -0400
committerJaegeuk Kim <jaegeuk.kim@samsung.com>2014-04-01 05:53:41 -0400
commitdf0f8dc0e154de13e3a54846f384b674dd557c85 (patch)
tree9465da562d6136bd8a49d55b834f3713af880c5f /fs/f2fs/segment.c
parent3bb5e2c8fe2296ddd9d864dcfb5ee1b77135f3ec (diff)
f2fs: avoid unnecessary bio submit when wait page writeback
This patch introduce is_merged_page() to check whether current page is merged in f2fs bio cache. When page is not in cache, we can avoid submitting bio cache, resulting in having more chance to merge pages. Signed-off-by: Chao Yu <chao2.yu@samsung.com> Signed-off-by: Jaegeuk Kim <jaegeuk.kim@samsung.com>
Diffstat (limited to 'fs/f2fs/segment.c')
-rw-r--r--fs/f2fs/segment.c28
1 files changed, 27 insertions, 1 deletions
diff --git a/fs/f2fs/segment.c b/fs/f2fs/segment.c
index e7ff23a536a4..570ab9a084c5 100644
--- a/fs/f2fs/segment.c
+++ b/fs/f2fs/segment.c
@@ -1046,12 +1046,38 @@ void rewrite_node_page(struct f2fs_sb_info *sbi,
1046 mutex_unlock(&curseg->curseg_mutex); 1046 mutex_unlock(&curseg->curseg_mutex);
1047} 1047}
1048 1048
1049static inline bool is_merged_page(struct f2fs_sb_info *sbi,
1050 struct page *page, enum page_type type)
1051{
1052 enum page_type btype = PAGE_TYPE_OF_BIO(type);
1053 struct f2fs_bio_info *io = &sbi->write_io[btype];
1054 struct bio *bio = io->bio;
1055 struct bio_vec *bvec;
1056 int i;
1057
1058 down_read(&io->io_rwsem);
1059 if (!bio)
1060 goto out;
1061
1062 bio_for_each_segment_all(bvec, bio, i) {
1063 if (page == bvec->bv_page) {
1064 up_read(&io->io_rwsem);
1065 return true;
1066 }
1067 }
1068
1069out:
1070 up_read(&io->io_rwsem);
1071 return false;
1072}
1073
1049void f2fs_wait_on_page_writeback(struct page *page, 1074void f2fs_wait_on_page_writeback(struct page *page,
1050 enum page_type type) 1075 enum page_type type)
1051{ 1076{
1052 struct f2fs_sb_info *sbi = F2FS_SB(page->mapping->host->i_sb); 1077 struct f2fs_sb_info *sbi = F2FS_SB(page->mapping->host->i_sb);
1053 if (PageWriteback(page)) { 1078 if (PageWriteback(page)) {
1054 f2fs_submit_merged_bio(sbi, type, WRITE); 1079 if (is_merged_page(sbi, page, type))
1080 f2fs_submit_merged_bio(sbi, type, WRITE);
1055 wait_on_page_writeback(page); 1081 wait_on_page_writeback(page);
1056 } 1082 }
1057} 1083}