Message ID | 20170524050229.13213-1-damien.lemoal@wdc.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Hi Damien, On 2017/5/24 13:02, Damien Le Moal wrote: > clear_prefree_segments() issues small discards after discarding full > segments. These small discards may not be section aligned, so not zone > aligned when using a zoned block device, or more generally, when > mounted in LFS mode. So do not issue these small discards when mounted > in LFS mode. > > Signed-off-by: Damien Le Moal <damien.lemoal@wdc.com> > --- > fs/f2fs/segment.c | 3 ++- > 1 file changed, 2 insertions(+), 1 deletion(-) > > diff --git a/fs/f2fs/segment.c b/fs/f2fs/segment.c > index 9684585..3d190a7 100644 > --- a/fs/f2fs/segment.c > +++ b/fs/f2fs/segment.c > @@ -1322,7 +1322,8 @@ void clear_prefree_segments(struct f2fs_sb_info *sbi, struct cp_control *cpc) > sbi->blocks_per_seg, cur_pos); > len = next_pos - cur_pos; > > - if (force && len < cpc->trim_minlen) > + if (test_opt(sbi, LFS) || Could we just check f2fs_sb_mounted_blkzoned here instead of F2FS_MOUNT_LFS here ? so a non-blkzoned device can enables small discard when user mount the device with LFS option. Right? Thanks, > + (force && len < cpc->trim_minlen)) > goto skip; > > f2fs_issue_discard(sbi, entry->start_blkaddr + cur_pos, >
Chao, On 5/24/17 20:13, Chao Yu wrote: > Hi Damien, > > On 2017/5/24 13:02, Damien Le Moal wrote: >> clear_prefree_segments() issues small discards after discarding full >> segments. These small discards may not be section aligned, so not zone >> aligned when using a zoned block device, or more generally, when >> mounted in LFS mode. So do not issue these small discards when mounted >> in LFS mode. >> >> Signed-off-by: Damien Le Moal <damien.lemoal@wdc.com> >> --- >> fs/f2fs/segment.c | 3 ++- >> 1 file changed, 2 insertions(+), 1 deletion(-) >> >> diff --git a/fs/f2fs/segment.c b/fs/f2fs/segment.c >> index 9684585..3d190a7 100644 >> --- a/fs/f2fs/segment.c >> +++ b/fs/f2fs/segment.c >> @@ -1322,7 +1322,8 @@ void clear_prefree_segments(struct f2fs_sb_info *sbi, struct cp_control *cpc) >> sbi->blocks_per_seg, cur_pos); >> len = next_pos - cur_pos; >> >> - if (force && len < cpc->trim_minlen) >> + if (test_opt(sbi, LFS) || > > Could we just check f2fs_sb_mounted_blkzoned here instead of F2FS_MOUNT_LFS here > ? so a non-blkzoned device can enables small discard when user mount the device > with LFS option. Right? Sure, No problem. I will resend a v2. Best regards.
diff --git a/fs/f2fs/segment.c b/fs/f2fs/segment.c index 9684585..3d190a7 100644 --- a/fs/f2fs/segment.c +++ b/fs/f2fs/segment.c @@ -1322,7 +1322,8 @@ void clear_prefree_segments(struct f2fs_sb_info *sbi, struct cp_control *cpc) sbi->blocks_per_seg, cur_pos); len = next_pos - cur_pos; - if (force && len < cpc->trim_minlen) + if (test_opt(sbi, LFS) || + (force && len < cpc->trim_minlen)) goto skip; f2fs_issue_discard(sbi, entry->start_blkaddr + cur_pos,
clear_prefree_segments() issues small discards after discarding full segments. These small discards may not be section aligned, so not zone aligned when using a zoned block device, or more generally, when mounted in LFS mode. So do not issue these small discards when mounted in LFS mode. Signed-off-by: Damien Le Moal <damien.lemoal@wdc.com> --- fs/f2fs/segment.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)