From: Damien Le Moal <damien.lemoal@wdc.com>
To: Jens Axboe <axboe@kernel.dk>,
linux-block@vger.kernel.org,
"Martin K . Petersen" <martin.petersen@oracle.com>,
linux-scsi@vger.kernel.org
Cc: MPT-FusionLinux.pdl@broadcom.com, Hannes Reinecke <hare@suse.de>,
Christoph Hellwig <hch@lst.de>,
Bart Van Assche <bart.vanassche@sandisk.com>
Subject: [PATCH 1/3] block: Introduce blk_rq_accesses_medium()
Date: Tue, 28 Feb 2017 19:25:33 +0900 [thread overview]
Message-ID: <20170228102535.15966-2-damien.lemoal@wdc.com> (raw)
In-Reply-To: <20170228102535.15966-1-damien.lemoal@wdc.com>
From: Bart Van Assche <bart.vanassche@sandisk.com>
A medium access request is defined as an internal regular request that
operates on a whole number of logical blocks of the storage medium.
These include REQ_OP_READ, REQ_OP_WRITE, REQ_OP_FLUSH, REQ_OP_DISCARD,
REQ_OP_SECURE_ERASE, REQ_OP_WRITE_SAME and REQ_OP_WRITE_ZEROES.
Zoned block device requests (REQ_OP_ZONE_REPORT and REQ_OP_ZONE_RESET)
as well as SCSI passthrough and driver private commands are not
considered medium access request.
Reshuffle enum req_opf definitions grouping medium access request up
to REQ_OP_MEDIUM_LAST and introduce the helper function
blk_rq_accesses_medium() to test a request.
Signed-off-by: Bart Van Assche <bart.vanassche@sandisk.com>
---
include/linux/blk_types.h | 17 ++++++++++-------
include/linux/blkdev.h | 12 ++++++++++++
2 files changed, 22 insertions(+), 7 deletions(-)
diff --git a/include/linux/blk_types.h b/include/linux/blk_types.h
index d703acb..6420057 100644
--- a/include/linux/blk_types.h
+++ b/include/linux/blk_types.h
@@ -151,16 +151,19 @@ enum req_opf {
REQ_OP_FLUSH = 2,
/* discard sectors */
REQ_OP_DISCARD = 3,
- /* get zone information */
- REQ_OP_ZONE_REPORT = 4,
/* securely erase sectors */
- REQ_OP_SECURE_ERASE = 5,
- /* seset a zone write pointer */
- REQ_OP_ZONE_RESET = 6,
+ REQ_OP_SECURE_ERASE = 4,
/* write the same sector many times */
- REQ_OP_WRITE_SAME = 7,
+ REQ_OP_WRITE_SAME = 5,
/* write the zero filled sector many times */
- REQ_OP_WRITE_ZEROES = 8,
+ REQ_OP_WRITE_ZEROES = 6,
+
+ REQ_OP_MEDIUM_LAST = REQ_OP_WRITE_ZEROES,
+
+ /* get zone information */
+ REQ_OP_ZONE_REPORT = 16,
+ /* reset a zone write pointer */
+ REQ_OP_ZONE_RESET = 17,
/* SCSI passthrough using struct scsi_request */
REQ_OP_SCSI_IN = 32,
diff --git a/include/linux/blkdev.h b/include/linux/blkdev.h
index aecca0e..7d1ce2d 100644
--- a/include/linux/blkdev.h
+++ b/include/linux/blkdev.h
@@ -248,6 +248,18 @@ static inline bool blk_rq_is_passthrough(struct request *rq)
return blk_rq_is_scsi(rq) || blk_rq_is_private(rq);
}
+/**
+ * blk_rq_accesses_medium - test if a request is a medium access request
+ * @rq: A block layer request.
+ *
+ * A medium access request is a regular internal request that operates on
+ * a whole number of logical blocks of the storage medium.
+ */
+static inline bool blk_rq_accesses_medium(const struct request *rq)
+{
+ return req_op(rq) <= REQ_OP_MEDIUM_LAST;
+}
+
static inline unsigned short req_get_ioprio(struct request *req)
{
return req->ioprio;
--
2.9.3
Western Digital Corporation (and its subsidiaries) E-mail Confidentiality Notice & Disclaimer:
This e-mail and any files transmitted with it may contain confidential or legally privileged information of WDC and/or its affiliates, and are intended solely for the use of the individual or entity to which they are addressed. If you are not the intended recipient, any disclosure, copying, distribution or any action taken or omitted to be taken in reliance on it, is prohibited. If you have received this e-mail in error, please notify the sender immediately and delete the e-mail in its entirety from your system.
next prev parent reply other threads:[~2017-02-28 10:25 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-02-28 10:25 [PATCH 0/3] Separate zone requests from medium access requests Damien Le Moal
2017-02-28 10:25 ` Damien Le Moal [this message]
2017-02-28 10:25 ` [PATCH 2/3] block: " Damien Le Moal
2017-02-28 16:57 ` Bart Van Assche
2017-03-09 5:27 ` [lkp-robot] [block] 670fcc25d7: kernel_BUG_at_block/blk-core.c kernel test robot
2017-02-28 10:25 ` [PATCH 3/3] mpt3sas: Do not check resid for non medium access commands Damien Le Moal
2017-02-28 16:02 ` [PATCH 0/3] Separate zone requests from medium access requests Christoph Hellwig
2017-02-28 16:16 ` Bart Van Assche
2017-03-01 2:52 ` Martin K. Petersen
2017-03-01 3:02 ` Damien Le Moal
2017-03-01 3:21 ` Martin K. Petersen
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20170228102535.15966-2-damien.lemoal@wdc.com \
--to=damien.lemoal@wdc.com \
--cc=MPT-FusionLinux.pdl@broadcom.com \
--cc=axboe@kernel.dk \
--cc=bart.vanassche@sandisk.com \
--cc=hare@suse.de \
--cc=hch@lst.de \
--cc=linux-block@vger.kernel.org \
--cc=linux-scsi@vger.kernel.org \
--cc=martin.petersen@oracle.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox