public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] f2fs: fix recover orphan inodes
@ 2015-02-25  4:53 Wanpeng Li
  2015-02-25 18:35 ` Jaegeuk Kim
  0 siblings, 1 reply; 3+ messages in thread
From: Wanpeng Li @ 2015-02-25  4:53 UTC (permalink / raw)
  To: Jaegeuk Kim; +Cc: Changman Lee, linux-f2fs-devel, linux-kernel, Wanpeng Li

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.

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

diff --git a/fs/f2fs/checkpoint.c b/fs/f2fs/checkpoint.c
index e6c271f..0f42ff3 100644
--- a/fs/f2fs/checkpoint.c
+++ b/fs/f2fs/checkpoint.c
@@ -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;
 
-- 
1.9.1


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] f2fs: fix recover orphan inodes
  2015-02-25  4:53 [PATCH] f2fs: fix recover orphan inodes Wanpeng Li
@ 2015-02-25 18:35 ` Jaegeuk Kim
  2015-02-25 23:04   ` Wanpeng Li
  0 siblings, 1 reply; 3+ messages in thread
From: Jaegeuk Kim @ 2015-02-25 18:35 UTC (permalink / raw)
  To: Wanpeng Li; +Cc: Changman Lee, linux-f2fs-devel, linux-kernel

Hi Wanpeng,

On Wed, Feb 25, 2015 at 12:53:37PM +0800, Wanpeng Li wrote:
> 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.
> 
> Signed-off-by: Wanpeng Li <wanpeng.li@linux.intel.com>
> ---
>  fs/f2fs/checkpoint.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/fs/f2fs/checkpoint.c b/fs/f2fs/checkpoint.c
> index e6c271f..0f42ff3 100644
> --- a/fs/f2fs/checkpoint.c
> +++ b/fs/f2fs/checkpoint.c
> @@ -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.

>  	orphan_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.

>  
> -	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.

>  
> -	for (i = 0; i < orphan_blkaddr; i++) {
> +	for (i = 0; i < orphan_blkaddr - start_blk; i++) {

ditto.

Thanks,

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] f2fs: fix recover orphan inodes
  2015-02-25 18:35 ` Jaegeuk Kim
@ 2015-02-25 23:04   ` Wanpeng Li
  0 siblings, 0 replies; 3+ messages in thread
From: Wanpeng Li @ 2015-02-25 23:04 UTC (permalink / raw)
  To: Jaegeuk Kim; +Cc: Changman Lee, linux-f2fs-devel, linux-kernel, Wanpeng Li

Hi Jaegeuk,
On Wed, Feb 25, 2015 at 10:35:23AM -0800, Jaegeuk Kim wrote:
>Hi Wanpeng,
>
>On Wed, Feb 25, 2015 at 12:53:37PM +0800, Wanpeng Li wrote:
>> 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.
>> 
>> Signed-off-by: Wanpeng Li <wanpeng.li@linux.intel.com>
>> ---
>>  fs/f2fs/checkpoint.c | 4 ++--
>>  1 file changed, 2 insertions(+), 2 deletions(-)
>> 
>> diff --git a/fs/f2fs/checkpoint.c b/fs/f2fs/checkpoint.c
>> index e6c271f..0f42ff3 100644
>> --- a/fs/f2fs/checkpoint.c
>> +++ b/fs/f2fs/checkpoint.c
>> @@ -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.
>
>>  	orphan_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.

>
>It may help to define a macro to get cp_payload.
>

Will do. Thanks for your help. ;-)

Regards,
Wanpeng Li 

>>  
>> -	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.
>
>>  
>> -	for (i = 0; i < orphan_blkaddr; i++) {
>> +	for (i = 0; i < orphan_blkaddr - start_blk; i++) {
>
>ditto.
>
>Thanks,

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2015-02-25 23:22 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-02-25  4:53 [PATCH] f2fs: fix recover orphan inodes Wanpeng Li
2015-02-25 18:35 ` Jaegeuk Kim
2015-02-25 23:04   ` Wanpeng Li

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox