summaryrefslogtreecommitdiffstats
path: root/drivers/block
diff options
context:
space:
mode:
authorMike Christie <mchristi@redhat.com>2016-06-05 15:32:17 -0400
committerJens Axboe <axboe@fb.com>2016-06-07 15:41:38 -0400
commitc2df40dfb8c015211ec55f4b1dd0587f875c7b34 (patch)
tree8660ea8a2a00b0248fa609e7e6b737a8d92306d9 /drivers/block
parentd9d8c5c489f4969667a05727e9c2c4f78cffef1a (diff)
drivers: use req op accessor
The req operation REQ_OP is separated from the rq_flag_bits definition. This converts the block layer drivers to use req_op to get the op from the request struct. Signed-off-by: Mike Christie <mchristi@redhat.com> Reviewed-by: Hannes Reinecke <hare@suse.com> Signed-off-by: Jens Axboe <axboe@fb.com>
Diffstat (limited to 'drivers/block')
-rw-r--r--drivers/block/loop.c6
-rw-r--r--drivers/block/mtip32xx/mtip32xx.c2
-rw-r--r--drivers/block/nbd.c2
-rw-r--r--drivers/block/rbd.c4
-rw-r--r--drivers/block/xen-blkfront.c8
5 files changed, 12 insertions, 10 deletions
diff --git a/drivers/block/loop.c b/drivers/block/loop.c
index e9f1701af7cb..b9b737cafd5f 100644
--- a/drivers/block/loop.c
+++ b/drivers/block/loop.c
@@ -544,7 +544,7 @@ static int do_req_filebacked(struct loop_device *lo, struct request *rq)
544 if (op_is_write(req_op(rq))) { 544 if (op_is_write(req_op(rq))) {
545 if (rq->cmd_flags & REQ_FLUSH) 545 if (rq->cmd_flags & REQ_FLUSH)
546 ret = lo_req_flush(lo, rq); 546 ret = lo_req_flush(lo, rq);
547 else if (rq->cmd_flags & REQ_DISCARD) 547 else if (req_op(rq) == REQ_OP_DISCARD)
548 ret = lo_discard(lo, rq, pos); 548 ret = lo_discard(lo, rq, pos);
549 else if (lo->transfer) 549 else if (lo->transfer)
550 ret = lo_write_transfer(lo, rq, pos); 550 ret = lo_write_transfer(lo, rq, pos);
@@ -1659,8 +1659,8 @@ static int loop_queue_rq(struct blk_mq_hw_ctx *hctx,
1659 if (lo->lo_state != Lo_bound) 1659 if (lo->lo_state != Lo_bound)
1660 return -EIO; 1660 return -EIO;
1661 1661
1662 if (lo->use_dio && !(cmd->rq->cmd_flags & (REQ_FLUSH | 1662 if (lo->use_dio && (!(cmd->rq->cmd_flags & REQ_FLUSH) ||
1663 REQ_DISCARD))) 1663 req_op(cmd->rq) == REQ_OP_DISCARD))
1664 cmd->use_aio = true; 1664 cmd->use_aio = true;
1665 else 1665 else
1666 cmd->use_aio = false; 1666 cmd->use_aio = false;
diff --git a/drivers/block/mtip32xx/mtip32xx.c b/drivers/block/mtip32xx/mtip32xx.c
index 6053e4659fa2..8e3e708cb9ee 100644
--- a/drivers/block/mtip32xx/mtip32xx.c
+++ b/drivers/block/mtip32xx/mtip32xx.c
@@ -3765,7 +3765,7 @@ static int mtip_submit_request(struct blk_mq_hw_ctx *hctx, struct request *rq)
3765 return -ENODATA; 3765 return -ENODATA;
3766 } 3766 }
3767 3767
3768 if (rq->cmd_flags & REQ_DISCARD) { 3768 if (req_op(rq) == REQ_OP_DISCARD) {
3769 int err; 3769 int err;
3770 3770
3771 err = mtip_send_trim(dd, blk_rq_pos(rq), blk_rq_sectors(rq)); 3771 err = mtip_send_trim(dd, blk_rq_pos(rq), blk_rq_sectors(rq));
diff --git a/drivers/block/nbd.c b/drivers/block/nbd.c
index 31e73a7a40f2..6c2c28d124d0 100644
--- a/drivers/block/nbd.c
+++ b/drivers/block/nbd.c
@@ -282,7 +282,7 @@ static int nbd_send_req(struct nbd_device *nbd, struct request *req)
282 282
283 if (req->cmd_type == REQ_TYPE_DRV_PRIV) 283 if (req->cmd_type == REQ_TYPE_DRV_PRIV)
284 type = NBD_CMD_DISC; 284 type = NBD_CMD_DISC;
285 else if (req->cmd_flags & REQ_DISCARD) 285 else if (req_op(req) == REQ_OP_DISCARD)
286 type = NBD_CMD_TRIM; 286 type = NBD_CMD_TRIM;
287 else if (req->cmd_flags & REQ_FLUSH) 287 else if (req->cmd_flags & REQ_FLUSH)
288 type = NBD_CMD_FLUSH; 288 type = NBD_CMD_FLUSH;
diff --git a/drivers/block/rbd.c b/drivers/block/rbd.c
index 81666a56415e..450662055d97 100644
--- a/drivers/block/rbd.c
+++ b/drivers/block/rbd.c
@@ -3286,9 +3286,9 @@ static void rbd_queue_workfn(struct work_struct *work)
3286 goto err; 3286 goto err;
3287 } 3287 }
3288 3288
3289 if (rq->cmd_flags & REQ_DISCARD) 3289 if (req_op(rq) == REQ_OP_DISCARD)
3290 op_type = OBJ_OP_DISCARD; 3290 op_type = OBJ_OP_DISCARD;
3291 else if (rq->cmd_flags & REQ_WRITE) 3291 else if (req_op(rq) == REQ_OP_WRITE)
3292 op_type = OBJ_OP_WRITE; 3292 op_type = OBJ_OP_WRITE;
3293 else 3293 else
3294 op_type = OBJ_OP_READ; 3294 op_type = OBJ_OP_READ;
diff --git a/drivers/block/xen-blkfront.c b/drivers/block/xen-blkfront.c
index 52963a26660a..6fd160197b7a 100644
--- a/drivers/block/xen-blkfront.c
+++ b/drivers/block/xen-blkfront.c
@@ -844,7 +844,8 @@ static int blkif_queue_request(struct request *req, struct blkfront_ring_info *r
844 if (unlikely(rinfo->dev_info->connected != BLKIF_STATE_CONNECTED)) 844 if (unlikely(rinfo->dev_info->connected != BLKIF_STATE_CONNECTED))
845 return 1; 845 return 1;
846 846
847 if (unlikely(req->cmd_flags & (REQ_DISCARD | REQ_SECURE))) 847 if (unlikely(req_op(req) == REQ_OP_DISCARD ||
848 req->cmd_flags & REQ_SECURE))
848 return blkif_queue_discard_req(req, rinfo); 849 return blkif_queue_discard_req(req, rinfo);
849 else 850 else
850 return blkif_queue_rw_req(req, rinfo); 851 return blkif_queue_rw_req(req, rinfo);
@@ -2054,8 +2055,9 @@ static int blkif_recover(struct blkfront_info *info)
2054 /* 2055 /*
2055 * Get the bios in the request so we can re-queue them. 2056 * Get the bios in the request so we can re-queue them.
2056 */ 2057 */
2057 if (copy[i].request->cmd_flags & 2058 if (copy[i].request->cmd_flags & REQ_FLUSH ||
2058 (REQ_FLUSH | REQ_FUA | REQ_DISCARD | REQ_SECURE)) { 2059 req_op(copy[i].request) == REQ_OP_DISCARD ||
2060 copy[i].request->cmd_flags & (REQ_FUA | REQ_SECURE)) {
2059 /* 2061 /*
2060 * Flush operations don't contain bios, so 2062 * Flush operations don't contain bios, so
2061 * we need to requeue the whole request 2063 * we need to requeue the whole request