mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] f2fs: fix the size value in __check_sit_bitmap
@ 2017-08-04  9:07 Yunlong Song
  2017-08-05  5:40 ` Chao Yu
  0 siblings, 1 reply; 2+ messages in thread
From: Yunlong Song @ 2017-08-04  9:07 UTC (permalink / raw)
  To: jaegeuk, chao, yuchao0, yunlong.song, yunlong.song
  Cc: miaoxie, bintian.wang, linux-fsdevel, linux-f2fs-devel, linux-kernel

The current size value is not correct and will miss bitmap check.

Signed-off-by: Yunlong Song <yunlong.song@huawei.com>
---
 fs/f2fs/segment.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/fs/f2fs/segment.c b/fs/f2fs/segment.c
index f336f8c..45fb534 100644
--- a/fs/f2fs/segment.c
+++ b/fs/f2fs/segment.c
@@ -787,11 +787,14 @@ void __check_sit_bitmap(struct f2fs_sb_info *sbi,
 		sentry = get_seg_entry(sbi, segno);
 		offset = GET_BLKOFF_FROM_SEG0(sbi, blk);
 
-		size = min((unsigned long)(end - blk), max_blocks);
+		if (end < START_BLOCK(sbi, segno + 1))
+			size = GET_BLKOFF_FROM_SEG0(sbi, end);
+		else
+			size = max_blocks;
 		map = (unsigned long *)(sentry->cur_valid_map);
 		offset = __find_rev_next_bit(map, size, offset);
 		f2fs_bug_on(sbi, offset != size);
-		blk += size;
+		blk = START_BLOCK(sbi, segno + 1);
 	}
 #endif
 }
-- 
1.8.5.2

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

* Re: [PATCH] f2fs: fix the size value in __check_sit_bitmap
  2017-08-04  9:07 [PATCH] f2fs: fix the size value in __check_sit_bitmap Yunlong Song
@ 2017-08-05  5:40 ` Chao Yu
  0 siblings, 0 replies; 2+ messages in thread
From: Chao Yu @ 2017-08-05  5:40 UTC (permalink / raw)
  To: Yunlong Song, jaegeuk, yuchao0, yunlong.song
  Cc: miaoxie, bintian.wang, linux-fsdevel, linux-f2fs-devel,
	linux-kernel, chao

On 2017/8/4 17:07, Yunlong Song wrote:
> The current size value is not correct and will miss bitmap check.
> 
> Signed-off-by: Yunlong Song <yunlong.song@huawei.com>

Reviewed-by: Chao Yu <yuchao0@huawei.com>

> ---
>  fs/f2fs/segment.c | 7 +++++--
>  1 file changed, 5 insertions(+), 2 deletions(-)
> 
> diff --git a/fs/f2fs/segment.c b/fs/f2fs/segment.c
> index f336f8c..45fb534 100644
> --- a/fs/f2fs/segment.c
> +++ b/fs/f2fs/segment.c
> @@ -787,11 +787,14 @@ void __check_sit_bitmap(struct f2fs_sb_info *sbi,
>  		sentry = get_seg_entry(sbi, segno);
>  		offset = GET_BLKOFF_FROM_SEG0(sbi, blk);
>  
> -		size = min((unsigned long)(end - blk), max_blocks);
> +		if (end < START_BLOCK(sbi, segno + 1))
> +			size = GET_BLKOFF_FROM_SEG0(sbi, end);
> +		else
> +			size = max_blocks;
>  		map = (unsigned long *)(sentry->cur_valid_map);
>  		offset = __find_rev_next_bit(map, size, offset);
>  		f2fs_bug_on(sbi, offset != size);
> -		blk += size;
> +		blk = START_BLOCK(sbi, segno + 1);
>  	}
>  #endif
>  }
> 

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

end of thread, other threads:[~2017-08-05  5:41 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-08-04  9:07 [PATCH] f2fs: fix the size value in __check_sit_bitmap Yunlong Song
2017-08-05  5:40 ` Chao Yu

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

all inboxes | Powered by JetHome®