diff options
author | Gu Zheng <guz.fnst@cn.fujitsu.com> | 2014-01-20 05:37:04 -0500 |
---|---|---|
committer | Jaegeuk Kim <jaegeuk.kim@samsung.com> | 2014-01-22 04:41:07 -0500 |
commit | 9df27d982d58b9372bc476fb6b9bab861d617029 (patch) | |
tree | 3bd776a200082f1b24bfc98fd6c6478c653a4bd5 /fs | |
parent | e8dae6045882e32a067326f47b7ccd3aaf8814e2 (diff) |
f2fs: add help function META_MAPPING
Introduce help function META_MAPPING() to get the cache meta blocks'
address space.
Signed-off-by: Gu Zheng <guz.fnst@cn.fujitsu.com>
Signed-off-by: Jaegeuk Kim <jaegeuk.kim@samsung.com>
Diffstat (limited to 'fs')
-rw-r--r-- | fs/f2fs/checkpoint.c | 8 | ||||
-rw-r--r-- | fs/f2fs/debug.c | 4 | ||||
-rw-r--r-- | fs/f2fs/f2fs.h | 5 | ||||
-rw-r--r-- | fs/f2fs/node.c | 2 | ||||
-rw-r--r-- | fs/f2fs/segment.c | 2 |
5 files changed, 13 insertions, 8 deletions
diff --git a/fs/f2fs/checkpoint.c b/fs/f2fs/checkpoint.c index 4de0345f73f3..f9d4f7de75ad 100644 --- a/fs/f2fs/checkpoint.c +++ b/fs/f2fs/checkpoint.c | |||
@@ -30,7 +30,7 @@ static struct kmem_cache *inode_entry_slab; | |||
30 | */ | 30 | */ |
31 | struct page *grab_meta_page(struct f2fs_sb_info *sbi, pgoff_t index) | 31 | struct page *grab_meta_page(struct f2fs_sb_info *sbi, pgoff_t index) |
32 | { | 32 | { |
33 | struct address_space *mapping = sbi->meta_inode->i_mapping; | 33 | struct address_space *mapping = META_MAPPING(sbi); |
34 | struct page *page = NULL; | 34 | struct page *page = NULL; |
35 | repeat: | 35 | repeat: |
36 | page = grab_cache_page(mapping, index); | 36 | page = grab_cache_page(mapping, index); |
@@ -50,7 +50,7 @@ repeat: | |||
50 | */ | 50 | */ |
51 | struct page *get_meta_page(struct f2fs_sb_info *sbi, pgoff_t index) | 51 | struct page *get_meta_page(struct f2fs_sb_info *sbi, pgoff_t index) |
52 | { | 52 | { |
53 | struct address_space *mapping = sbi->meta_inode->i_mapping; | 53 | struct address_space *mapping = META_MAPPING(sbi); |
54 | struct page *page; | 54 | struct page *page; |
55 | repeat: | 55 | repeat: |
56 | page = grab_cache_page(mapping, index); | 56 | page = grab_cache_page(mapping, index); |
@@ -128,7 +128,7 @@ static int f2fs_write_meta_pages(struct address_space *mapping, | |||
128 | long sync_meta_pages(struct f2fs_sb_info *sbi, enum page_type type, | 128 | long sync_meta_pages(struct f2fs_sb_info *sbi, enum page_type type, |
129 | long nr_to_write) | 129 | long nr_to_write) |
130 | { | 130 | { |
131 | struct address_space *mapping = sbi->meta_inode->i_mapping; | 131 | struct address_space *mapping = META_MAPPING(sbi); |
132 | pgoff_t index = 0, end = LONG_MAX; | 132 | pgoff_t index = 0, end = LONG_MAX; |
133 | struct pagevec pvec; | 133 | struct pagevec pvec; |
134 | long nwritten = 0; | 134 | long nwritten = 0; |
@@ -771,7 +771,7 @@ static void do_checkpoint(struct f2fs_sb_info *sbi, bool is_umount) | |||
771 | wait_on_all_pages_writeback(sbi); | 771 | wait_on_all_pages_writeback(sbi); |
772 | 772 | ||
773 | filemap_fdatawait_range(sbi->node_inode->i_mapping, 0, LONG_MAX); | 773 | filemap_fdatawait_range(sbi->node_inode->i_mapping, 0, LONG_MAX); |
774 | filemap_fdatawait_range(sbi->meta_inode->i_mapping, 0, LONG_MAX); | 774 | filemap_fdatawait_range(META_MAPPING(sbi), 0, LONG_MAX); |
775 | 775 | ||
776 | /* update user_block_counts */ | 776 | /* update user_block_counts */ |
777 | sbi->last_valid_block_count = sbi->total_valid_block_count; | 777 | sbi->last_valid_block_count = sbi->total_valid_block_count; |
diff --git a/fs/f2fs/debug.c b/fs/f2fs/debug.c index 63cb7e215e00..8bdc365be9e3 100644 --- a/fs/f2fs/debug.c +++ b/fs/f2fs/debug.c | |||
@@ -53,7 +53,7 @@ static void update_general_status(struct f2fs_sb_info *sbi) | |||
53 | si->prefree_count = prefree_segments(sbi); | 53 | si->prefree_count = prefree_segments(sbi); |
54 | si->dirty_count = dirty_segments(sbi); | 54 | si->dirty_count = dirty_segments(sbi); |
55 | si->node_pages = sbi->node_inode->i_mapping->nrpages; | 55 | si->node_pages = sbi->node_inode->i_mapping->nrpages; |
56 | si->meta_pages = sbi->meta_inode->i_mapping->nrpages; | 56 | si->meta_pages = META_MAPPING(sbi)->nrpages; |
57 | si->nats = NM_I(sbi)->nat_cnt; | 57 | si->nats = NM_I(sbi)->nat_cnt; |
58 | si->sits = SIT_I(sbi)->dirty_sentries; | 58 | si->sits = SIT_I(sbi)->dirty_sentries; |
59 | si->fnids = NM_I(sbi)->fcnt; | 59 | si->fnids = NM_I(sbi)->fcnt; |
@@ -168,7 +168,7 @@ get_cache: | |||
168 | si->cache_mem += NM_I(sbi)->nat_cnt; | 168 | si->cache_mem += NM_I(sbi)->nat_cnt; |
169 | npages = sbi->node_inode->i_mapping->nrpages; | 169 | npages = sbi->node_inode->i_mapping->nrpages; |
170 | si->cache_mem += npages << PAGE_CACHE_SHIFT; | 170 | si->cache_mem += npages << PAGE_CACHE_SHIFT; |
171 | npages = sbi->meta_inode->i_mapping->nrpages; | 171 | npages = META_MAPPING(sbi)->nrpages; |
172 | si->cache_mem += npages << PAGE_CACHE_SHIFT; | 172 | si->cache_mem += npages << PAGE_CACHE_SHIFT; |
173 | si->cache_mem += sbi->n_orphans * sizeof(struct orphan_inode_entry); | 173 | si->cache_mem += sbi->n_orphans * sizeof(struct orphan_inode_entry); |
174 | si->cache_mem += sbi->n_dirty_dirs * sizeof(struct dir_inode_entry); | 174 | si->cache_mem += sbi->n_dirty_dirs * sizeof(struct dir_inode_entry); |
diff --git a/fs/f2fs/f2fs.h b/fs/f2fs/f2fs.h index 5ab3981938d4..117e30f6b88c 100644 --- a/fs/f2fs/f2fs.h +++ b/fs/f2fs/f2fs.h | |||
@@ -533,6 +533,11 @@ static inline struct dirty_seglist_info *DIRTY_I(struct f2fs_sb_info *sbi) | |||
533 | return (struct dirty_seglist_info *)(SM_I(sbi)->dirty_info); | 533 | return (struct dirty_seglist_info *)(SM_I(sbi)->dirty_info); |
534 | } | 534 | } |
535 | 535 | ||
536 | static inline struct address_space *META_MAPPING(struct f2fs_sb_info *sbi) | ||
537 | { | ||
538 | return sbi->meta_inode->i_mapping; | ||
539 | } | ||
540 | |||
536 | static inline void F2FS_SET_SB_DIRT(struct f2fs_sb_info *sbi) | 541 | static inline void F2FS_SET_SB_DIRT(struct f2fs_sb_info *sbi) |
537 | { | 542 | { |
538 | sbi->s_dirty = 1; | 543 | sbi->s_dirty = 1; |
diff --git a/fs/f2fs/node.c b/fs/f2fs/node.c index 226a05a27e33..527bd12d8ae1 100644 --- a/fs/f2fs/node.c +++ b/fs/f2fs/node.c | |||
@@ -87,7 +87,7 @@ static struct page *get_next_nat_page(struct f2fs_sb_info *sbi, nid_t nid) | |||
87 | */ | 87 | */ |
88 | static void ra_nat_pages(struct f2fs_sb_info *sbi, int nid) | 88 | static void ra_nat_pages(struct f2fs_sb_info *sbi, int nid) |
89 | { | 89 | { |
90 | struct address_space *mapping = sbi->meta_inode->i_mapping; | 90 | struct address_space *mapping = META_MAPPING(sbi); |
91 | struct f2fs_nm_info *nm_i = NM_I(sbi); | 91 | struct f2fs_nm_info *nm_i = NM_I(sbi); |
92 | struct page *page; | 92 | struct page *page; |
93 | pgoff_t index; | 93 | pgoff_t index; |
diff --git a/fs/f2fs/segment.c b/fs/f2fs/segment.c index e82423fbcb9d..7caac5f2ca9e 100644 --- a/fs/f2fs/segment.c +++ b/fs/f2fs/segment.c | |||
@@ -1585,7 +1585,7 @@ static int build_curseg(struct f2fs_sb_info *sbi) | |||
1585 | 1585 | ||
1586 | static int ra_sit_pages(struct f2fs_sb_info *sbi, int start, int nrpages) | 1586 | static int ra_sit_pages(struct f2fs_sb_info *sbi, int start, int nrpages) |
1587 | { | 1587 | { |
1588 | struct address_space *mapping = sbi->meta_inode->i_mapping; | 1588 | struct address_space *mapping = META_MAPPING(sbi); |
1589 | struct page *page; | 1589 | struct page *page; |
1590 | block_t blk_addr, prev_blk_addr = 0; | 1590 | block_t blk_addr, prev_blk_addr = 0; |
1591 | int sit_blk_cnt = SIT_BLK_CNT(sbi); | 1591 | int sit_blk_cnt = SIT_BLK_CNT(sbi); |