All of lore.kernel.org
 help / color / mirror / Atom feed
From: mchristi@redhat.com
To: linux-fsdevel@vger.kernel.org, dm-devel@redhat.com,
	linux-raid@vger.kernel.org, linux-kernel@vger.kernel.org,
	linux-scsi@vger.kernel.org, drbd-dev@lists.linbit.com
Cc: Mike Christie <mchristi@redhat.com>
Subject: [PATCH 06/32] xen blkback: prepare for bi_rw split
Date: Wed,  4 Nov 2015 16:08:03 -0600	[thread overview]
Message-ID: <1446674909-5371-7-git-send-email-mchristi@redhat.com> (raw)
In-Reply-To: <1446674909-5371-1-git-send-email-mchristi@redhat.com>

From: Mike Christie <mchristi@redhat.com>

This patch prepares xen blkback submit_bio use for the next
patches that split bi_rw into a operation and flags field.
Instead of passing in a bitmap with both the operation and
flags mixed in, the callers will now pass them in seperately.

This patch modifies the code related to the submit_bio calls
so the flags and operation are seperated. When this is done
for all code, one of the later patches in the series will
modify the actual submit_bio call, so the patches are bisectable.

Signed-off-by: Mike Christie <mchristi@redhat.com>
---
 drivers/block/xen-blkback/blkback.c | 23 +++++++++++++----------
 1 file changed, 13 insertions(+), 10 deletions(-)

