From: Chao Yu <yuchao0@huawei.com>
To: Yunlei He <heyunlei@huawei.com>,
linux-f2fs-devel@lists.sourceforge.net, jaegeuk@kernel.org
Cc: heyunlei@huwei.com
Subject: Re: [PATCH 1/2 v2] f2fs: fix a missing discard prefree segments
Date: Wed, 21 Dec 2016 10:27:05 +0800 [thread overview]
Message-ID: <12c2b816-2bb5-d2c3-ee27-f81b95b25db2@huawei.com> (raw)
In-Reply-To: <97a3d89d-1e79-7c44-6500-bc4fc25a5590@huawei.com>
On 2016/12/21 10:02, Chao Yu wrote:
> Hi Jaegeuk, Yunlei,
>
> On 2016/12/20 11:11, Yunlei He wrote:
>> If userspace issue a fstrim with a range not involve prefree segments,
>> it will reuse these segments without discard. This patch fix it.
>
>>From v1 patch, I guess originally Yunlei wants to skip clearing prefree segments
> which is not be included in fstrim range, now v2 patch doesn't follow the
> original intention.
>
> So I guess below modification is enough:
>
> - if (force || !test_opt(sbi, DISCARD))
> + if (!test_opt(sbi, DISCARD))
>
> Only we should consider is whether we would send redundant discards though
> fstrim when small discard is on.
Oh, below condition has handling redundant case, sorry for my wrong understanding.
if (force && start * sbi->blocks_per_seg >= cpc->trim_start &&
end * sbi->blocks_per_seg <= cpc->trim_end)
continue;
But should fix end boundary judegment as below:
(end - 1) * sbi->blocks_per_seg <= cpc->trim_end
Thanks,
>
> Thoughts?
>
>>
>> Signed-off-by: Yunlei He <heyunlei@huawei.com>
>> ---
>> fs/f2fs/segment.c | 6 +++++-
>> 1 file changed, 5 insertions(+), 1 deletion(-)
>>
>> diff --git a/fs/f2fs/segment.c b/fs/f2fs/segment.c
>> index 0738f48..a40a34b 100644
>> --- a/fs/f2fs/segment.c
>> +++ b/fs/f2fs/segment.c
>> @@ -916,7 +916,11 @@ void clear_prefree_segments(struct f2fs_sb_info *sbi, struct cp_control *cpc)
>>
>> dirty_i->nr_dirty[PRE] -= end - start;
>>
>> - if (force || !test_opt(sbi, DISCARD))
>> + if (!test_opt(sbi, DISCARD))
>> + continue;
>> +
>> + if (force && start * sbi->blocks_per_seg >= cpc->trim_start &&
>> + end * sbi->blocks_per_seg <= cpc->trim_end)
>> continue;
>>
>> if (!test_opt(sbi, LFS) || sbi->segs_per_sec == 1) {
>>
------------------------------------------------------------------------------
Developer Access Program for Intel Xeon Phi Processors
Access to Intel Xeon Phi processor-based developer platforms.
With one year of Intel Parallel Studio XE.
Training and support from Colfax.
Order your platform today.http://sdm.link/intel
next prev parent reply other threads:[~2016-12-21 2:27 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-12-20 3:11 [PATCH 1/2 v2] f2fs: fix a missing discard prefree segments Yunlei He
2016-12-20 3:11 ` [PATCH 2/2 v2] f2fs: add a case of no need to read a page in write begin Yunlei He
2016-12-20 18:03 ` Jaegeuk Kim
2016-12-21 1:28 ` Chao Yu
2016-12-21 17:58 ` Jaegeuk Kim
2016-12-21 2:02 ` [PATCH 1/2 v2] f2fs: fix a missing discard prefree segments Chao Yu
2016-12-21 2:27 ` Chao Yu [this message]
2016-12-21 3:35 ` heyunlei
2016-12-21 3:55 ` Chao Yu
2016-12-21 9:00 ` heyunlei
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=12c2b816-2bb5-d2c3-ee27-f81b95b25db2@huawei.com \
--to=yuchao0@huawei.com \
--cc=heyunlei@huawei.com \
--cc=heyunlei@huwei.com \
--cc=jaegeuk@kernel.org \
--cc=linux-f2fs-devel@lists.sourceforge.net \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).