linux-fsdevel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jaegeuk Kim <jaegeuk@kernel.org>
To: linux-kernel@vger.kernel.org, linux-fsdevel@vger.kernel.org,
	linux-f2fs-devel@lists.sourceforge.net
Cc: Jaegeuk Kim <jaegeuk@kernel.org>
Subject: [PATCH 10/13] f2fs: introduce f2fs_cp_error for readability
Date: Tue, 12 Aug 2014 12:49:24 -0700	[thread overview]
Message-ID: <1407872967-26423-10-git-send-email-jaegeuk@kernel.org> (raw)
In-Reply-To: <1407872967-26423-1-git-send-email-jaegeuk@kernel.org>

This patch adds f2fs_cp_error for readability.

Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
---
 fs/f2fs/checkpoint.c | 4 ++--
 fs/f2fs/f2fs.h       | 5 +++++
 fs/f2fs/gc.c         | 2 +-
 fs/f2fs/super.c      | 2 +-
 4 files changed, 9 insertions(+), 4 deletions(-)

diff --git a/fs/f2fs/checkpoint.c b/fs/f2fs/checkpoint.c
index 7e1c13b..1161d2a 100644
--- a/fs/f2fs/checkpoint.c
+++ b/fs/f2fs/checkpoint.c
@@ -162,7 +162,7 @@ static int f2fs_write_meta_page(struct page *page,
 		goto redirty_out;
 
 	/* Should not write any meta pages, if any IO error was occurred */
-	if (unlikely(is_set_ckpt_flags(F2FS_CKPT(sbi), CP_ERROR_FLAG)))
+	if (unlikely(f2fs_cp_error(sbi)))
 		goto no_write;
 
 	f2fs_wait_on_page_writeback(page, META);
@@ -934,7 +934,7 @@ static void do_checkpoint(struct f2fs_sb_info *sbi, bool is_umount)
 	/* Here, we only have one bio having CP pack */
 	sync_meta_pages(sbi, META_FLUSH, LONG_MAX);
 
-	if (!is_set_ckpt_flags(ckpt, CP_ERROR_FLAG)) {
+	if (!f2fs_cp_error(sbi)) {
 		clear_prefree_segments(sbi);
 		release_dirty_inode(sbi);
 		F2FS_RESET_SB_DIRT(sbi);
diff --git a/fs/f2fs/f2fs.h b/fs/f2fs/f2fs.h
index cc5ead1..46ceb88 100644
--- a/fs/f2fs/f2fs.h
+++ b/fs/f2fs/f2fs.h
@@ -1096,6 +1096,11 @@ static inline int f2fs_readonly(struct super_block *sb)
 	return sb->s_flags & MS_RDONLY;
 }
 
+static inline bool f2fs_cp_error(struct f2fs_sb_info *sbi)
+{
+	return is_set_ckpt_flags(sbi->ckpt, CP_ERROR_FLAG);
+}
+
 static inline void f2fs_stop_checkpoint(struct f2fs_sb_info *sbi)
 {
 	set_ckpt_flags(sbi->ckpt, CP_ERROR_FLAG);
diff --git a/fs/f2fs/gc.c b/fs/f2fs/gc.c
index 87c50c5..e8507b1 100644
--- a/fs/f2fs/gc.c
+++ b/fs/f2fs/gc.c
@@ -693,7 +693,7 @@ int f2fs_gc(struct f2fs_sb_info *sbi)
 gc_more:
 	if (unlikely(!(sbi->sb->s_flags & MS_ACTIVE)))
 		goto stop;
-	if (unlikely(is_set_ckpt_flags(F2FS_CKPT(sbi), CP_ERROR_FLAG)))
+	if (unlikely(f2fs_cp_error(sbi)))
 		goto stop;
 
 	if (gc_type == BG_GC && has_not_enough_free_secs(sbi, nfree)) {
diff --git a/fs/f2fs/super.c b/fs/f2fs/super.c
index 2856020..7e4b631 100644
--- a/fs/f2fs/super.c
+++ b/fs/f2fs/super.c
@@ -812,7 +812,7 @@ static int sanity_check_ckpt(struct f2fs_sb_info *sbi)
 	if (unlikely(fsmeta >= total))
 		return 1;
 
-	if (unlikely(is_set_ckpt_flags(ckpt, CP_ERROR_FLAG))) {
+	if (unlikely(f2fs_cp_error(sbi))) {
 		f2fs_msg(sbi->sb, KERN_ERR, "A bug case: need to run fsck");
 		return 1;
 	}
-- 
1.8.5.2 (Apple Git-48)

  parent reply	other threads:[~2014-08-12 19:49 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-08-12 19:49 [PATCH 01/13] f2fs: should convert inline_data during the mkwrite Jaegeuk Kim
2014-08-12 19:49 ` [PATCH 02/13] f2fs: make clear on test condition and return types Jaegeuk Kim
2014-08-12 19:49 ` [PATCH 03/13] f2fs: fix the initial inode page for recovery Jaegeuk Kim
2014-08-13 10:17   ` Chao Yu
2014-08-12 19:49 ` [PATCH 04/13] f2fs: clear FI_INC_LINK during the recovery Jaegeuk Kim
2014-08-13 10:18   ` Chao Yu
2014-08-12 19:49 ` [PATCH 05/13] f2fs: should clear the inline_xattr flag Jaegeuk Kim
2014-08-13 10:19   ` [f2fs-dev] " Chao Yu
2014-08-12 19:49 ` [PATCH 06/13] f2fs: fix to recover inline_xattr/data and blocks Jaegeuk Kim
2014-08-13 10:20   ` Chao Yu
2014-08-12 19:49 ` [PATCH 07/13] f2fs: avoid bug_on when error is occurred Jaegeuk Kim
2014-08-12 19:49 ` [PATCH 08/13] f2fs: do checkpoint at f2fs_put_super Jaegeuk Kim
2014-08-14  2:57   ` [f2fs-dev] " Chao Yu
2014-08-15 21:54     ` Jaegeuk Kim
2014-08-15 21:58   ` [PATCH 08/13 v2] " Jaegeuk Kim
2014-08-19  6:41     ` Chao Yu
2014-08-19 16:11       ` Jaegeuk Kim
2014-08-12 19:49 ` [PATCH 09/13] f2fs: give a chance to mount again when encountering errors Jaegeuk Kim
2014-08-12 19:49 ` Jaegeuk Kim [this message]
2014-08-12 19:49 ` [PATCH 11/13] f2fs: unlock_page when node page is redirtied out Jaegeuk Kim
2014-08-12 19:49 ` [PATCH 12/13] f2fs: check s_dirty under cp_mutex Jaegeuk Kim
2014-08-12 19:49 ` [PATCH 13/13] f2fs: handle EIO not to break fs consistency Jaegeuk Kim
2014-08-20 10:35   ` Chao Yu
2014-08-21 20:33     ` Jaegeuk Kim
2014-08-22  7:57       ` [f2fs-dev] " Chao Yu
2014-08-13  7:20 ` [f2fs-dev] [PATCH 01/13] f2fs: should convert inline_data during the mkwrite Chao Yu

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1407872967-26423-10-git-send-email-jaegeuk@kernel.org \
    --to=jaegeuk@kernel.org \
    --cc=linux-f2fs-devel@lists.sourceforge.net \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).