Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1550366
| From | Chao Yu <yuchao0@huawei.com> |
|---|---|
| Newsgroups | linux.kernel |
| Subject | Re: [PATCH] f2fs: fix small discards when se->valid_blocks is zero |
| Date | 2017-01-04 03:00 +0100 |
| Message-ID | <sVJ1T-6fS-1@gated-at.bofh.it> (permalink) |
| References | <sVt6O-3AE-9@gated-at.bofh.it> |
| Organization | linux.* mail to news gateway |
On 2017/1/3 17:01, Yunlong Song wrote:
> In the small discard case, when se->valid_blocks is zero, the add_discard_addrs
> will directly return without __add_discard_entry. This will cause the file
> delete have no small discard. The case is like this:
>
> 1. Allocate free 2M segment
> 2. Write a file (size n blocks < 512) in that 2M segment, se->valid_blocks = n
> 3. Delete that file, se->valid_blocks = 0, add_discard_addrs will return without
> sending any discard of that file, and forever due to cur_map[i] ^ ckpt_map[i] =
> 0 after that checkpoint
Wouldn't it be discarded as prefree segment?
Thanks,
>
> Signed-off-by: Yunlong Song <yunlong.song@huawei.com>
> ---
> fs/f2fs/segment.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/fs/f2fs/segment.c b/fs/f2fs/segment.c
> index 0738f48..8610f14 100644
> --- a/fs/f2fs/segment.c
> +++ b/fs/f2fs/segment.c
> @@ -838,7 +838,7 @@ static void add_discard_addrs(struct f2fs_sb_info *sbi, struct cp_control *cpc)
> return;
>
> if (!force) {
> - if (!test_opt(sbi, DISCARD) || !se->valid_blocks ||
> + if (!test_opt(sbi, DISCARD) ||
> SM_I(sbi)->nr_discards >= SM_I(sbi)->max_discards)
> return;
> }
>
Back to linux.kernel | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
[PATCH] f2fs: fix small discards when se->valid_blocks is zero Yunlong Song <yunlong.song@huawei.com> - 2017-01-03 10:00 +0100
Re: [PATCH] f2fs: fix small discards when se->valid_blocks is zero Chao Yu <yuchao0@huawei.com> - 2017-01-04 03:00 +0100
Re: [PATCH] f2fs: fix small discards when se->valid_blocks is zero Jaegeuk Kim <jaegeuk@kernel.org> - 2017-01-04 03:10 +0100
Re: [PATCH] f2fs: fix small discards when se->valid_blocks is zero Yunlong Song <yunlong.song@huawei.com> - 2017-01-04 05:10 +0100
Re: [PATCH] f2fs: fix small discards when se->valid_blocks is zero Jaegeuk Kim <jaegeuk@kernel.org> - 2017-01-04 23:40 +0100
Re: [PATCH] f2fs: fix small discards when se->valid_blocks is zero Yunlong Song <yunlong.song@huawei.com> - 2017-01-05 03:50 +0100
csiph-web