Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1262628

[PATCH 32/32] block: remove __REQ op defs and reduce bi_op/bi_rw sizes

From mchristi@redhat.com
Newsgroups linux.kernel
Subject [PATCH 32/32] block: remove __REQ op defs and reduce bi_op/bi_rw sizes
Date 2015-11-04 23:10 +0100
Message-ID <qrepI-6lw-13@gated-at.bofh.it> (permalink)
References <qrepI-6lw-3@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


From: Mike Christie <mchristi@redhat.com>

This patches removes the __REQ/REQ definitions for operations
now defined by REQ_OPs.

There is now no need for bi_rw to be a long, so this makes it a
int. I also moved the priority to its own field, but I guess I could
have just kept this in the bi_rw since there is only 16 bio related
REQ_XYZ flags.

bi_op is also no longer a bitmap, so it only needs to be a u8/char,
so that is changed too.

This is more of a RFC patch, because I still need to update the rest
of the block layer code that was treating bi_rw as a long and I can
also shrink the request->cmd_flags.

I was not sure if or how much or where people wanted to stick things.
There also appears to be room in the bi_flags field. If bi_flags is
only using 13 bits and there are only 16 REQ_XYZs bits related bios,
I could put them all in one variable if we wanted to go wild with trying
to shrink the bio while I am at it..

Signed-off-by: Mike Christie <mchristi@redhat.com>
---
 include/linux/bio.h         | 13 ++-----------
 include/linux/blk_types.h   | 23 ++++++-----------------
 include/trace/events/f2fs.h |  1 -
 3 files changed, 8 insertions(+), 29 deletions(-)

diff --git a/include/linux/bio.h b/include/linux/bio.h
index 7cbad7a..34a20cf 100644
--- a/include/linux/bio.h
+++ b/include/linux/bio.h
@@ -44,18 +44,9 @@
 #define BIO_MAX_SIZE		(BIO_MAX_PAGES << PAGE_CACHE_SHIFT)
 #define BIO_MAX_SECTORS		(BIO_MAX_SIZE >> 9)
 
-/*
- * upper 16 bits of bi_rw define the io priority of this bio
- */
-#define BIO_PRIO_SHIFT	(8 * sizeof(unsigned long) - IOPRIO_BITS)
-#define bio_prio(bio)	((bio)->bi_rw >> BIO_PRIO_SHIFT)
+#define bio_prio(bio)		(bio)->bi_ioprio
 #define bio_prio_valid(bio)	ioprio_valid(bio_prio(bio))
-
-#define bio_set_prio(bio, prio)		do {			\
-	WARN_ON(prio >= (1 << IOPRIO_BITS));			\
-	(bio)->bi_rw &= ((1UL << BIO_PRIO_SHIFT) - 1);		\
-	(bio)->bi_rw |= ((unsigned long) (prio) << BIO_PRIO_SHIFT);	\
-} while (0)
+#define bio_set_prio(bio, prio)	((bio)->bi_ioprio = prio)
 
 /*
  * various member access, note that bio_data should of course not be used
diff --git a/include/linux/blk_types.h b/include/linux/blk_types.h
index 581d353..c32ae3c 100644
--- a/include/linux/blk_types.h
+++ b/include/linux/blk_types.h
@@ -48,14 +48,9 @@ struct bio {
 	struct block_device	*bi_bdev;
 	unsigned int		bi_flags;	/* status, command, etc */
 	int			bi_error;
-	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 */
+	unsigned int		bi_rw;		/* rq_flags_bits */
+	unsigned short		bi_ioprio;
+	u8			bi_op;		/* REQ_OP */
 
 
 	struct bvec_iter	bi_iter;
