aboutsummaryrefslogtreecommitdiffstats
path: root/fs/f2fs/checkpoint.c
diff options
context:
space:
mode:
authorJaegeuk Kim <jaegeuk@kernel.org>2014-09-02 18:31:18 -0400
committerJaegeuk Kim <jaegeuk@kernel.org>2014-09-03 20:37:13 -0400
commit4081363fbe84a7ebac6d3339dd2775df45d856d0 (patch)
tree1484b33d753ff03255077b77c3d8f1c45c67e6af /fs/f2fs/checkpoint.c
parent70c8038dd698b44daf7c8fc7e2eca142bec694c4 (diff)
f2fs: introduce F2FS_I_SB, F2FS_M_SB, and F2FS_P_SB
This patch adds three inline functions to clean up dirty casting codes. Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
Diffstat (limited to 'fs/f2fs/checkpoint.c')
-rw-r--r--fs/f2fs/checkpoint.c18
1 files changed, 7 insertions, 11 deletions
diff --git a/fs/f2fs/checkpoint.c b/fs/f2fs/checkpoint.c
index ec3b7a5381fa..cb5cb4ca1814 100644
--- a/fs/f2fs/checkpoint.c
+++ b/fs/f2fs/checkpoint.c
@@ -151,8 +151,7 @@ out:
151static int f2fs_write_meta_page(struct page *page, 151static int f2fs_write_meta_page(struct page *page,
152 struct writeback_control *wbc) 152 struct writeback_control *wbc)
153{ 153{
154 struct inode *inode = page->mapping->host; 154 struct f2fs_sb_info *sbi = F2FS_P_SB(page);
155 struct f2fs_sb_info *sbi = F2FS_SB(inode->i_sb);
156 155
157 trace_f2fs_writepage(page, META); 156 trace_f2fs_writepage(page, META);
158 157
@@ -177,7 +176,7 @@ redirty_out:
177static int f2fs_write_meta_pages(struct address_space *mapping, 176static int f2fs_write_meta_pages(struct address_space *mapping,
178 struct writeback_control *wbc) 177 struct writeback_control *wbc)
179{ 178{
180 struct f2fs_sb_info *sbi = F2FS_SB(mapping->host->i_sb); 179 struct f2fs_sb_info *sbi = F2FS_M_SB(mapping);
181 long diff, written; 180 long diff, written;
182 181
183 trace_f2fs_writepages(mapping->host, wbc, META); 182 trace_f2fs_writepages(mapping->host, wbc, META);
@@ -259,15 +258,12 @@ continue_unlock:
259 258
260static int f2fs_set_meta_page_dirty(struct page *page) 259static int f2fs_set_meta_page_dirty(struct page *page)
261{ 260{
262 struct address_space *mapping = page->mapping;
263 struct f2fs_sb_info *sbi = F2FS_SB(mapping->host->i_sb);
264
265 trace_f2fs_set_page_dirty(page, META); 261 trace_f2fs_set_page_dirty(page, META);
266 262
267 SetPageUptodate(page); 263 SetPageUptodate(page);
268 if (!PageDirty(page)) { 264 if (!PageDirty(page)) {
269 __set_page_dirty_nobuffers(page); 265 __set_page_dirty_nobuffers(page);
270 inc_page_count(sbi, F2FS_DIRTY_META); 266 inc_page_count(F2FS_P_SB(page), F2FS_DIRTY_META);
271 return 1; 267 return 1;
272 } 268 }
273 return 0; 269 return 0;
@@ -619,7 +615,7 @@ fail_no_cp:
619 615
620static int __add_dirty_inode(struct inode *inode, struct dir_inode_entry *new) 616static int __add_dirty_inode(struct inode *inode, struct dir_inode_entry *new)
621{ 617{
622 struct f2fs_sb_info *sbi = F2FS_SB(inode->i_sb); 618 struct f2fs_sb_info *sbi = F2FS_I_SB(inode);
623 619
624 if (is_inode_flag_set(F2FS_I(inode), FI_DIRTY_DIR)) 620 if (is_inode_flag_set(F2FS_I(inode), FI_DIRTY_DIR))
625 return -EEXIST; 621 return -EEXIST;
@@ -633,7 +629,7 @@ static int __add_dirty_inode(struct inode *inode, struct dir_inode_entry *new)
633 629
634void set_dirty_dir_page(struct inode *inode, struct page *page) 630void set_dirty_dir_page(struct inode *inode, struct page *page)
635{ 631{
636 struct f2fs_sb_info *sbi = F2FS_SB(inode->i_sb); 632 struct f2fs_sb_info *sbi = F2FS_I_SB(inode);
637 struct dir_inode_entry *new; 633 struct dir_inode_entry *new;
638 int ret = 0; 634 int ret = 0;
639 635
@@ -656,7 +652,7 @@ void set_dirty_dir_page(struct inode *inode, struct page *page)
656 652
657void add_dirty_dir_inode(struct inode *inode) 653void add_dirty_dir_inode(struct inode *inode)
658{ 654{
659 struct f2fs_sb_info *sbi = F2FS_SB(inode->i_sb); 655 struct f2fs_sb_info *sbi = F2FS_I_SB(inode);
660 struct dir_inode_entry *new = 656 struct dir_inode_entry *new =
661 f2fs_kmem_cache_alloc(inode_entry_slab, GFP_NOFS); 657 f2fs_kmem_cache_alloc(inode_entry_slab, GFP_NOFS);
662 int ret = 0; 658 int ret = 0;
@@ -674,7 +670,7 @@ void add_dirty_dir_inode(struct inode *inode)
674 670
675void remove_dirty_dir_inode(struct inode *inode) 671void remove_dirty_dir_inode(struct inode *inode)
676{ 672{
677 struct f2fs_sb_info *sbi = F2FS_SB(inode->i_sb); 673 struct f2fs_sb_info *sbi = F2FS_I_SB(inode);
678 struct dir_inode_entry *entry; 674 struct dir_inode_entry *entry;
679 675
680 if (!S_ISDIR(inode->i_mode)) 676 if (!S_ISDIR(inode->i_mode))