diff options
author | Chao Yu <chao2.yu@samsung.com> | 2014-07-06 23:21:59 -0400 |
---|---|---|
committer | Jaegeuk Kim <jaegeuk@kernel.org> | 2014-07-09 17:04:26 -0400 |
commit | 6b2920a513ec9972f7b80d219fcf6f59130a1f31 (patch) | |
tree | e782c3532674eba15e819c192d14207e94e1e4cb /fs/f2fs | |
parent | 3aab8f828ef358ae92545294a14cd52d510cc585 (diff) |
f2fs: use inner macro and function to clean up codes
In this patch we use below inner macro and function to clean up codes.
1. ADDRS_PER_PAGE
2. SM_I
3. f2fs_readonly
Signed-off-by: Chao Yu <chao2.yu@samsung.com>
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
Diffstat (limited to 'fs/f2fs')
-rw-r--r-- | fs/f2fs/file.c | 3 | ||||
-rw-r--r-- | fs/f2fs/segment.c | 9 | ||||
-rw-r--r-- | fs/f2fs/super.c | 7 |
3 files changed, 8 insertions, 11 deletions
diff --git a/fs/f2fs/file.c b/fs/f2fs/file.c index 36fa50587bb8..7c652b3e1511 100644 --- a/fs/f2fs/file.c +++ b/fs/f2fs/file.c | |||
@@ -272,8 +272,7 @@ static loff_t f2fs_seek_block(struct file *file, loff_t offset, int whence) | |||
272 | } | 272 | } |
273 | } | 273 | } |
274 | 274 | ||
275 | end_offset = IS_INODE(dn.node_page) ? | 275 | end_offset = ADDRS_PER_PAGE(dn.node_page, F2FS_I(inode)); |
276 | ADDRS_PER_INODE(F2FS_I(inode)) : ADDRS_PER_BLOCK; | ||
277 | 276 | ||
278 | /* find data/hole in dnode block */ | 277 | /* find data/hole in dnode block */ |
279 | for (; dn.ofs_in_node < end_offset; | 278 | for (; dn.ofs_in_node < end_offset; |
diff --git a/fs/f2fs/segment.c b/fs/f2fs/segment.c index a4f8375f6ae6..8a6e57d83c79 100644 --- a/fs/f2fs/segment.c +++ b/fs/f2fs/segment.c | |||
@@ -272,13 +272,13 @@ int create_flush_cmd_control(struct f2fs_sb_info *sbi) | |||
272 | return -ENOMEM; | 272 | return -ENOMEM; |
273 | spin_lock_init(&fcc->issue_lock); | 273 | spin_lock_init(&fcc->issue_lock); |
274 | init_waitqueue_head(&fcc->flush_wait_queue); | 274 | init_waitqueue_head(&fcc->flush_wait_queue); |
275 | sbi->sm_info->cmd_control_info = fcc; | 275 | SM_I(sbi)->cmd_control_info = fcc; |
276 | fcc->f2fs_issue_flush = kthread_run(issue_flush_thread, sbi, | 276 | fcc->f2fs_issue_flush = kthread_run(issue_flush_thread, sbi, |
277 | "f2fs_flush-%u:%u", MAJOR(dev), MINOR(dev)); | 277 | "f2fs_flush-%u:%u", MAJOR(dev), MINOR(dev)); |
278 | if (IS_ERR(fcc->f2fs_issue_flush)) { | 278 | if (IS_ERR(fcc->f2fs_issue_flush)) { |
279 | err = PTR_ERR(fcc->f2fs_issue_flush); | 279 | err = PTR_ERR(fcc->f2fs_issue_flush); |
280 | kfree(fcc); | 280 | kfree(fcc); |
281 | sbi->sm_info->cmd_control_info = NULL; | 281 | SM_I(sbi)->cmd_control_info = NULL; |
282 | return err; | 282 | return err; |
283 | } | 283 | } |
284 | 284 | ||
@@ -287,13 +287,12 @@ int create_flush_cmd_control(struct f2fs_sb_info *sbi) | |||
287 | 287 | ||
288 | void destroy_flush_cmd_control(struct f2fs_sb_info *sbi) | 288 | void destroy_flush_cmd_control(struct f2fs_sb_info *sbi) |
289 | { | 289 | { |
290 | struct flush_cmd_control *fcc = | 290 | struct flush_cmd_control *fcc = SM_I(sbi)->cmd_control_info; |
291 | sbi->sm_info->cmd_control_info; | ||
292 | 291 | ||
293 | if (fcc && fcc->f2fs_issue_flush) | 292 | if (fcc && fcc->f2fs_issue_flush) |
294 | kthread_stop(fcc->f2fs_issue_flush); | 293 | kthread_stop(fcc->f2fs_issue_flush); |
295 | kfree(fcc); | 294 | kfree(fcc); |
296 | sbi->sm_info->cmd_control_info = NULL; | 295 | SM_I(sbi)->cmd_control_info = NULL; |
297 | } | 296 | } |
298 | 297 | ||
299 | static void __locate_dirty_segment(struct f2fs_sb_info *sbi, unsigned int segno, | 298 | static void __locate_dirty_segment(struct f2fs_sb_info *sbi, unsigned int segno, |
diff --git a/fs/f2fs/super.c b/fs/f2fs/super.c index 8f96d9372ade..870fe199bafb 100644 --- a/fs/f2fs/super.c +++ b/fs/f2fs/super.c | |||
@@ -615,7 +615,7 @@ static int f2fs_remount(struct super_block *sb, int *flags, char *data) | |||
615 | * Previous and new state of filesystem is RO, | 615 | * Previous and new state of filesystem is RO, |
616 | * so skip checking GC and FLUSH_MERGE conditions. | 616 | * so skip checking GC and FLUSH_MERGE conditions. |
617 | */ | 617 | */ |
618 | if ((sb->s_flags & MS_RDONLY) && (*flags & MS_RDONLY)) | 618 | if (f2fs_readonly(sb) && (*flags & MS_RDONLY)) |
619 | goto skip; | 619 | goto skip; |
620 | 620 | ||
621 | /* | 621 | /* |
@@ -642,8 +642,7 @@ static int f2fs_remount(struct super_block *sb, int *flags, char *data) | |||
642 | */ | 642 | */ |
643 | if ((*flags & MS_RDONLY) || !test_opt(sbi, FLUSH_MERGE)) { | 643 | if ((*flags & MS_RDONLY) || !test_opt(sbi, FLUSH_MERGE)) { |
644 | destroy_flush_cmd_control(sbi); | 644 | destroy_flush_cmd_control(sbi); |
645 | } else if (test_opt(sbi, FLUSH_MERGE) && | 645 | } else if (test_opt(sbi, FLUSH_MERGE) && !SM_I(sbi)->cmd_control_info) { |
646 | !sbi->sm_info->cmd_control_info) { | ||
647 | err = create_flush_cmd_control(sbi); | 646 | err = create_flush_cmd_control(sbi); |
648 | if (err) | 647 | if (err) |
649 | goto restore_gc; | 648 | goto restore_gc; |
@@ -1082,7 +1081,7 @@ static int f2fs_fill_super(struct super_block *sb, void *data, int silent) | |||
1082 | * If filesystem is not mounted as read-only then | 1081 | * If filesystem is not mounted as read-only then |
1083 | * do start the gc_thread. | 1082 | * do start the gc_thread. |
1084 | */ | 1083 | */ |
1085 | if (!(sb->s_flags & MS_RDONLY)) { | 1084 | if (!f2fs_readonly(sb)) { |
1086 | /* After POR, we can run background GC thread.*/ | 1085 | /* After POR, we can run background GC thread.*/ |
1087 | err = start_gc_thread(sbi); | 1086 | err = start_gc_thread(sbi); |
1088 | if (err) | 1087 | if (err) |