linux-fsdevel.vger.kernel.org archive mirror
 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 17/32] block: add operation field to bio struct
Date: Wed,  4 Nov 2015 16:08:14 -0600	[thread overview]
Message-ID: <1446674909-5371-18-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 adds field to the bio to store the REQ_OP, and it
has the block layer code set it.

The next patches will modify the other drivers and filesystems
to also set the bi_op. We are still ORing the op into the bi_rw.
When I am done with the conversion, that will be dropped.

Signed-off-by: Mike Christie <mchristi@redhat.com>
---
 block/bio.c               | 11 +++++++++--
 block/blk-core.c          |  1 +
 block/blk-map.c           |  4 +++-
 include/linux/blk_types.h |  8 +++++++-
 4 files changed, 20 insertions(+), 4 deletions(-)

diff --git a/block/bio.c b/block/bio.c
index ae91ccb..1cf8428 100644
--- a/block/bio.c
+++ b/block/bio.c
@@ -582,6 +582,7 @@ void __bio_clone_fast(struct bio *bio, struct bio *bio_src)
 	bio->bi_bdev = bio_src->bi_bdev;
 	bio_set_flag(bio, BIO_CLONED);
 	bio->bi_rw = bio_src->bi_rw;
+	bio->bi_op = bio_src->bi_op;
 	bio->bi_iter = bio_src->bi_iter;
 	bio->bi_io_vec = bio_src->bi_io_vec;
 }
@@ -664,6 +665,7 @@ struct bio *bio_clone_bioset(struct bio *bio_src, gfp_t gfp_mask,
 
 	bio->bi_bdev		= bio_src->bi_bdev;
 	bio->bi_rw		= bio_src->bi_rw;
+	bio->bi_op		= bio_src->bi_op;
 	bio->bi_iter.bi_sector	= bio_src->bi_iter.bi_sector;
 	bio->bi_iter.bi_size	= bio_src->bi_iter.bi_size;
 
@@ -1168,8 +1170,10 @@ struct bio *bio_copy_user_iov(struct request_queue *q,
 	if (!bio)
 		goto out_bmd;
 
-	if (iter->type & WRITE)
+	if (iter->type & WRITE) {
 		bio->bi_rw |= REQ_WRITE;
+		bio->bi_op = REQ_OP_WRITE;
+	}
 
 	ret = 0;
 
@@ -1338,8 +1342,10 @@ struct bio *bio_map_user_iov(struct request_queue *q,
 	/*
 	 * set data direction, and check if mapped pages need bouncing
 	 */
-	if (iter->type & WRITE)
+	if (iter->type & WRITE) {
 		bio->bi_rw |= REQ_WRITE;
+		bio->bi_op = REQ_OP_WRITE;
+	}
 
 	bio_set_flag(bio, BIO_USER_MAPPED);
 
@@ -1533,6 +1539,7 @@ struct bio *bio_copy_kern(struct request_queue *q, void *data, unsigned int len,
 	} else {
 		bio->bi_end_io = bio_copy_kern_endio;
 		bio->bi_rw |= REQ_WRITE;
+		bio->bi_op = REQ_OP_WRITE;
 	}
 
 	return bio;
diff --git a/block/blk-core.c b/block/blk-core.c
index d325ece..c8672f2 100644
--- a/block/blk-core.c
+++ b/block/blk-core.c
@@ -1988,6 +1988,7 @@ EXPORT_SYMBOL(generic_make_request);
 void submit_bio(int op, int flags, struct bio *bio)
 {
 	bio->bi_rw |= op | flags;
+	bio->bi_op = op;
 
 	/*
 	 * If it's a regular read/write or a barrier with data attached,
diff --git a/block/blk-map.c b/block/blk-map.c
index f565e11..4a91dc4 100644
--- a/block/blk-map.c
+++ b/block/blk-map.c
@@ -223,8 +223,10 @@ int blk_rq_map_kern(struct request_queue *q, struct request *rq, void *kbuf,
 	if (IS_ERR(bio))
 		return PTR_ERR(bio);
 
-	if (!reading)
+	if (!reading) {
 		bio->bi_rw |= REQ_WRITE;
+		bio->bi_op = REQ_OP_WRITE;
+	}
 
 	if (do_copy)
 		rq->cmd_flags |= REQ_COPY_USER;
diff --git a/include/linux/blk_types.h b/include/linux/blk_types.h
index d7b6009..b974aea 100644
--- a/include/linux/blk_types.h
+++ b/include/linux/blk_types.h
@@ -48,9 +48,15 @@ struct bio {
 	struct block_device	*bi_bdev;
 	unsigned int		bi_flags;	/* status, command, etc */
 	int			bi_error;
-	unsigned long		bi_rw;		/* bottom bits READ/WRITE,
+	unsigned long		bi_rw;		/* bottom bits rq_flags_bits
 						 * top bits priority
 						 */
+	/*
+	 * this will be a u8 in the next patches and bi_rw can be shrunk to
+	 * a u32. For compat in these transistional patches op is a int here.
+	 */
+	int			bi_op;		/* REQ_OP */
+
 
 	struct bvec_iter	bi_iter;
 
-- 
1.8.3.1

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

Thread overview: 42+ 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-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 ` [PATCH 06/32] xen blkback: prepare " mchristi
     [not found]   ` <1446674909-5371-7-git-send-email-mchristi-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
2015-11-07 10:17     ` Christoph Hellwig
2015-11-07 14:04       ` Konrad Rzeszutek Wilk
2015-11-09  4:00       ` Bob Liu
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 ` mchristi [this message]
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-05 17:34       ` Mike Christie
     [not found]         ` <563B930F.7040705-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
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-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

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-18-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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).