diff mbox series

[1/2] block: don't bother checking the data direction for merges

Message ID 20241119161157.1328171-2-hch@lst.de (mailing list archive)
State New
Headers show
Series [1/2] block: don't bother checking the data direction for merges | expand

Commit Message

Christoph Hellwig Nov. 19, 2024, 4:11 p.m. UTC
Because it already is encoded in the opcode.

Signed-off-by: Christoph Hellwig <hch@lst.de>
---
 block/blk-merge.c | 7 -------
 1 file changed, 7 deletions(-)

Comments

John Garry Nov. 19, 2024, 4:48 p.m. UTC | #1
On 19/11/2024 16:11, Christoph Hellwig wrote:
> Because it already is encoded in the opcode.
> 
> Signed-off-by: Christoph Hellwig <hch@lst.de>
> ---
>   block/blk-merge.c | 7 -------
>   1 file changed, 7 deletions(-)
> 
> diff --git a/block/blk-merge.c b/block/blk-merge.c
> index e0b28e9298c9..64860cbd5e27 100644
> --- a/block/blk-merge.c
> +++ b/block/blk-merge.c
> @@ -864,9 +864,6 @@ static struct request *attempt_merge(struct request_queue *q,
>   	if (req_op(req) != req_op(next))
>   		return NULL;
>   
> -	if (rq_data_dir(req) != rq_data_dir(next))
> -		return NULL;
> -
>   	if (req->bio && next->bio) {
>   		/* Don't merge requests with different write hints. */
>   		if (req->bio->bi_write_hint != next->bio->bi_write_hint)
> @@ -986,10 +983,6 @@ bool blk_rq_merge_ok(struct request *rq, struct bio *bio)
>   	if (req_op(rq) != bio_op(bio))
>   		return false;
>   
> -	/* different data direction or already started, don't merge */

I tried to check what is meant by "already started", but that comment 
pre-dates git. And even the code from then does not make it obvious, but 
I don't want to check further, so:

Reviewed-by: John Garry <john.g.garry@oracle.com>


> -	if (bio_data_dir(bio) != rq_data_dir(rq))
> -		return false;
> -
>   	/* don't merge across cgroup boundaries */
>   	if (!blk_cgroup_mergeable(rq, bio))
>   		return false;
Christoph Hellwig Nov. 19, 2024, 4:49 p.m. UTC | #2
On Tue, Nov 19, 2024 at 04:48:15PM +0000, John Garry wrote:
> I tried to check what is meant by "already started", but that comment 
> pre-dates git. And even the code from then does not make it obvious, but I 
> don't want to check further, so:

Back in the bad old days there was a separare prep_fn callback into
the driver to prepare a request while it was still on the scheduler
lists, and that then set a started flag.   In other words the comment
is long obsolete.
diff mbox series

Patch

diff --git a/block/blk-merge.c b/block/blk-merge.c
index e0b28e9298c9..64860cbd5e27 100644
--- a/block/blk-merge.c
+++ b/block/blk-merge.c
@@ -864,9 +864,6 @@  static struct request *attempt_merge(struct request_queue *q,
 	if (req_op(req) != req_op(next))
 		return NULL;
 
-	if (rq_data_dir(req) != rq_data_dir(next))
-		return NULL;
-
 	if (req->bio && next->bio) {
 		/* Don't merge requests with different write hints. */
 		if (req->bio->bi_write_hint != next->bio->bi_write_hint)
@@ -986,10 +983,6 @@  bool blk_rq_merge_ok(struct request *rq, struct bio *bio)
 	if (req_op(rq) != bio_op(bio))
 		return false;
 
-	/* different data direction or already started, don't merge */
-	if (bio_data_dir(bio) != rq_data_dir(rq))
-		return false;
-
 	/* don't merge across cgroup boundaries */
 	if (!blk_cgroup_mergeable(rq, bio))
 		return false;