aboutsummaryrefslogtreecommitdiffstats
path: root/fs/f2fs/node.c
diff options
context:
space:
mode:
authorJaegeuk Kim <jaegeuk.kim@samsung.com>2013-12-10 23:54:01 -0500
committerJaegeuk Kim <jaegeuk.kim@samsung.com>2013-12-22 20:18:06 -0500
commit458e6197c37de53f7be0a837644daabb900c3036 (patch)
tree248c02467c0c1f8d84a8e6c23700620a939f3c58 /fs/f2fs/node.c
parent63a0b7cb33d85aeb0df39b984c08e234db4925d1 (diff)
f2fs: refactor bio->rw handling
This patch introduces f2fs_io_info to mitigate the complex parameter list. struct f2fs_io_info { enum page_type type; /* contains DATA/NODE/META/META_FLUSH */ int rw; /* contains R/RS/W/WS */ int rw_flag; /* contains REQ_META/REQ_PRIO */ } 1. f2fs_write_data_pages - DATA - WRITE_SYNC is set when wbc->WB_SYNC_ALL. 2. sync_node_pages - NODE - WRITE_SYNC all the time 3. sync_meta_pages - META - WRITE_SYNC all the time - REQ_META | REQ_PRIO all the time ** f2fs_submit_merged_bio() handles META_FLUSH. 4. ra_nat_pages, ra_sit_pages, ra_sum_pages - META - READ_SYNC Cc: Fan Li <fanofcode.li@samsung.com> Cc: Changman Lee <cm224.lee@samsung.com> Signed-off-by: Jaegeuk Kim <jaegeuk.kim@samsung.com>
Diffstat (limited to 'fs/f2fs/node.c')
-rw-r--r--fs/f2fs/node.c22
1 files changed, 16 insertions, 6 deletions
diff --git a/fs/f2fs/node.c b/fs/f2fs/node.c
index 6c6ef772cf01..3565caf97005 100644
--- a/fs/f2fs/node.c
+++ b/fs/f2fs/node.c
@@ -92,6 +92,12 @@ static void ra_nat_pages(struct f2fs_sb_info *sbi, int nid)
92 struct page *page; 92 struct page *page;
93 pgoff_t index; 93 pgoff_t index;
94 int i; 94 int i;
95 struct f2fs_io_info fio = {
96 .type = META,
97 .rw = READ_SYNC,
98 .rw_flag = REQ_META | REQ_PRIO
99 };
100
95 101
96 for (i = 0; i < FREE_NID_PAGES; i++, nid += NAT_ENTRY_PER_BLOCK) { 102 for (i = 0; i < FREE_NID_PAGES; i++, nid += NAT_ENTRY_PER_BLOCK) {
97 if (unlikely(nid >= nm_i->max_nid)) 103 if (unlikely(nid >= nm_i->max_nid))
@@ -106,11 +112,11 @@ static void ra_nat_pages(struct f2fs_sb_info *sbi, int nid)
106 f2fs_put_page(page, 1); 112 f2fs_put_page(page, 1);
107 continue; 113 continue;
108 } 114 }
109 f2fs_submit_page_mbio(sbi, page, index, META, READ); 115 f2fs_submit_page_mbio(sbi, page, index, &fio);
110 mark_page_accessed(page); 116 mark_page_accessed(page);
111 f2fs_put_page(page, 0); 117 f2fs_put_page(page, 0);
112 } 118 }
113 f2fs_submit_merged_bio(sbi, META, true, READ); 119 f2fs_submit_merged_bio(sbi, META, READ);
114} 120}
115 121
116static struct nat_entry *__lookup_nat_cache(struct f2fs_nm_info *nm_i, nid_t n) 122static struct nat_entry *__lookup_nat_cache(struct f2fs_nm_info *nm_i, nid_t n)
@@ -1136,8 +1142,7 @@ continue_unlock:
1136 } 1142 }
1137 1143
1138 if (wrote) 1144 if (wrote)
1139 f2fs_submit_merged_bio(sbi, NODE, wbc->sync_mode == WB_SYNC_ALL, 1145 f2fs_submit_merged_bio(sbi, NODE, WRITE);
1140 WRITE);
1141 return nwritten; 1146 return nwritten;
1142} 1147}
1143 1148
@@ -1574,6 +1579,11 @@ static int ra_sum_pages(struct f2fs_sb_info *sbi, struct list_head *pages,
1574{ 1579{
1575 struct page *page; 1580 struct page *page;
1576 int page_idx = start; 1581 int page_idx = start;
1582 struct f2fs_io_info fio = {
1583 .type = META,
1584 .rw = READ_SYNC,
1585 .rw_flag = REQ_META | REQ_PRIO
1586 };
1577 1587
1578 for (; page_idx < start + nrpages; page_idx++) { 1588 for (; page_idx < start + nrpages; page_idx++) {
1579 /* alloc temporal page for read node summary info*/ 1589 /* alloc temporal page for read node summary info*/
@@ -1594,9 +1604,9 @@ static int ra_sum_pages(struct f2fs_sb_info *sbi, struct list_head *pages,
1594 } 1604 }
1595 1605
1596 list_for_each_entry(page, pages, lru) 1606 list_for_each_entry(page, pages, lru)
1597 f2fs_submit_page_mbio(sbi, page, page->index, META, READ); 1607 f2fs_submit_page_mbio(sbi, page, page->index, &fio);
1598 1608
1599 f2fs_submit_merged_bio(sbi, META, true, READ); 1609 f2fs_submit_merged_bio(sbi, META, READ);
1600 return 0; 1610 return 0;
1601} 1611}
1602 1612