diff --git a/drivers/block/xen-blkback/blkback.c b/drivers/block/xen-blkback/blkback.c
index 6a685ae..bfffab3 100644
--- a/drivers/block/xen-blkback/blkback.c
+++ b/drivers/block/xen-blkback/blkback.c
@@ -488,7 +488,7 @@ static int xen_vbd_translate(struct phys_req *req, struct xen_blkif *blkif,
 	struct xen_vbd *vbd = &blkif->vbd;
 	int rc = -EACCES;
 
-	if ((operation != READ) && vbd->readonly)
+	if ((operation != REQ_OP_READ) && vbd->readonly)
 		goto out;
 
 	if (likely(req->nr_sects)) {
@@ -990,7 +990,7 @@ static int dispatch_discard_io(struct xen_blkif *blkif,
 	preq.sector_number = req->u.discard.sector_number;
 	preq.nr_sects      = req->u.discard.nr_sectors;
 
-	err = xen_vbd_translate(&preq, blkif, WRITE);
+	err = xen_vbd_translate(&preq, blkif, REQ_OP_WRITE);
 	if (err) {
 		pr_warn("access denied: DISCARD [%llu->%llu] on dev=%04x\n",
 			preq.sector_number,
@@ -1203,6 +1203,7 @@ static int dispatch_rw_block_io(struct xen_blkif *blkif,
 	struct bio **biolist = pending_req->biolist;
 	int i, nbio = 0;
 	int operation;
+	int operation_flags = 0;
 	struct blk_plug plug;
 	bool drain = false;
 	struct grant_page **pages = pending_req->segments;
@@ -1220,17 +1221,19 @@ static int dispatch_rw_block_io(struct xen_blkif *blkif,
 	switch (req_operation) {
 	case BLKIF_OP_READ:
 		blkif->st_rd_req++;
-		operation = READ;
+		operation = REQ_OP_READ;
 		break;
 	case BLKIF_OP_WRITE:
 		blkif->st_wr_req++;
-		operation = WRITE_ODIRECT;
+		operation = REQ_OP_WRITE;
+		operation_flags = WRITE_ODIRECT;
 		break;
 	case BLKIF_OP_WRITE_BARRIER:
 		drain = true;
 	case BLKIF_OP_FLUSH_DISKCACHE:
 		blkif->st_f_req++;
-		operation = WRITE_FLUSH;
+		operation = REQ_OP_WRITE;
+		operation_flags = WRITE_FLUSH;
 		break;
 	default:
 		operation = 0; /* make gcc happy */
@@ -1242,7 +1245,7 @@ static int dispatch_rw_block_io(struct xen_blkif *blkif,
 	nseg = req->operation == BLKIF_OP_INDIRECT ?
 	       req->u.indirect.nr_segments : req->u.rw.nr_segments;
 
-	if (unlikely(nseg == 0 && operation != WRITE_FLUSH) ||
+	if (unlikely(nseg == 0 && operation_flags != WRITE_FLUSH) ||
 	    unlikely((req->operation != BLKIF_OP_INDIRECT) &&
 		     (nseg > BLKIF_MAX_SEGMENTS_PER_REQUEST)) ||
 	    unlikely((req->operation == BLKIF_OP_INDIRECT) &&
@@ -1349,7 +1352,7 @@ static int dispatch_rw_block_io(struct xen_blkif *blkif,
 
 	/* This will be hit if the operation was a flush or discard. */
 	if (!bio) {
-		BUG_ON(operation != WRITE_FLUSH);
+		BUG_ON(operation_flags != WRITE_FLUSH);
 
 		bio = bio_alloc(GFP_KERNEL, 0);
 		if (unlikely(bio == NULL))
@@ -1365,14 +1368,14 @@ static int dispatch_rw_block_io(struct xen_blkif *blkif,
 	blk_start_plug(&plug);
 
 	for (i = 0; i < nbio; i++)
-		submit_bio(operation, biolist[i]);
+		submit_bio(operation | operation_flags, biolist[i]);
 
 	/* Let the I/Os go.. */
 	blk_finish_plug(&plug);
 
-	if (operation == READ)
+	if (operation == REQ_OP_READ)
 		blkif->st_rd_sect += preq.nr_sects;
-	else if (operation & WRITE)
+	else if (operation == REQ_OP_WRITE)
 		blkif->st_wr_sect += preq.nr_sects;
 
 	return 0;
-- 
1.8.3.1

  parent reply	other threads:[~2015-11-04 22:08 UTC|newest]

Thread overview: 52+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-11-04 22:07 [RESEND RFC PATCH 00/32] separate operations from flags in the bio/request structs mchristi
2015-11-04 22:07 ` [PATCH 01/32] block/fs: add REQ_OP definitions mchristi
2015-11-04 22:07 ` [PATCH 02/32] block/fs/mm: prepare submit_bio_wait users for bi_rw split mchristi
2015-11-05  7:14   ` Hannes Reinecke
2015-11-04 22:08 ` [PATCH 03/32] dio/btrfs: prep dio->submit_bio " mchristi
2015-11-04 22:08 ` [PATCH 04/32] block: prepare blkdev_issue_discard " mchristi
2015-11-04 22:08 ` [PATCH 05/32] drbd: prepare drbd " mchristi
2015-11-04 22:08 ` mchristi [this message]
     [not found]   ` <1446674909-5371-7-git-send-email-mchristi-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
2015-11-07 10:17     ` [PATCH 06/32] xen blkback: prepare " Christoph Hellwig
2015-11-07 10:17       ` Christoph Hellwig
2015-11-07 14:04       ` Konrad Rzeszutek Wilk
2015-11-07 14:04         ` Konrad Rzeszutek Wilk
2015-11-09  4:00       ` Bob Liu
2015-11-09  4:00         ` Bob Liu
2015-11-07 10:17   ` Christoph Hellwig
2015-11-04 22:08 ` [PATCH 07/32] dm: " mchristi
2015-11-04 22:08 ` [PATCH 08/32] target: " mchristi
2015-11-04 22:08 ` [PATCH 09/32] btrfs: " mchristi
2015-11-04 22:08 ` [PATCH 10/32] f2fs: " mchristi
2015-11-04 22:08 ` [PATCH 11/32] gfs2: " mchristi
2015-11-04 22:08 ` [PATCH 12/32] xfs: " mchristi
2015-11-04 22:08 ` [PATCH 13/32] mm: " mchristi
2015-11-04 22:08 ` [PATCH 14/32] block/fs/mm: pass in op and flags to submit_bio mchristi
2015-11-04 22:08 ` [PATCH 15/32] btrfs: prepare for bi_rw split mchristi
2015-11-04 22:08 ` [PATCH 16/32] block/fs/md: pass in op and flags to submit_bh mchristi
2015-11-04 22:08 ` [PATCH 17/32] block: add operation field to bio struct mchristi
2015-11-04 22:08 ` [PATCH 18/32] drbd: set bio bi_op to REQ_OP mchristi
2015-11-04 22:08 ` [PATCH 19/32] block: add helper to get data dir from op mchristi
     [not found]   ` <1446674909-5371-20-git-send-email-mchristi-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
2015-11-04 22:44     ` [dm-devel] " Bart Van Assche
2015-11-04 22:44       ` Bart Van Assche
2015-11-04 22:44       ` Bart Van Assche
2015-11-05 17:34       ` Mike Christie
     [not found]         ` <563B930F.7040705-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
2015-11-07 10:19           ` Christoph Hellwig
2015-11-07 10:19             ` Christoph Hellwig
2015-11-04 22:08 ` [PATCH 20/32] md: set bi_op to REQ_OP mchristi
2015-11-04 22:08 ` [PATCH 21/32] bcache: " mchristi
2015-11-04 22:08 ` [PATCH 22/32] block/fs/drivers: " mchristi
2015-11-04 22:08 ` [PATCH 23/32] block/fs: pass in op and flags to ll_rw_block mchristi
2015-11-04 22:08 ` [PATCH 24/32] dm: pass dm stats data dir instead of bi_rw mchristi
2015-11-04 22:08 ` [PATCH 25/32] block: add operation field to request struct mchristi
2015-11-04 22:08 ` [PATCH 26/32] ide cd: do not set REQ_WRITE on requests mchristi
2015-11-04 22:08 ` [PATCH 27/32] cfq/cgroup: pass operation and flags seperately mchristi
2015-11-04 22:08 ` [PATCH 28/32] block/fs/drivers: use bio/rq_data_dir helpers mchristi
2015-11-04 22:08 ` [PATCH 29/32] block/drivers: rm request cmd_flags REQ_OP use mchristi
2015-11-04 22:08 ` [PATCH 30/32] drbd: don't use bi_rw for operations mchristi
2015-11-04 22:08 ` [PATCH 31/32] block/fs/driver: rm bio bi_rw REQ_OP use mchristi
2015-11-04 22:08 ` [PATCH 32/32] block: remove __REQ op defs and reduce bi_op/bi_rw sizes mchristi
     [not found]   ` <1446674909-5371-33-git-send-email-mchristi-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
2015-11-07 10:21     ` Christoph Hellwig
2015-11-07 10:21       ` Christoph Hellwig
2015-11-05 16:44 ` [RESEND RFC PATCH 00/32] separate operations from flags in the bio/request structs Bob Peterson
2015-11-07 10:10 ` Christoph Hellwig
  -- strict thread matches above, loose matches on Subject: below --
2015-11-04 16:32 [RFC " mchristi
2015-11-04 16:33 ` [PATCH 06/32] xen blkback: prepare for bi_rw split mchristi

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=1446674909-5371-7-git-send-email-mchristi@redhat.com \
    --to=mchristi@redhat.com \
    --cc=dm-devel@redhat.com \
    --cc=drbd-dev@lists.linbit.com \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-raid@vger.kernel.org \
    --cc=linux-scsi@vger.kernel.org \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.