All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] f2fs: avoid mismatching block range for discard
@ 2016-07-07  4:13 Yunlei He
  2016-07-07  4:38 ` Chao Yu
  0 siblings, 1 reply; 2+ messages in thread
From: Yunlei He @ 2016-07-07  4:13 UTC (permalink / raw)
  To: linux-f2fs-devel, jaegeuk, yuchao; +Cc: heyunlei

This patch skip discard block range smaller than trim_minlen,
and can not be merged by neighbour

Signed-off-by: Yunlei He <heyunlei@huawei.com>
---
 fs/f2fs/segment.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/fs/f2fs/segment.c b/fs/f2fs/segment.c
index 6d16ecf..9e13db0 100644
--- a/fs/f2fs/segment.c
+++ b/fs/f2fs/segment.c
@@ -672,6 +672,10 @@ static void add_discard_addrs(struct f2fs_sb_info *sbi, struct cp_control *cpc)
 			break;
 
 		end = __find_rev_next_zero_bit(dmap, max_blocks, start + 1);
+		if (force && start && end != max_blocks
+					&& (end - start) < cpc->trim_minlen)
+			continue;
+
 		__add_discard_entry(sbi, cpc, se, start, end);
 	}
 }
-- 
1.9.1


------------------------------------------------------------------------------
Attend Shape: An AT&T Tech Expo July 15-16. Meet us at AT&T Park in San
Francisco, CA to explore cutting-edge tech and listen to tech luminaries
present their vision of the future. This family event has something for
everyone, including kids. Get more information and register today.
http://sdm.link/attshape

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

* Re: [PATCH] f2fs: avoid mismatching block range for discard
  2016-07-07  4:13 [PATCH] f2fs: avoid mismatching block range for discard Yunlei He
@ 2016-07-07  4:38 ` Chao Yu
  0 siblings, 0 replies; 2+ messages in thread
From: Chao Yu @ 2016-07-07  4:38 UTC (permalink / raw)
  To: Yunlei He, linux-f2fs-devel, jaegeuk, yuchao; +Cc: heyunlei

On 2016/7/7 12:13, Yunlei He wrote:
> This patch skip discard block range smaller than trim_minlen,
> and can not be merged by neighbour
> 
> Signed-off-by: Yunlei He <heyunlei@huawei.com>

Looks good to me, it reduces memory footprint during fstrim.

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

> ---
>  fs/f2fs/segment.c | 4 ++++
>  1 file changed, 4 insertions(+)
> 
> diff --git a/fs/f2fs/segment.c b/fs/f2fs/segment.c
> index 6d16ecf..9e13db0 100644
> --- a/fs/f2fs/segment.c
> +++ b/fs/f2fs/segment.c
> @@ -672,6 +672,10 @@ static void add_discard_addrs(struct f2fs_sb_info *sbi, struct cp_control *cpc)
>  			break;
>  
>  		end = __find_rev_next_zero_bit(dmap, max_blocks, start + 1);
> +		if (force && start && end != max_blocks
> +					&& (end - start) < cpc->trim_minlen)
> +			continue;
> +
>  		__add_discard_entry(sbi, cpc, se, start, end);
>  	}
>  }
> 

------------------------------------------------------------------------------
Attend Shape: An AT&T Tech Expo July 15-16. Meet us at AT&T Park in San
Francisco, CA to explore cutting-edge tech and listen to tech luminaries
present their vision of the future. This family event has something for
everyone, including kids. Get more information and register today.
http://sdm.link/attshape

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

end of thread, other threads:[~2016-07-07  4:38 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-07-07  4:13 [PATCH] f2fs: avoid mismatching block range for discard Yunlei He
2016-07-07  4:38 ` Chao Yu

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.