linux-f2fs-devel.lists.sourceforge.net archive mirror
 help / color / mirror / Atom feed
From: Chao Yu <yuchao0@huawei.com>
To: <jaegeuk@kernel.org>
Cc: linux-f2fs-devel@lists.sourceforge.net
Subject: [f2fs-dev] [PATCH 04/10] fsck.f2fs: introduce current_sit_addr() for cleanup
Date: Fri, 9 Aug 2019 18:52:56 +0800	[thread overview]
Message-ID: <20190809105302.79876-4-yuchao0@huawei.com> (raw)
In-Reply-To: <20190809105302.79876-1-yuchao0@huawei.com>

Just clean up, no logic change.

Signed-off-by: Chao Yu <yuchao0@huawei.com>
---
 fsck/mount.c | 28 +++++++++++++---------------
 1 file changed, 13 insertions(+), 15 deletions(-)

diff --git a/fsck/mount.c b/fsck/mount.c
index bed22d5..eed27bf 100644
--- a/fsck/mount.c
+++ b/fsck/mount.c
@@ -1700,13 +1700,12 @@ static inline void check_seg_range(struct f2fs_sb_info *sbi, unsigned int segno)
 	ASSERT(segno <= end_segno);
 }
 
-void get_current_sit_page(struct f2fs_sb_info *sbi,
-			unsigned int segno, struct f2fs_sit_block *sit_blk)
+static inline block_t current_sit_addr(struct f2fs_sb_info *sbi,
+						unsigned int segno)
 {
 	struct sit_info *sit_i = SIT_I(sbi);
 	unsigned int offset = SIT_BLOCK_OFFSET(sit_i, segno);
 	block_t blk_addr = sit_i->sit_base_addr + offset;
-	int ret;
 
 	check_seg_range(sbi, segno);
 
@@ -1714,24 +1713,23 @@ void get_current_sit_page(struct f2fs_sb_info *sbi,
 	if (f2fs_test_bit(offset, sit_i->sit_bitmap))
 		blk_addr += sit_i->sit_blocks;
 
-	ret = dev_read_block(sit_blk, blk_addr);
-	ASSERT(ret >= 0);
+	return blk_addr;
 }
 
-void rewrite_current_sit_page(struct f2fs_sb_info *sbi,
+void get_current_sit_page(struct f2fs_sb_info *sbi,
 			unsigned int segno, struct f2fs_sit_block *sit_blk)
 {
-	struct sit_info *sit_i = SIT_I(sbi);
-	unsigned int offset = SIT_BLOCK_OFFSET(sit_i, segno);
-	block_t blk_addr = sit_i->sit_base_addr + offset;
-	int ret;
+	block_t blk_addr = current_sit_addr(sbi, segno);
 
-	/* calculate sit block address */
-	if (f2fs_test_bit(offset, sit_i->sit_bitmap))
-		blk_addr += sit_i->sit_blocks;
+	ASSERT(dev_read_block(sit_blk, blk_addr) >= 0);
+}
 
-	ret = dev_write_block(sit_blk, blk_addr);
-	ASSERT(ret >= 0);
+void rewrite_current_sit_page(struct f2fs_sb_info *sbi,
+			unsigned int segno, struct f2fs_sit_block *sit_blk)
+{
+	block_t blk_addr = current_sit_addr(sbi, segno);
+
+	ASSERT(dev_write_block(sit_blk, blk_addr) >= 0);
 }
 
 void check_block_count(struct f2fs_sb_info *sbi,
-- 
2.18.0.rc1



_______________________________________________
Linux-f2fs-devel mailing list
Linux-f2fs-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel

  parent reply	other threads:[~2019-08-09 10:53 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-08-09 10:52 [f2fs-dev] [PATCH 01/10] f2fs-tools: fix potential deadloop Chao Yu
2019-08-09 10:52 ` [f2fs-dev] [PATCH 02/10] f2fs-tools: fix to avoid memory leak of sit_i->sentries Chao Yu
2019-08-09 10:52 ` [f2fs-dev] [PATCH 03/10] f2fs-tools: allocate memory in batch in build_sit_info() Chao Yu
2019-08-09 10:52 ` Chao Yu [this message]
2019-08-09 10:52 ` [f2fs-dev] [PATCH 05/10] f2fs-tools: introduce f2fs_ra_meta_pages() Chao Yu
2019-08-09 10:52 ` [f2fs-dev] [PATCH 06/10] dump.f2fs: introduce start_bidx_of_node() for cleanup Chao Yu
2019-08-09 10:52 ` [f2fs-dev] [PATCH 07/10] fsck.f2fs: fix to set large section type during allocation Chao Yu
2019-08-09 10:53 ` [f2fs-dev] [PATCH 08/10] f2fs-tools: advise to mount unclean image to replay journal Chao Yu
2019-08-09 10:53 ` [f2fs-dev] [PATCH 09/10] fsck.f2fs: fix to propagate error of write_dquots() Chao Yu
2019-08-09 10:53 ` [f2fs-dev] [PATCH 10/10] f2fs-tools: add missing newline symbol in log 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=20190809105302.79876-4-yuchao0@huawei.com \
    --to=yuchao0@huawei.com \
    --cc=jaegeuk@kernel.org \
    --cc=linux-f2fs-devel@lists.sourceforge.net \
    /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).