Skip to content

Commit 56162ba

Browse files
committed
Merge branch 'for-linus' of git://git.kernel.dk/linux-2.6-block
* 'for-linus' of git://git.kernel.dk/linux-2.6-block: block: prevent merges of discard and write requests
2 parents e7553b1 + f281fb5 commit 56162ba

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

block/blk-merge.c

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -361,6 +361,18 @@ static int attempt_merge(struct request_queue *q, struct request *req,
361361
if (!rq_mergeable(req) || !rq_mergeable(next))
362362
return 0;
363363

364+
/*
365+
* Don't merge file system requests and discard requests
366+
*/
367+
if ((req->cmd_flags & REQ_DISCARD) != (next->cmd_flags & REQ_DISCARD))
368+
return 0;
369+
370+
/*
371+
* Don't merge discard requests and secure discard requests
372+
*/
373+
if ((req->cmd_flags & REQ_SECURE) != (next->cmd_flags & REQ_SECURE))
374+
return 0;
375+
364376
/*
365377
* not contiguous
366378
*/

0 commit comments

Comments
 (0)