Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit c2df40df authored by Mike Christie's avatar Mike Christie Committed by Jens Axboe
Browse files

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: default avatarMike Christie <mchristi@redhat.com>
Reviewed-by: default avatarHannes Reinecke <hare@suse.com>
Signed-off-by: default avatarJens Axboe <axboe@fb.com>
parent d9d8c5c4
Loading
Loading
Loading
Loading
+3 −3
Original line number Diff line number Diff line
@@ -544,7 +544,7 @@ static int do_req_filebacked(struct loop_device *lo, struct request *rq)
	if (op_is_write(req_op(rq))) {
		if (rq->cmd_flags & REQ_FLUSH)
			ret = lo_req_flush(lo, rq);
		else if (rq->cmd_flags & REQ_DISCARD)
		else if (req_op(rq) == REQ_OP_DISCARD)
			ret = lo_discard(lo, rq, pos);
		else if (lo->transfer)
			ret = lo_write_transfer(lo, rq, pos);
@@ -1659,8 +1659,8 @@ static int loop_queue_rq(struct blk_mq_hw_ctx *hctx,
	if (lo->lo_state != Lo_bound)
		return -EIO;

	if (lo->use_dio && !(cmd->rq->cmd_flags & (REQ_FLUSH |
					REQ_DISCARD)))
	if (lo->use_dio && (!(cmd->rq->cmd_flags & REQ_FLUSH) ||
	    req_op(cmd->rq) == REQ_OP_DISCARD))
		cmd->use_aio = true;
	else
		cmd->use_aio = false;
+1 −1
Original line number Diff line number Diff line
@@ -3765,7 +3765,7 @@ static int mtip_submit_request(struct blk_mq_hw_ctx *hctx, struct request *rq)
			return -ENODATA;
	}

	if (rq->cmd_flags & REQ_DISCARD) {
	if (req_op(rq) == REQ_OP_DISCARD) {
		int err;

		err = mtip_send_trim(dd, blk_rq_pos(rq), blk_rq_sectors(rq));
+1 −1
Original line number Diff line number Diff line
@@ -282,7 +282,7 @@ static int nbd_send_req(struct nbd_device *nbd, struct request *req)

	if (req->cmd_type == REQ_TYPE_DRV_PRIV)
		type = NBD_CMD_DISC;
	else if (req->cmd_flags & REQ_DISCARD)
	else if (req_op(req) == REQ_OP_DISCARD)
		type = NBD_CMD_TRIM;
	else if (req->cmd_flags & REQ_FLUSH)
		type = NBD_CMD_FLUSH;
+2 −2
Original line number Diff line number Diff line
@@ -3286,9 +3286,9 @@ static void rbd_queue_workfn(struct work_struct *work)
		goto err;
	}

	if (rq->cmd_flags & REQ_DISCARD)
	if (req_op(rq) == REQ_OP_DISCARD)
		op_type = OBJ_OP_DISCARD;
	else if (rq->cmd_flags & REQ_WRITE)
	else if (req_op(rq) == REQ_OP_WRITE)
		op_type = OBJ_OP_WRITE;
	else
		op_type = OBJ_OP_READ;
+5 −3
Original line number Diff line number Diff line
@@ -844,7 +844,8 @@ static int blkif_queue_request(struct request *req, struct blkfront_ring_info *r
	if (unlikely(rinfo->dev_info->connected != BLKIF_STATE_CONNECTED))
		return 1;

	if (unlikely(req->cmd_flags & (REQ_DISCARD | REQ_SECURE)))
	if (unlikely(req_op(req) == REQ_OP_DISCARD ||
		     req->cmd_flags & REQ_SECURE))
		return blkif_queue_discard_req(req, rinfo);
	else
		return blkif_queue_rw_req(req, rinfo);
@@ -2054,8 +2055,9 @@ static int blkif_recover(struct blkfront_info *info)
			/*
			 * Get the bios in the request so we can re-queue them.
			 */
			if (copy[i].request->cmd_flags &
			    (REQ_FLUSH | REQ_FUA | REQ_DISCARD | REQ_SECURE)) {
			if (copy[i].request->cmd_flags & REQ_FLUSH ||
			    req_op(copy[i].request) == REQ_OP_DISCARD ||
			    copy[i].request->cmd_flags & (REQ_FUA | REQ_SECURE)) {
				/*
				 * Flush operations don't contain bios, so
				 * we need to requeue the whole request
Loading