* [PATCH] block: don't check position contiguity for DISCARD in attempt_merge
@ 2018-10-19 9:24 Jianchao Wang
2018-10-19 9:46 ` Ming Lei
2018-10-19 15:57 ` Martin K. Petersen
0 siblings, 2 replies; 4+ messages in thread
From: Jianchao Wang @ 2018-10-19 9:24 UTC (permalink / raw)
To: axboe; +Cc: linux-block, linux-kernel
Discard command supports multiple ranges of blocks, so needn't
checking position contiguity when merging. Let's do the same thing
in attempt_merge as the blk_try_merge.
Signed-off-by: Jianchao Wang <jianchao.w.wang@oracle.com>
---
block/blk-merge.c | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/block/blk-merge.c b/block/blk-merge.c
index 42a4674..c94749b 100644
--- a/block/blk-merge.c
+++ b/block/blk-merge.c
@@ -732,9 +732,10 @@ static struct request *attempt_merge(struct request_queue *q,
return NULL;
/*
- * not contiguous
+ * not contiguous, except for DISCARD
*/
- if (blk_rq_pos(req) + blk_rq_sectors(req) != blk_rq_pos(next))
+ if ((req_op(req) != REQ_OP_DISCARD) &&
+ (blk_rq_pos(req) + blk_rq_sectors(req) != blk_rq_pos(next)))
return NULL;
if (rq_data_dir(req) != rq_data_dir(next)
--
2.7.4
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH] block: don't check position contiguity for DISCARD in attempt_merge
2018-10-19 9:24 [PATCH] block: don't check position contiguity for DISCARD in attempt_merge Jianchao Wang
@ 2018-10-19 9:46 ` Ming Lei
2018-10-19 15:57 ` Martin K. Petersen
1 sibling, 0 replies; 4+ messages in thread
From: Ming Lei @ 2018-10-19 9:46 UTC (permalink / raw)
To: jianchao.wang; +Cc: Jens Axboe, linux-block, Linux Kernel Mailing List
On Fri, Oct 19, 2018 at 5:23 PM Jianchao Wang
<jianchao.w.wang@oracle.com> wrote:
>
> Discard command supports multiple ranges of blocks, so needn't
> checking position contiguity when merging. Let's do the same thing
> in attempt_merge as the blk_try_merge.
>
> Signed-off-by: Jianchao Wang <jianchao.w.wang@oracle.com>
> ---
> block/blk-merge.c | 5 +++--
> 1 file changed, 3 insertions(+), 2 deletions(-)
>
> diff --git a/block/blk-merge.c b/block/blk-merge.c
> index 42a4674..c94749b 100644
> --- a/block/blk-merge.c
> +++ b/block/blk-merge.c
> @@ -732,9 +732,10 @@ static struct request *attempt_merge(struct request_queue *q,
> return NULL;
>
> /*
> - * not contiguous
> + * not contiguous, except for DISCARD
> */
> - if (blk_rq_pos(req) + blk_rq_sectors(req) != blk_rq_pos(next))
> + if ((req_op(req) != REQ_OP_DISCARD) &&
> + (blk_rq_pos(req) + blk_rq_sectors(req) != blk_rq_pos(next)))
> return NULL;
>
> if (rq_data_dir(req) != rq_data_dir(next)
> --
> 2.7.4
>
Reviewed-by: Ming Lei <ming.lei@redhat.com>
Thanks,
Ming Lei
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] block: don't check position contiguity for DISCARD in attempt_merge
2018-10-19 9:24 [PATCH] block: don't check position contiguity for DISCARD in attempt_merge Jianchao Wang
2018-10-19 9:46 ` Ming Lei
@ 2018-10-19 15:57 ` Martin K. Petersen
2018-10-20 13:57 ` jianchao.wang
1 sibling, 1 reply; 4+ messages in thread
From: Martin K. Petersen @ 2018-10-19 15:57 UTC (permalink / raw)
To: Jianchao Wang; +Cc: axboe, linux-block, linux-kernel
Jianchao,
> Discard command supports multiple ranges of blocks, so needn't
> checking position contiguity when merging. Let's do the same thing
> in attempt_merge as the blk_try_merge.
Discards need to be contiguous unless queue->limits.max_discard_segments
is bigger than 1. So if you remove this I think you need to add a
contiguity check in req_attempt_discard_merge().
--
Martin K. Petersen Oracle Linux Engineering
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] block: don't check position contiguity for DISCARD in attempt_merge
2018-10-19 15:57 ` Martin K. Petersen
@ 2018-10-20 13:57 ` jianchao.wang
0 siblings, 0 replies; 4+ messages in thread
From: jianchao.wang @ 2018-10-20 13:57 UTC (permalink / raw)
To: Martin K. Petersen; +Cc: axboe, linux-block, linux-kernel
Hi Martin
On 10/19/18 11:57 PM, Martin K. Petersen wrote:
>
> Jianchao,
>
>> Discard command supports multiple ranges of blocks, so needn't
>> checking position contiguity when merging. Let's do the same thing
>> in attempt_merge as the blk_try_merge.
>
> Discards need to be contiguous unless queue->limits.max_discard_segments
> is bigger than 1. So if you remove this I think you need to add a
> contiguity check in req_attempt_discard_merge().
>
Yes.
I will send the V2 version next.
Thanks
Jianchao
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2018-10-20 13:57 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-10-19 9:24 [PATCH] block: don't check position contiguity for DISCARD in attempt_merge Jianchao Wang
2018-10-19 9:46 ` Ming Lei
2018-10-19 15:57 ` Martin K. Petersen
2018-10-20 13:57 ` jianchao.wang
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.