Re: [PATCH 02/21] block: add flag for internal commands

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 09/07/2020 21:02, Jens Axboe wrote:
On 7/8/20 3:27 AM, John Garry wrote:
On 03/07/2020 14:01, Hannes Reinecke wrote:

+linux-block

I figure that linux-block should be cc'ed here

Some drivers require to allocate requests for internal command
submission. These request will never be passed through the block
layer, but nevertheless require a valid tag to avoid them clashing
with normal I/O commands.
This patch adds a new request flag REQ_INTERNAL to mark such
requests and a terminates any such commands in blk_execute_rq_nowait()
with a WARN_ON_ONCE to signal such an invalid usage.

So if these requests will never be passed through the block layer - as you say - then why add a check for this? Surely you will find out in nasty and obvious ways that it should be done.

Thanks,
John


Signed-off-by: Hannes Reinecke <hare@xxxxxxx>
---
   block/blk-exec.c          | 5 +++++
   include/linux/blk_types.h | 2 ++
   include/linux/blkdev.h    | 5 +++++
   3 files changed, 12 insertions(+)

diff --git a/block/blk-exec.c b/block/blk-exec.c
index 85324d53d072..6869877e0d21 100644
--- a/block/blk-exec.c
+++ b/block/blk-exec.c
@@ -55,6 +55,11 @@ void blk_execute_rq_nowait(struct request_queue *q, struct gendisk *bd_disk,
   	rq->rq_disk = bd_disk;
   	rq->end_io = done;
+ if (WARN_ON_ONCE(blk_rq_is_internal(rq))) {
+		blk_mq_end_request(rq, BLK_STS_NOTSUPP);
+		return;
+	}
+
   	blk_account_io_start(rq);

The whole concept seems very odd, and then there's this seemingly
randomly placed check and error condition. As I haven't seen the
actual use case for this, hard to make suggestions though.





[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [SCSI Target Devel]     [Linux SCSI Target Infrastructure]     [Kernel Newbies]     [IDE]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux ATA RAID]     [Linux IIO]     [Samba]     [Device Mapper]

  Powered by Linux