Commit da6269da authored by Christoph Hellwig's avatar Christoph Hellwig Committed by Jens Axboe

block: remove REQ_OP_SCSI_{IN,OUT}

With the legacy IDE driver gone drivers now use either REQ_OP_DRV_*
or REQ_OP_SCSI_*, so unify the two concepts of passthrough requests
into a single one.
Reviewed-by: default avatarChaitanya Kulkarni <chaitanya.kulkarni@wdc.com>
Signed-off-by: default avatarChristoph Hellwig <hch@lst.de>
Signed-off-by: default avatarJens Axboe <axboe@kernel.dk>
parent 5ec780a6
...@@ -142,8 +142,6 @@ static const char *const blk_op_name[] = { ...@@ -142,8 +142,6 @@ static const char *const blk_op_name[] = {
REQ_OP_NAME(ZONE_APPEND), REQ_OP_NAME(ZONE_APPEND),
REQ_OP_NAME(WRITE_SAME), REQ_OP_NAME(WRITE_SAME),
REQ_OP_NAME(WRITE_ZEROES), REQ_OP_NAME(WRITE_ZEROES),
REQ_OP_NAME(SCSI_IN),
REQ_OP_NAME(SCSI_OUT),
REQ_OP_NAME(DRV_IN), REQ_OP_NAME(DRV_IN),
REQ_OP_NAME(DRV_OUT), REQ_OP_NAME(DRV_OUT),
}; };
......
...@@ -45,7 +45,7 @@ static int bsg_transport_fill_hdr(struct request *rq, struct sg_io_v4 *hdr, ...@@ -45,7 +45,7 @@ static int bsg_transport_fill_hdr(struct request *rq, struct sg_io_v4 *hdr,
return PTR_ERR(job->request); return PTR_ERR(job->request);
if (hdr->dout_xfer_len && hdr->din_xfer_len) { if (hdr->dout_xfer_len && hdr->din_xfer_len) {
job->bidi_rq = blk_get_request(rq->q, REQ_OP_SCSI_IN, 0); job->bidi_rq = blk_get_request(rq->q, REQ_OP_DRV_IN, 0);
if (IS_ERR(job->bidi_rq)) { if (IS_ERR(job->bidi_rq)) {
ret = PTR_ERR(job->bidi_rq); ret = PTR_ERR(job->bidi_rq);
goto out; goto out;
......
...@@ -152,7 +152,7 @@ static int bsg_sg_io(struct request_queue *q, fmode_t mode, void __user *uarg) ...@@ -152,7 +152,7 @@ static int bsg_sg_io(struct request_queue *q, fmode_t mode, void __user *uarg)
return ret; return ret;
rq = blk_get_request(q, hdr.dout_xfer_len ? rq = blk_get_request(q, hdr.dout_xfer_len ?
REQ_OP_SCSI_OUT : REQ_OP_SCSI_IN, 0); REQ_OP_DRV_OUT : REQ_OP_DRV_IN, 0);
if (IS_ERR(rq)) if (IS_ERR(rq))
return PTR_ERR(rq); return PTR_ERR(rq);
......
...@@ -311,7 +311,7 @@ static int sg_io(struct request_queue *q, struct gendisk *bd_disk, ...@@ -311,7 +311,7 @@ static int sg_io(struct request_queue *q, struct gendisk *bd_disk,
at_head = 1; at_head = 1;
ret = -ENOMEM; ret = -ENOMEM;
rq = blk_get_request(q, writing ? REQ_OP_SCSI_OUT : REQ_OP_SCSI_IN, 0); rq = blk_get_request(q, writing ? REQ_OP_DRV_OUT : REQ_OP_DRV_IN, 0);
if (IS_ERR(rq)) if (IS_ERR(rq))
return PTR_ERR(rq); return PTR_ERR(rq);
req = scsi_req(rq); req = scsi_req(rq);
...@@ -433,7 +433,7 @@ int sg_scsi_ioctl(struct request_queue *q, struct gendisk *disk, fmode_t mode, ...@@ -433,7 +433,7 @@ int sg_scsi_ioctl(struct request_queue *q, struct gendisk *disk, fmode_t mode,
} }
rq = blk_get_request(q, in_len ? REQ_OP_SCSI_OUT : REQ_OP_SCSI_IN, 0); rq = blk_get_request(q, in_len ? REQ_OP_DRV_OUT : REQ_OP_DRV_IN, 0);
if (IS_ERR(rq)) { if (IS_ERR(rq)) {
err = PTR_ERR(rq); err = PTR_ERR(rq);
goto error_free_buffer; goto error_free_buffer;
...@@ -521,7 +521,7 @@ static int __blk_send_generic(struct request_queue *q, struct gendisk *bd_disk, ...@@ -521,7 +521,7 @@ static int __blk_send_generic(struct request_queue *q, struct gendisk *bd_disk,
struct request *rq; struct request *rq;
int err; int err;
rq = blk_get_request(q, REQ_OP_SCSI_OUT, 0); rq = blk_get_request(q, REQ_OP_DRV_OUT, 0);
if (IS_ERR(rq)) if (IS_ERR(rq))
return PTR_ERR(rq); return PTR_ERR(rq);
rq->timeout = BLK_DEFAULT_SG_TIMEOUT; rq->timeout = BLK_DEFAULT_SG_TIMEOUT;
......
...@@ -704,7 +704,7 @@ static int pkt_generic_packet(struct pktcdvd_device *pd, struct packet_command * ...@@ -704,7 +704,7 @@ static int pkt_generic_packet(struct pktcdvd_device *pd, struct packet_command *
int ret = 0; int ret = 0;
rq = blk_get_request(q, (cgc->data_direction == CGC_DATA_WRITE) ? rq = blk_get_request(q, (cgc->data_direction == CGC_DATA_WRITE) ?
REQ_OP_SCSI_OUT : REQ_OP_SCSI_IN, 0); REQ_OP_DRV_OUT : REQ_OP_DRV_IN, 0);
if (IS_ERR(rq)) if (IS_ERR(rq))
return PTR_ERR(rq); return PTR_ERR(rq);
......
...@@ -2186,7 +2186,7 @@ static int cdrom_read_cdda_bpc(struct cdrom_device_info *cdi, __u8 __user *ubuf, ...@@ -2186,7 +2186,7 @@ static int cdrom_read_cdda_bpc(struct cdrom_device_info *cdi, __u8 __user *ubuf,
len = nr * CD_FRAMESIZE_RAW; len = nr * CD_FRAMESIZE_RAW;
rq = blk_get_request(q, REQ_OP_SCSI_IN, 0); rq = blk_get_request(q, REQ_OP_DRV_IN, 0);
if (IS_ERR(rq)) { if (IS_ERR(rq)) {
ret = PTR_ERR(rq); ret = PTR_ERR(rq);
break; break;
......
...@@ -2011,7 +2011,7 @@ static void scsi_eh_lock_door(struct scsi_device *sdev) ...@@ -2011,7 +2011,7 @@ static void scsi_eh_lock_door(struct scsi_device *sdev)
struct request *req; struct request *req;
struct scsi_request *rq; struct scsi_request *rq;
req = blk_get_request(sdev->request_queue, REQ_OP_SCSI_IN, 0); req = blk_get_request(sdev->request_queue, REQ_OP_DRV_IN, 0);
if (IS_ERR(req)) if (IS_ERR(req))
return; return;
rq = scsi_req(req); rq = scsi_req(req);
......
...@@ -215,7 +215,7 @@ int __scsi_execute(struct scsi_device *sdev, const unsigned char *cmd, ...@@ -215,7 +215,7 @@ int __scsi_execute(struct scsi_device *sdev, const unsigned char *cmd,
req = blk_get_request(sdev->request_queue, req = blk_get_request(sdev->request_queue,
data_direction == DMA_TO_DEVICE ? data_direction == DMA_TO_DEVICE ?
REQ_OP_SCSI_OUT : REQ_OP_SCSI_IN, REQ_OP_DRV_OUT : REQ_OP_DRV_IN,
rq_flags & RQF_PM ? BLK_MQ_REQ_PM : 0); rq_flags & RQF_PM ? BLK_MQ_REQ_PM : 0);
if (IS_ERR(req)) if (IS_ERR(req))
return ret; return ret;
...@@ -540,7 +540,7 @@ static bool scsi_end_request(struct request *req, blk_status_t error, ...@@ -540,7 +540,7 @@ static bool scsi_end_request(struct request *req, blk_status_t error,
if (blk_queue_add_random(q)) if (blk_queue_add_random(q))
add_disk_randomness(req->rq_disk); add_disk_randomness(req->rq_disk);
if (!blk_rq_is_scsi(req)) { if (!blk_rq_is_passthrough(req)) {
WARN_ON_ONCE(!(cmd->flags & SCMD_INITIALIZED)); WARN_ON_ONCE(!(cmd->flags & SCMD_INITIALIZED));
cmd->flags &= ~SCMD_INITIALIZED; cmd->flags &= ~SCMD_INITIALIZED;
} }
...@@ -1115,7 +1115,7 @@ void scsi_init_command(struct scsi_device *dev, struct scsi_cmnd *cmd) ...@@ -1115,7 +1115,7 @@ void scsi_init_command(struct scsi_device *dev, struct scsi_cmnd *cmd)
bool in_flight; bool in_flight;
int budget_token = cmd->budget_token; int budget_token = cmd->budget_token;
if (!blk_rq_is_scsi(rq) && !(flags & SCMD_INITIALIZED)) { if (!blk_rq_is_passthrough(rq) && !(flags & SCMD_INITIALIZED)) {
flags |= SCMD_INITIALIZED; flags |= SCMD_INITIALIZED;
scsi_initialize_rq(rq); scsi_initialize_rq(rq);
} }
...@@ -1556,7 +1556,7 @@ static blk_status_t scsi_prepare_cmd(struct request *req) ...@@ -1556,7 +1556,7 @@ static blk_status_t scsi_prepare_cmd(struct request *req)
* Special handling for passthrough commands, which don't go to the ULP * Special handling for passthrough commands, which don't go to the ULP
* at all: * at all:
*/ */
if (blk_rq_is_scsi(req)) if (blk_rq_is_passthrough(req))
return scsi_setup_scsi_cmnd(sdev, req); return scsi_setup_scsi_cmnd(sdev, req);
if (sdev->handler && sdev->handler->prep_fn) { if (sdev->handler && sdev->handler->prep_fn) {
......
...@@ -1756,7 +1756,7 @@ sg_start_req(Sg_request *srp, unsigned char *cmd) ...@@ -1756,7 +1756,7 @@ sg_start_req(Sg_request *srp, unsigned char *cmd)
* not expect an EWOULDBLOCK from this condition. * not expect an EWOULDBLOCK from this condition.
*/ */
rq = blk_get_request(q, hp->dxfer_direction == SG_DXFER_TO_DEV ? rq = blk_get_request(q, hp->dxfer_direction == SG_DXFER_TO_DEV ?
REQ_OP_SCSI_OUT : REQ_OP_SCSI_IN, 0); REQ_OP_DRV_OUT : REQ_OP_DRV_IN, 0);
if (IS_ERR(rq)) { if (IS_ERR(rq)) {
kfree(long_cmdp); kfree(long_cmdp);
return PTR_ERR(rq); return PTR_ERR(rq);
......
...@@ -549,7 +549,7 @@ static int st_scsi_execute(struct st_request *SRpnt, const unsigned char *cmd, ...@@ -549,7 +549,7 @@ static int st_scsi_execute(struct st_request *SRpnt, const unsigned char *cmd,
req = blk_get_request(SRpnt->stp->device->request_queue, req = blk_get_request(SRpnt->stp->device->request_queue,
data_direction == DMA_TO_DEVICE ? data_direction == DMA_TO_DEVICE ?
REQ_OP_SCSI_OUT : REQ_OP_SCSI_IN, 0); REQ_OP_DRV_OUT : REQ_OP_DRV_IN, 0);
if (IS_ERR(req)) if (IS_ERR(req))
return DRIVER_ERROR << 24; return DRIVER_ERROR << 24;
rq = scsi_req(req); rq = scsi_req(req);
......
...@@ -982,7 +982,7 @@ pscsi_execute_cmd(struct se_cmd *cmd) ...@@ -982,7 +982,7 @@ pscsi_execute_cmd(struct se_cmd *cmd)
req = blk_get_request(pdv->pdv_sd->request_queue, req = blk_get_request(pdv->pdv_sd->request_queue,
cmd->data_direction == DMA_TO_DEVICE ? cmd->data_direction == DMA_TO_DEVICE ?
REQ_OP_SCSI_OUT : REQ_OP_SCSI_IN, 0); REQ_OP_DRV_OUT : REQ_OP_DRV_IN, 0);
if (IS_ERR(req)) { if (IS_ERR(req)) {
pr_err("PSCSI: blk_get_request() failed\n"); pr_err("PSCSI: blk_get_request() failed\n");
ret = TCM_LOGICAL_UNIT_COMMUNICATION_FAILURE; ret = TCM_LOGICAL_UNIT_COMMUNICATION_FAILURE;
......
...@@ -236,7 +236,7 @@ static int nfsd4_scsi_identify_device(struct block_device *bdev, ...@@ -236,7 +236,7 @@ static int nfsd4_scsi_identify_device(struct block_device *bdev,
if (!buf) if (!buf)
return -ENOMEM; return -ENOMEM;
rq = blk_get_request(q, REQ_OP_SCSI_IN, 0); rq = blk_get_request(q, REQ_OP_DRV_IN, 0);
if (IS_ERR(rq)) { if (IS_ERR(rq)) {
error = -ENOMEM; error = -ENOMEM;
goto out_free_buf; goto out_free_buf;
......
...@@ -350,9 +350,6 @@ enum req_opf { ...@@ -350,9 +350,6 @@ enum req_opf {
/* reset all the zone present on the device */ /* reset all the zone present on the device */
REQ_OP_ZONE_RESET_ALL = 17, REQ_OP_ZONE_RESET_ALL = 17,
/* SCSI passthrough using struct scsi_request */
REQ_OP_SCSI_IN = 32,
REQ_OP_SCSI_OUT = 33,
/* Driver private requests */ /* Driver private requests */
REQ_OP_DRV_IN = 34, REQ_OP_DRV_IN = 34,
REQ_OP_DRV_OUT = 35, REQ_OP_DRV_OUT = 35,
......
...@@ -240,42 +240,15 @@ struct request { ...@@ -240,42 +240,15 @@ struct request {
void *end_io_data; void *end_io_data;
}; };
static inline bool blk_op_is_scsi(unsigned int op) static inline bool blk_op_is_passthrough(unsigned int op)
{
return op == REQ_OP_SCSI_IN || op == REQ_OP_SCSI_OUT;
}
static inline bool blk_op_is_private(unsigned int op)
{ {
op &= REQ_OP_MASK;
return op == REQ_OP_DRV_IN || op == REQ_OP_DRV_OUT; return op == REQ_OP_DRV_IN || op == REQ_OP_DRV_OUT;
} }
static inline bool blk_rq_is_scsi(struct request *rq)
{
return blk_op_is_scsi(req_op(rq));
}
static inline bool blk_rq_is_private(struct request *rq)
{
return blk_op_is_private(req_op(rq));
}
static inline bool blk_rq_is_passthrough(struct request *rq) static inline bool blk_rq_is_passthrough(struct request *rq)
{ {
return blk_rq_is_scsi(rq) || blk_rq_is_private(rq); return blk_op_is_passthrough(req_op(rq));
}
static inline bool bio_is_passthrough(struct bio *bio)
{
unsigned op = bio_op(bio);
return blk_op_is_scsi(op) || blk_op_is_private(op);
}
static inline bool blk_op_is_passthrough(unsigned int op)
{
return (blk_op_is_scsi(op & REQ_OP_MASK) ||
blk_op_is_private(op & REQ_OP_MASK));
} }
static inline unsigned short req_get_ioprio(struct request *req) static inline unsigned short req_get_ioprio(struct request *req)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment