f2fs: fix recover orphan inodes
PATCH 1/1 f2fs: fix recover orphan inodes
recover_orphan_inodes is used to recover orphan inodes, the meta pages which readahead should be orphan_blkaddr - start_blk instead of orphan_blkaddr. This patch fix it.
--- fs/f2fs/checkpoint.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
fs/f2fs/checkpoint.c +2 -2
@@ -468,9 +468,9 @@ void recover_orphan_inodes(struct f2fs_sb_info *sbi)le32_to_cpu (F2FS_RAW_SUPER (sbi)->cp_payload); orphan_blkaddr =__start_sum_addr (sbi) -1 ; -ra_meta_pages (sbi, start_blk, orphan_blkaddr,META_CP ); +ra_meta_pages (sbi, start_blk, orphan_blkaddr - start_blk,META_CP ); -for (i =0 ; i < orphan_blkaddr; i++) { +for (i =0 ; i < orphan_blkaddr - start_blk; i++) {struct page *page =get_meta_page (sbi, start_blk + i);struct f2fs_orphan_block *orphan_blk;
Signature · 1 line
1.9.1
Jaegeuk Kim
maintainerHi Wanpeng,
Quoted 14 lines · Wanpeng Li
recover_orphan_inodesis used to recover orphan inodes, the meta pages which readahead should beorphan_blkaddr-start_blkinstead oforphan_blkaddr. This patch fix it.Signed-off-by Wanpeng Li <[email protected]>--- fs/f2fs/checkpoint.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)fs/f2fs/checkpoint.c +0
-0
fs/f2fs/checkpoint.c void recover_orphan_inodes(struct f2fs_sb_info *sbi) · line 468
Quoted 1 line
fs/f2fs/checkpoint.c +0
-0@@ -468,9 +468,9 @@ void recover_orphan_inodes(struct f2fs_sb_info *sbi)le32_to_cpu (F2FS_RAW_SUPER (sbi)->cp_payload);
Actually it seems the name, orphan_blkaddr, was wrong. That should be orphan_blocks which is no need to fix like this.
Instead, I found there is another bug below.
fs/f2fs/checkpoint.c void recover_orphan_inodes(struct f2fs_sb_info *sbi) · line 469
Quoted 1 line
fs/f2fs/checkpoint.c +0
-0orphan_blkaddr =__start_sum_addr (sbi) -1 ;
orphan_blocks = __start_sum_addr(sbi) - 1 - le32_to_cpu(F2FS_RAW_SUPER(sbi)->cp_payload);
It may help to define a macro to get cp_payload.
fs/f2fs/checkpoint.c void recover_orphan_inodes(struct f2fs_sb_info *sbi) · line 471
Quoted 3 lines
fs/f2fs/checkpoint.c +1
-1-ra_meta_pages (sbi, start_blk, orphan_blkaddr,META_CP ); +ra_meta_pages (sbi, start_blk, orphan_blkaddr - start_blk,META_CP );
The orphan_blocks is enough. No need to fix this.
fs/f2fs/checkpoint.c void recover_orphan_inodes(struct f2fs_sb_info *sbi) · line 473
Quoted 3 lines
fs/f2fs/checkpoint.c +1
-1-for (i =0 ; i < orphan_blkaddr; i++) { +for (i =0 ; i < orphan_blkaddr - start_blk; i++) {
ditto.
Thanks,
Hi Jaegeuk,
Quoted 22 lines · Jaegeuk Kim
Hi Wanpeng,
Quoted 14 lines · Wanpeng Li
recover_orphan_inodesis used to recover orphan inodes, the meta pages which readahead should beorphan_blkaddr-start_blkinstead oforphan_blkaddr. This patch fix it.Signed-off-by Wanpeng Li <[email protected]>--- fs/f2fs/checkpoint.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)fs/f2fs/checkpoint.c +0
-0fs/f2fs/checkpoint.c void recover_orphan_inodes(struct f2fs_sb_info *sbi) · line 468
Quoted 1 line
fs/f2fs/checkpoint.c +0
-0@@ -468,9 +468,9 @@ void recover_orphan_inodes(struct f2fs_sb_info *sbi)le32_to_cpu (F2FS_RAW_SUPER (sbi)->cp_payload);Actually it seems the name,
orphan_blkaddr, was wrong. That should beorphan_blockswhich is no need to fix like this.
Quoted 5 lines
Instead, I found there is another bug below.
fs/f2fs/checkpoint.c void recover_orphan_inodes(struct f2fs_sb_info *sbi) · line 469
Quoted 1 line
fs/f2fs/checkpoint.c +0
-0orphan_blkaddr =__start_sum_addr (sbi) -1 ;orphan_blocks = __start_sum_addr(sbi) - 1 - le32_to_cpu(F2FS_RAW_SUPER(sbi)->cp_payload);
Indeed, I will send a patch to fix it.
Quoted 3 lines
It may help to define a macro to get
cp_payload.
Will do. Thanks for your help. ;-)
Regards,
Wanpeng Li
Quoted 7 lines
fs/f2fs/checkpoint.c void recover_orphan_inodes(struct f2fs_sb_info *sbi) · line 471
Quoted 3 lines
fs/f2fs/checkpoint.c +1
-1-ra_meta_pages (sbi, start_blk, orphan_blkaddr,META_CP ); +ra_meta_pages (sbi, start_blk, orphan_blkaddr - start_blk,META_CP );The
orphan_blocksis enough. No need to fix this.Quoted 1 line
Quoted 6 lines
fs/f2fs/checkpoint.c void recover_orphan_inodes(struct f2fs_sb_info *sbi) · line 473
Quoted 2 lines
fs/f2fs/checkpoint.c +1
-1-for (i =0 ; i < orphan_blkaddr; i++) { +for (i =0 ; i < orphan_blkaddr - start_blk; i++) {ditto.
Thanks,
------------------------------------------------------------------------------
Dive into the World of Parallel Programming The Go Parallel Website, sponsored by Intel and developed in partnership with Slashdot Media, is your hub for all things parallel software development, from weekly thought leadership blogs to news, videos, case studies, tutorials and more. Take a look and join the conversation now. http://goparallel.sourceforge.net/