From: Jaegeuk Kim <jaegeuk@kernel.org>
To: Chao Yu <chao@kernel.org>
Cc: linux-kernel@vger.kernel.org, linux-f2fs-devel@lists.sourceforge.net
Subject: Re: [f2fs-dev] [PATCH v2] f2fs: fix to avoid touching checkpointed data in get_victim()
Date: Mon, 12 Apr 2021 19:59:32 -0700 [thread overview]
Message-ID: <YHUJFElliMOWMbWN@google.com> (raw)
In-Reply-To: <66e0a225-7f52-a33e-ccd6-e7bfa1067ed1@kernel.org>
On 04/11, Chao Yu wrote:
> Hi Jaegeuk,
>
> Could you please help to merge below cleanup diff into original patch?
> or merge this separately if it is too late since it is near rc7.
I didn't review this tho, this gives an error in xfstests/083.
>
> From 5a342a8f332a1b3281ec0e2b4d41b5287689c8ed Mon Sep 17 00:00:00 2001
> From: Chao Yu <yuchao0@huawei.com>
> Date: Sun, 11 Apr 2021 14:29:34 +0800
> Subject: [PATCH] f2fs: avoid duplicated codes for cleanup
>
> f2fs_segment_has_free_slot() was copied from __next_free_blkoff(),
> the main implementation of them is almost the same, clean up them to
> reuse common code as much as possible.
>
> Signed-off-by: Chao Yu <yuchao0@huawei.com>
> ---
> fs/f2fs/segment.c | 32 ++++++++++----------------------
> 1 file changed, 10 insertions(+), 22 deletions(-)
>
> diff --git a/fs/f2fs/segment.c b/fs/f2fs/segment.c
> index b33273aa5c22..bd9056165d62 100644
> --- a/fs/f2fs/segment.c
> +++ b/fs/f2fs/segment.c
> @@ -2627,22 +2627,20 @@ static void new_curseg(struct f2fs_sb_info *sbi, int type, bool new_sec)
> curseg->alloc_type = LFS;
> }
>
> -static void __next_free_blkoff(struct f2fs_sb_info *sbi,
> - struct curseg_info *seg, block_t start)
> +static int __next_free_blkoff(struct f2fs_sb_info *sbi,
> + int segno, block_t start)
> {
> - struct seg_entry *se = get_seg_entry(sbi, seg->segno);
> + struct seg_entry *se = get_seg_entry(sbi, segno);
> int entries = SIT_VBLOCK_MAP_SIZE / sizeof(unsigned long);
> unsigned long *target_map = SIT_I(sbi)->tmp_map;
> unsigned long *ckpt_map = (unsigned long *)se->ckpt_valid_map;
> unsigned long *cur_map = (unsigned long *)se->cur_valid_map;
> - int i, pos;
> + int i;
>
> for (i = 0; i < entries; i++)
> target_map[i] = ckpt_map[i] | cur_map[i];
>
> - pos = __find_rev_next_zero_bit(target_map, sbi->blocks_per_seg, start);
> -
> - seg->next_blkoff = pos;
> + return __find_rev_next_zero_bit(target_map, sbi->blocks_per_seg, start);
> }
>
> /*
> @@ -2654,26 +2652,16 @@ static void __refresh_next_blkoff(struct f2fs_sb_info *sbi,
> struct curseg_info *seg)
> {
> if (seg->alloc_type == SSR)
> - __next_free_blkoff(sbi, seg, seg->next_blkoff + 1);
> + seg->next_blkoff =
> + __next_free_blkoff(sbi, seg->segno,
> + seg->next_blkoff + 1);
> else
> seg->next_blkoff++;
> }
>
> bool f2fs_segment_has_free_slot(struct f2fs_sb_info *sbi, int segno)
> {
> - struct seg_entry *se = get_seg_entry(sbi, segno);
> - int entries = SIT_VBLOCK_MAP_SIZE / sizeof(unsigned long);
> - unsigned long *target_map = SIT_I(sbi)->tmp_map;
> - unsigned long *ckpt_map = (unsigned long *)se->ckpt_valid_map;
> - unsigned long *cur_map = (unsigned long *)se->cur_valid_map;
> - int i, pos;
> -
> - for (i = 0; i < entries; i++)
> - target_map[i] = ckpt_map[i] | cur_map[i];
> -
> - pos = __find_rev_next_zero_bit(target_map, sbi->blocks_per_seg, 0);
> -
> - return pos < sbi->blocks_per_seg;
> + return __next_free_blkoff(sbi, segno, 0) < sbi->blocks_per_seg;
> }
>
> /*
> @@ -2701,7 +2689,7 @@ static void change_curseg(struct f2fs_sb_info *sbi, int type, bool flush)
>
> reset_curseg(sbi, type, 1);
> curseg->alloc_type = SSR;
> - __next_free_blkoff(sbi, curseg, 0);
> + __next_free_blkoff(sbi, curseg->segno, 0);
>
> sum_page = f2fs_get_sum_page(sbi, new_segno);
> if (IS_ERR(sum_page)) {
> --
> 2.22.1
_______________________________________________
Linux-f2fs-devel mailing list
Linux-f2fs-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel
WARNING: multiple messages have this Message-ID (diff)
From: Jaegeuk Kim <jaegeuk@kernel.org>
To: Chao Yu <chao@kernel.org>
Cc: linux-f2fs-devel@lists.sourceforge.net, linux-kernel@vger.kernel.org
Subject: Re: [PATCH v2] f2fs: fix to avoid touching checkpointed data in get_victim()
Date: Mon, 12 Apr 2021 19:59:32 -0700 [thread overview]
Message-ID: <YHUJFElliMOWMbWN@google.com> (raw)
In-Reply-To: <66e0a225-7f52-a33e-ccd6-e7bfa1067ed1@kernel.org>
On 04/11, Chao Yu wrote:
> Hi Jaegeuk,
>
> Could you please help to merge below cleanup diff into original patch?
> or merge this separately if it is too late since it is near rc7.
I didn't review this tho, this gives an error in xfstests/083.
>
> From 5a342a8f332a1b3281ec0e2b4d41b5287689c8ed Mon Sep 17 00:00:00 2001
> From: Chao Yu <yuchao0@huawei.com>
> Date: Sun, 11 Apr 2021 14:29:34 +0800
> Subject: [PATCH] f2fs: avoid duplicated codes for cleanup
>
> f2fs_segment_has_free_slot() was copied from __next_free_blkoff(),
> the main implementation of them is almost the same, clean up them to
> reuse common code as much as possible.
>
> Signed-off-by: Chao Yu <yuchao0@huawei.com>
> ---
> fs/f2fs/segment.c | 32 ++++++++++----------------------
> 1 file changed, 10 insertions(+), 22 deletions(-)
>
> diff --git a/fs/f2fs/segment.c b/fs/f2fs/segment.c
> index b33273aa5c22..bd9056165d62 100644
> --- a/fs/f2fs/segment.c
> +++ b/fs/f2fs/segment.c
> @@ -2627,22 +2627,20 @@ static void new_curseg(struct f2fs_sb_info *sbi, int type, bool new_sec)
> curseg->alloc_type = LFS;
> }
>
> -static void __next_free_blkoff(struct f2fs_sb_info *sbi,
> - struct curseg_info *seg, block_t start)
> +static int __next_free_blkoff(struct f2fs_sb_info *sbi,
> + int segno, block_t start)
> {
> - struct seg_entry *se = get_seg_entry(sbi, seg->segno);
> + struct seg_entry *se = get_seg_entry(sbi, segno);
> int entries = SIT_VBLOCK_MAP_SIZE / sizeof(unsigned long);
> unsigned long *target_map = SIT_I(sbi)->tmp_map;
> unsigned long *ckpt_map = (unsigned long *)se->ckpt_valid_map;
> unsigned long *cur_map = (unsigned long *)se->cur_valid_map;
> - int i, pos;
> + int i;
>
> for (i = 0; i < entries; i++)
> target_map[i] = ckpt_map[i] | cur_map[i];
>
> - pos = __find_rev_next_zero_bit(target_map, sbi->blocks_per_seg, start);
> -
> - seg->next_blkoff = pos;
> + return __find_rev_next_zero_bit(target_map, sbi->blocks_per_seg, start);
> }
>
> /*
> @@ -2654,26 +2652,16 @@ static void __refresh_next_blkoff(struct f2fs_sb_info *sbi,
> struct curseg_info *seg)
> {
> if (seg->alloc_type == SSR)
> - __next_free_blkoff(sbi, seg, seg->next_blkoff + 1);
> + seg->next_blkoff =
> + __next_free_blkoff(sbi, seg->segno,
> + seg->next_blkoff + 1);
> else
> seg->next_blkoff++;
> }
>
> bool f2fs_segment_has_free_slot(struct f2fs_sb_info *sbi, int segno)
> {
> - struct seg_entry *se = get_seg_entry(sbi, segno);
> - int entries = SIT_VBLOCK_MAP_SIZE / sizeof(unsigned long);
> - unsigned long *target_map = SIT_I(sbi)->tmp_map;
> - unsigned long *ckpt_map = (unsigned long *)se->ckpt_valid_map;
> - unsigned long *cur_map = (unsigned long *)se->cur_valid_map;
> - int i, pos;
> -
> - for (i = 0; i < entries; i++)
> - target_map[i] = ckpt_map[i] | cur_map[i];
> -
> - pos = __find_rev_next_zero_bit(target_map, sbi->blocks_per_seg, 0);
> -
> - return pos < sbi->blocks_per_seg;
> + return __next_free_blkoff(sbi, segno, 0) < sbi->blocks_per_seg;
> }
>
> /*
> @@ -2701,7 +2689,7 @@ static void change_curseg(struct f2fs_sb_info *sbi, int type, bool flush)
>
> reset_curseg(sbi, type, 1);
> curseg->alloc_type = SSR;
> - __next_free_blkoff(sbi, curseg, 0);
> + __next_free_blkoff(sbi, curseg->segno, 0);
>
> sum_page = f2fs_get_sum_page(sbi, new_segno);
> if (IS_ERR(sum_page)) {
> --
> 2.22.1
next prev parent reply other threads:[~2021-04-13 2:59 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-03-24 3:18 [f2fs-dev] [PATCH v2] f2fs: fix to avoid touching checkpointed data in get_victim() Chao Yu
2021-03-24 3:18 ` Chao Yu
2021-03-24 23:49 ` [f2fs-dev] " Jaegeuk Kim
2021-03-24 23:49 ` Jaegeuk Kim
2021-03-25 1:30 ` [f2fs-dev] " Chao Yu
2021-03-25 1:30 ` Chao Yu
2021-03-25 1:51 ` [f2fs-dev] " Jaegeuk Kim
2021-03-25 1:51 ` Jaegeuk Kim
2021-03-26 7:33 ` [f2fs-dev] " Chao Yu
2021-03-26 7:33 ` Chao Yu
2021-04-11 7:01 ` [f2fs-dev] " Chao Yu
2021-04-11 7:01 ` Chao Yu
2021-04-13 2:59 ` Jaegeuk Kim [this message]
2021-04-13 2:59 ` Jaegeuk Kim
2021-04-13 3:04 ` [f2fs-dev] " Chao Yu
2021-04-13 3:04 ` Chao Yu
2021-04-13 3:23 ` Chao Yu
2021-04-13 3:23 ` Chao Yu
2021-04-13 9:56 ` Chao Yu
2021-04-13 9:56 ` 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=YHUJFElliMOWMbWN@google.com \
--to=jaegeuk@kernel.org \
--cc=chao@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.