@@ -151,7 +146,6 @@ struct bio {
  */
 enum rq_flag_bits {
 	/* common flags */
-	__REQ_WRITE,		/* not set, read. set, write */
 	__REQ_FAILFAST_DEV,	/* no driver retries of device errors */
 	__REQ_FAILFAST_TRANSPORT, /* no driver retries of transport errors */
 	__REQ_FAILFAST_DRIVER,	/* no driver retries of driver errors */
@@ -159,9 +153,7 @@ enum rq_flag_bits {
 	__REQ_SYNC,		/* request is sync (sync write or read) */
 	__REQ_META,		/* metadata io request */
 	__REQ_PRIO,		/* boost priority in cfq */
-	__REQ_DISCARD,		/* request to discard sectors */
-	__REQ_SECURE,		/* secure discard (used with __REQ_DISCARD) */
-	__REQ_WRITE_SAME,	/* write same block many times */
+	__REQ_SECURE,		/* secure discard (used with REQ_OP_DISCARD) */
 
 	__REQ_NOIDLE,		/* don't anticipate more IO after this one */
 	__REQ_INTEGRITY,	/* I/O includes block integrity payload */
@@ -198,15 +190,12 @@ enum rq_flag_bits {
 	__REQ_NR_BITS,		/* stops here */
 };
 
-#define REQ_WRITE		(1ULL << __REQ_WRITE)
 #define REQ_FAILFAST_DEV	(1ULL << __REQ_FAILFAST_DEV)
 #define REQ_FAILFAST_TRANSPORT	(1ULL << __REQ_FAILFAST_TRANSPORT)
 #define REQ_FAILFAST_DRIVER	(1ULL << __REQ_FAILFAST_DRIVER)
 #define REQ_SYNC		(1ULL << __REQ_SYNC)
 #define REQ_META		(1ULL << __REQ_META)
 #define REQ_PRIO		(1ULL << __REQ_PRIO)
-#define REQ_DISCARD		(1ULL << __REQ_DISCARD)
-#define REQ_WRITE_SAME		(1ULL << __REQ_WRITE_SAME)
 #define REQ_NOIDLE		(1ULL << __REQ_NOIDLE)
 #define REQ_INTEGRITY		(1ULL << __REQ_INTEGRITY)
 
@@ -250,8 +239,8 @@ enum rq_flag_bits {
 enum req_op {
 	REQ_OP_READ,
 	REQ_OP_WRITE,
-	REQ_OP_DISCARD,
-	REQ_OP_WRITE_SAME,
+	REQ_OP_DISCARD,		/* request to discard sectors */
+	REQ_OP_WRITE_SAME,	/* write same block many times */
 };
 
 #endif /* __LINUX_BLK_TYPES_H */
diff --git a/include/trace/events/f2fs.h b/include/trace/events/f2fs.h
index 0c7301b..2446a2f 100644
--- a/include/trace/events/f2fs.h
+++ b/include/trace/events/f2fs.h
@@ -31,7 +31,6 @@ TRACE_DEFINE_ENUM(BG_GC);
 TRACE_DEFINE_ENUM(LFS);
 TRACE_DEFINE_ENUM(SSR);
 TRACE_DEFINE_ENUM(__REQ_RAHEAD);
-TRACE_DEFINE_ENUM(__REQ_WRITE);
 TRACE_DEFINE_ENUM(__REQ_SYNC);
 TRACE_DEFINE_ENUM(__REQ_NOIDLE);
 TRACE_DEFINE_ENUM(__REQ_FLUSH);
-- 
1.8.3.1

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[RESEND RFC PATCH 00/32] separate operations from flags in the bio/request structs mchristi@redhat.com - 2015-11-04 23:10 +0100
  [PATCH 32/32] block: remove __REQ op defs and reduce bi_op/bi_rw sizes mchristi@redhat.com - 2015-11-04 23:10 +0100
    Re: [PATCH 32/32] block: remove __REQ op defs and reduce bi_op/bi_rw  sizes Christoph Hellwig <hch@infradead.org> - 2015-11-07 11:30 +0100
  [PATCH 11/32] gfs2: prepare for bi_rw split mchristi@redhat.com - 2015-11-04 23:10 +0100
  [PATCH 23/32] block/fs: pass in op and flags to ll_rw_block mchristi@redhat.com - 2015-11-04 23:10 +0100
  [PATCH 13/32] mm: prepare for bi_rw split mchristi@redhat.com - 2015-11-04 23:10 +0100
  [PATCH 24/32] dm: pass dm stats data dir instead of bi_rw mchristi@redhat.com - 2015-11-04 23:20 +0100
  [PATCH 21/32] bcache: set bi_op to REQ_OP mchristi@redhat.com - 2015-11-04 23:20 +0100
  [PATCH 27/32] cfq/cgroup: pass operation and flags seperately mchristi@redhat.com - 2015-11-04 23:20 +0100
  [PATCH 12/32] xfs: prepare for bi_rw split mchristi@redhat.com - 2015-11-04 23:20 +0100
  [PATCH 22/32] block/fs/drivers: set bi_op to REQ_OP mchristi@redhat.com - 2015-11-04 23:20 +0100
  [PATCH 20/32] md: set bi_op to REQ_OP mchristi@redhat.com - 2015-11-04 23:20 +0100
  [PATCH 30/32] drbd: don't use bi_rw for operations mchristi@redhat.com - 2015-11-04 23:20 +0100
  [PATCH 28/32] block/fs/drivers: use bio/rq_data_dir helpers mchristi@redhat.com - 2015-11-04 23:20 +0100
  [PATCH 18/32] drbd: set bio bi_op to REQ_OP mchristi@redhat.com - 2015-11-04 23:20 +0100
  [PATCH 26/32] ide cd: do not set REQ_WRITE on requests. mchristi@redhat.com - 2015-11-04 23:20 +0100
  [PATCH 25/32] block: add operation field to request struct mchristi@redhat.com - 2015-11-04 23:20 +0100
  [PATCH 19/32] block: add helper to get data dir from op mchristi@redhat.com - 2015-11-04 23:20 +0100
    Re: [dm-devel] [PATCH 19/32] block: add helper to get data dir from  op Mike Christie <mchristi@redhat.com> - 2015-11-05 18:40 +0100
      Re: [dm-devel] [PATCH 19/32] block: add helper to get data dir from  op Christoph Hellwig <hch@infradead.org> - 2015-11-07 11:20 +0100
  [PATCH 29/32] block/drivers: rm request cmd_flags REQ_OP use mchristi@redhat.com - 2015-11-04 23:20 +0100
  [PATCH 05/32] drbd: prepare drbd for bi_rw split mchristi@redhat.com - 2015-11-04 23:30 +0100
  [PATCH 03/32] dio/btrfs: prep dio->submit_bio users for bi_rw split. mchristi@redhat.com - 2015-11-04 23:30 +0100
  [PATCH 16/32] block/fs/md: pass in op and flags to submit_bh mchristi@redhat.com - 2015-11-04 23:30 +0100
  [PATCH 07/32] dm: prepare for bi_rw split mchristi@redhat.com - 2015-11-04 23:30 +0100
  [PATCH 10/32] f2fs: prepare for bi_rw split mchristi@redhat.com - 2015-11-04 23:30 +0100
  [PATCH 15/32] btrfs: prepare for bi_rw split mchristi@redhat.com - 2015-11-04 23:30 +0100
  [PATCH 08/32] target: prepare for bi_rw split mchristi@redhat.com - 2015-11-04 23:30 +0100
  [PATCH 17/32] block: add operation field to bio struct mchristi@redhat.com - 2015-11-04 23:30 +0100
  [PATCH 06/32] xen blkback: prepare for bi_rw split mchristi@redhat.com - 2015-11-04 23:30 +0100
  [PATCH 02/32] block/fs/mm: prepare submit_bio_wait users for bi_rw split mchristi@redhat.com - 2015-11-04 23:30 +0100
  [PATCH 14/32] block/fs/mm: pass in op and flags to submit_bio mchristi@redhat.com - 2015-11-04 23:30 +0100
  [PATCH 01/32] block/fs: add REQ_OP definitions. mchristi@redhat.com - 2015-11-04 23:40 +0100
  Re: [RESEND RFC PATCH 00/32] separate operations from flags in the  bio/request structs Bob Peterson <rpeterso@redhat.com> - 2015-11-05 17:50 +0100
  Re: [RESEND RFC PATCH 00/32] separate operations from flags in the  bio/request structs Christoph Hellwig <hch@infradead.org> - 2015-11-07 11:20 +0100

csiph-web