public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Wanpeng Li <wanpeng.li@linux.intel.com>
To: Jaegeuk Kim <jaegeuk@kernel.org>
Cc: Changman Lee <cm224.lee@samsung.com>,
	linux-f2fs-devel@lists.sourceforge.net,
	linux-kernel@vger.kernel.org,
	Wanpeng Li <wanpeng.li@linux.intel.com>
Subject: [PATCH 2/2] f2fs: fix the number of orphan inode blocks
Date: Thu, 26 Feb 2015 07:57:21 +0800	[thread overview]
Message-ID: <1424908641-76409-2-git-send-email-wanpeng.li@linux.intel.com> (raw)
In-Reply-To: <1424908641-76409-1-git-send-email-wanpeng.li@linux.intel.com>

cp_pack_start_sum is calculated in do_checkpoint and is equal to 
cpu_to_le32(1 + cp_payload_blks + orphan_blocks). The number of 
orphan inode blocks is take advantage of by recover_orphan_inodes 
to readahead meta pages and recovery inodes. However, current codes 
forget to reduce the number of cp payload blocks when calculate 
the number of orphan inode blocks. This patch fix it.

Signed-off-by: Wanpeng Li <wanpeng.li@linux.intel.com>
---
 fs/f2fs/checkpoint.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/fs/f2fs/checkpoint.c b/fs/f2fs/checkpoint.c
index 4dbcc81..db82e09 100644
--- a/fs/f2fs/checkpoint.c
+++ b/fs/f2fs/checkpoint.c
@@ -464,7 +464,7 @@ static void recover_orphan_inode(struct f2fs_sb_info *sbi, nid_t ino)
 
 void recover_orphan_inodes(struct f2fs_sb_info *sbi)
 {
-	block_t start_blk, orphan_blkaddr, i, j;
+	block_t start_blk, orphan_blocks, i, j;
 
 	if (!is_set_ckpt_flags(F2FS_CKPT(sbi), CP_ORPHAN_PRESENT_FLAG))
 		return;
@@ -472,11 +472,11 @@ void recover_orphan_inodes(struct f2fs_sb_info *sbi)
 	set_sbi_flag(sbi, SBI_POR_DOING);
 
 	start_blk = __start_cp_addr(sbi) + 1 + __cp_payload(sbi);
-	orphan_blkaddr = __start_sum_addr(sbi) - 1;
+	orphan_blocks = __start_sum_addr(sbi) - 1 - __cp_payload(sbi);
 
-	ra_meta_pages(sbi, start_blk, orphan_blkaddr, META_CP);
+	ra_meta_pages(sbi, start_blk, orphan_blocks, META_CP);
 
-	for (i = 0; i < orphan_blkaddr; i++) {
+	for (i = 0; i < orphan_blocks; i++) {
 		struct page *page = get_meta_page(sbi, start_blk + i);
 		struct f2fs_orphan_block *orphan_blk;
 
-- 
1.9.1


  reply	other threads:[~2015-02-25 23:57 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-02-25 23:57 [PATCH 1/2] f2fs: introduce macro __cp_payload Wanpeng Li
2015-02-25 23:57 ` Wanpeng Li [this message]
2015-02-26  1:33   ` [f2fs-dev] [PATCH 2/2] f2fs: fix the number of orphan inode blocks Chao Yu
2015-02-27  9:11     ` Wanpeng Li
2015-02-26  1:27 ` [f2fs-dev] [PATCH 1/2] f2fs: introduce macro __cp_payload 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=1424908641-76409-2-git-send-email-wanpeng.li@linux.intel.com \
    --to=wanpeng.li@linux.intel.com \
    --cc=cm224.lee@samsung.com \
    --cc=jaegeuk@kernel.org \
    --cc=linux-f2fs-devel@lists.sourceforge.net \
    --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