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


Groups > linux.kernel > #1379721

[PATCH 32/42] block: convert is_sync helpers to use REQ_OPs.

From mchristi@redhat.com
Newsgroups linux.kernel
Subject [PATCH 32/42] block: convert is_sync helpers to use REQ_OPs.
Date 2016-04-15 13:00 +0200
Message-ID <ro9DJ-1Ev-29@gated-at.bofh.it> (permalink)
References <ro9u1-1AH-5@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


From: Mike Christie <mchristi@redhat.com>

This patch converts the is_sync helpers to use separate variables
for the operation and flags.

Signed-off-by: Mike Christie <mchristi@redhat.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Hannes Reinecke <hare@suse.com>
---
 block/blk-core.c       | 6 +++---
 block/blk-mq.c         | 8 ++++----
 block/cfq-iosched.c    | 2 +-
 include/linux/blkdev.h | 6 +++---
 4 files changed, 11 insertions(+), 11 deletions(-)

diff --git a/block/blk-core.c b/block/blk-core.c
index 660aeb8..e2f7b0a 100644
--- a/block/blk-core.c
+++ b/block/blk-core.c
@@ -962,7 +962,7 @@ static void __freed_request(struct request_list *rl, int sync)
 static void freed_request(struct request_list *rl, int op, unsigned int flags)
 {
 	struct request_queue *q = rl->q;
-	int sync = rw_is_sync(op | flags);
+	int sync = rw_is_sync(op, flags);
 
 	q->nr_rqs[sync]--;
 	rl->count[sync]--;
@@ -1075,7 +1075,7 @@ static struct request *__get_request(struct request_list *rl, int op,
 	struct elevator_type *et = q->elevator->type;
 	struct io_context *ioc = rq_ioc(bio);
 	struct io_cq *icq = NULL;
-	const bool is_sync = rw_is_sync(op | op_flags) != 0;
+	const bool is_sync = rw_is_sync(op, op_flags) != 0;
 	int may_queue;
 
 	if (unlikely(blk_queue_dying(q)))
@@ -1246,7 +1246,7 @@ static struct request *get_request(struct request_queue *q, int op,
 				   int op_flags, struct bio *bio,
 				   gfp_t gfp_mask)
 {
-	const bool is_sync = rw_is_sync(op | op_flags) != 0;
+	const bool is_sync = rw_is_sync(op, op_flags) != 0;
 	DEFINE_WAIT(wait);
 	struct request_list *rl;
 	struct request *rq;
diff --git a/block/blk-mq.c b/block/blk-mq.c
index 4843c0b..64d61be 100644
--- a/block/blk-mq.c
+++ b/block/blk-mq.c
@@ -206,7 +206,7 @@ static void blk_mq_rq_ctx_init(struct request_queue *q, struct blk_mq_ctx *ctx,
 	rq->end_io_data = NULL;
 	rq->next_rq = NULL;
 
-	ctx->rq_dispatched[rw_is_sync(op | op_flags)]++;
+	ctx->rq_dispatched[rw_is_sync(op, op_flags)]++;
 }
 
 static struct request *
@@ -1181,7 +1181,7 @@ static struct request *blk_mq_map_request(struct request_queue *q,
 	ctx = blk_mq_get_ctx(q);
 	hctx = q->mq_ops->map_queue(q, ctx->cpu);
 
-	if (rw_is_sync(bio->bi_op | bio->bi_rw))
+	if (rw_is_sync(bio->bi_op, bio->bi_rw))
 		op_flags |= REQ_SYNC;
 
 	trace_block_getrq(q, bio, op);
@@ -1249,7 +1249,7 @@ static int blk_mq_direct_issue_request(struct request *rq, blk_qc_t *cookie)
  */
 static blk_qc_t blk_mq_make_request(struct request_queue *q, struct bio *bio)
 {
-	const int is_sync = rw_is_sync(bio->bi_op | bio->bi_rw);
+	const int is_sync = rw_is_sync(bio->bi_op, bio->bi_rw);
 	const int is_flush_fua = bio->bi_rw & (REQ_FLUSH | REQ_FUA);
 	struct blk_map_ctx data;
 	struct request *rq;
@@ -1346,7 +1346,7 @@ done:
  */
 static blk_qc_t blk_sq_make_request(struct request_queue *q, struct bio *bio)
 {
-	const int is_sync = rw_is_sync(bio->bi_op | bio->bi_rw);
+	const int is_sync = rw_is_sync(bio->bi_op, bio->bi_rw);
 	const int is_flush_fua = bio->bi_rw & (REQ_FLUSH | REQ_FUA);
 	struct blk_plug *plug;
 	unsigned int request_count = 0;
diff --git a/block/cfq-iosched.c b/block/cfq-iosched.c
index 0dfa2dd..2fd5bcf 100644
--- a/block/cfq-iosched.c
+++ b/block/cfq-iosched.c
@@ -4311,7 +4311,7 @@ static int cfq_may_queue(struct request_queue *q, int op, int op_flags)
 	if (!cic)
 		return ELV_MQUEUE_MAY;
 
-	cfqq = cic_to_cfqq(cic, rw_is_sync(op | op_flags));
+	cfqq = cic_to_cfqq(cic, rw_is_sync(op, op_flags));
 	if (cfqq) {
 		cfq_init_prio_data(cfqq, cic);
 
diff --git a/include/linux/blkdev.h b/include/linux/blkdev.h
index 4aaa317..42711ef 100644
--- a/include/linux/blkdev.h
+++ b/include/linux/blkdev.h
@@ -617,14 +617,14 @@ static inline unsigned int blk_queue_cluster(struct request_queue *q)
 /*
  * We regard a request as sync, if either a read or a sync write
  */
-static inline bool rw_is_sync(unsigned int rw_flags)
+static inline bool rw_is_sync(int op, unsigned int rw_flags)
 {
-	return !(rw_flags & REQ_WRITE) || (rw_flags & REQ_SYNC);
+	return op == REQ_OP_READ || (rw_flags & REQ_SYNC);
 }
 
 static inline bool rq_is_sync(struct request *rq)
 {
-	return rw_is_sync(rq->cmd_flags);
+	return rw_is_sync(rq->op, rq->cmd_flags);
 }
 
 static inline bool blk_rl_full(struct request_list *rl, bool sync)
-- 
2.7.2

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


Thread

[PATCH 00/42] v6: separate operations from flags in the bio/request structs mchristi@redhat.com - 2016-04-15 12:50 +0200
  [PATCH 16/42] nilfs: set bi_op to REQ_OP mchristi@redhat.com - 2016-04-15 12:50 +0200
  [PATCH 10/42] btrfs: use bio fields for op and flags mchristi@redhat.com - 2016-04-15 12:50 +0200
  [PATCH 35/42] blktrace: get op from req->op/bio->bi_op mchristi@redhat.com - 2016-04-15 12:50 +0200
  [PATCH 05/42] fs: have ll_rw_block users pass in op and flags separately mchristi@redhat.com - 2016-04-15 12:50 +0200
  [PATCH 29/42] block: prepare elevator to use REQ_OPs. mchristi@redhat.com - 2016-04-15 12:50 +0200
  [PATCH 23/42] md/raid: set bi_op to REQ_OP mchristi@redhat.com - 2016-04-15 12:50 +0200
  [PATCH 38/42] block, fs: remove old REQ definitions. mchristi@redhat.com - 2016-04-15 12:50 +0200
  [PATCH 41/42] block: do not use REQ_FLUSH for tracking flush support mchristi@redhat.com - 2016-04-15 12:50 +0200
    Re: [PATCH 41/42] block: do not use REQ_FLUSH for tracking flush  support Juergen Gross <kernel@pfupf.net> - 2016-04-15 13:00 +0200
      Re: [PATCH 41/42] block: do not use REQ_FLUSH for tracking flush  support Mike Christie <mchristi@redhat.com> - 2016-04-15 21:00 +0200
  [PATCH 42/42] block, drivers, fs: rename REQ_FLUSH to REQ_PREFLUSH mchristi@redhat.com - 2016-04-15 12:50 +0200
  [PATCH 36/42] ide cd: do not set REQ_WRITE on requests. mchristi@redhat.com - 2016-04-15 12:50 +0200
  [PATCH 40/42] block, drivers: add REQ_OP_FLUSH operation mchristi@redhat.com - 2016-04-15 12:50 +0200
  [PATCH 19/42] dm: set bi_op to REQ_OP mchristi@redhat.com - 2016-04-15 12:50 +0200
  [PATCH 34/42] drivers: set request op to REQ_OP mchristi@redhat.com - 2016-04-15 13:00 +0200
  [PATCH 33/42] block: convert rq_data_dir helper to use REQ_OPs mchristi@redhat.com - 2016-04-15 13:00 +0200
  [PATCH 26/42] block: copy bio op to request op mchristi@redhat.com - 2016-04-15 13:00 +0200
  [PATCH 30/42] blkg_rwstat: separate op from flags mchristi@redhat.com - 2016-04-15 13:00 +0200
  [PATCH 37/42] block, fs, drivers: do use bi_rw/cmd_flags for REQ_OPs. mchristi@redhat.com - 2016-04-15 13:00 +0200
  [PATCH 32/42] block: convert is_sync helpers to use REQ_OPs. mchristi@redhat.com - 2016-04-15 13:00 +0200
  [PATCH 31/42] block: convert merge/insert code to check for REQ_OPs. mchristi@redhat.com - 2016-04-15 13:00 +0200
  [PATCH 22/42] drbd: set bi_op to REQ_OP mchristi@redhat.com - 2016-04-15 13:10 +0200
  [PATCH 27/42] block: prepare request creation/destruction code to use REQ_OPs mchristi@redhat.com - 2016-04-15 13:10 +0200
  [PATCH 28/42] block: prepare mq request creation to use REQ_OPs mchristi@redhat.com - 2016-04-15 13:10 +0200
  [PATCH 25/42] target: set bi_op to REQ_OP mchristi@redhat.com - 2016-04-15 13:10 +0200
  [PATCH 24/42] xen: set bi_op to REQ_OP mchristi@redhat.com - 2016-04-15 13:10 +0200
  [PATCH 21/42] bcache: set bi_op to REQ_OP mchristi@redhat.com - 2016-04-15 13:10 +0200
  [PATCH 08/42] btrfs: set bi_op tp REQ_OP mchristi@redhat.com - 2016-04-15 13:20 +0200
  [PATCH 20/42] dm: pass dm stats data dir instead of bi_rw mchristi@redhat.com - 2016-04-15 13:20 +0200
  [PATCH 12/42] gfs2: set bi_op to REQ_OP mchristi@redhat.com - 2016-04-15 13:20 +0200
  [PATCH 17/42] ocfs2: set bi_op to REQ_OP mchristi@redhat.com - 2016-04-15 13:20 +0200
  [PATCH 13/42] xfs: set bi_op to REQ_OP mchristi@redhat.com - 2016-04-15 13:20 +0200
  [PATCH 06/42] direct-io: set bi_op to REQ_OP mchristi@redhat.com - 2016-04-15 13:20 +0200
  [PATCH 07/42] btrfs: have submit_one_bio users setup bio bi_op mchristi@redhat.com - 2016-04-15 13:20 +0200
  [PATCH 11/42] f2fs: set bi_op to REQ_OP mchristi@redhat.com - 2016-04-15 13:20 +0200
  [PATCH 18/42] pm: set bi_op to REQ_OP mchristi@redhat.com - 2016-04-15 13:20 +0200
  [PATCH 09/42] btrfs: update __btrfs_map_block for bi_op transition mchristi@redhat.com - 2016-04-15 13:20 +0200
  [PATCH 15/42] mpage: set bi_op to REQ_OP mchristi@redhat.com - 2016-04-15 13:20 +0200
  [PATCH 03/42] block, fs, mm, drivers: set bi_op to REQ_OP mchristi@redhat.com - 2016-04-15 13:20 +0200
  [PATCH 14/42] hfsplus: set bi_op to REQ_OP mchristi@redhat.com - 2016-04-15 13:20 +0200
  [PATCH 04/42] fs: have submit_bh users pass in op and flags separately mchristi@redhat.com - 2016-04-15 13:20 +0200
    Re: [dm-devel] [PATCH 04/42] fs: have submit_bh users pass in op  and flags separately Ryusuke Konishi <konishi.ryusuke@lab.ntt.co.jp> - 2016-04-18 18:40 +0200
  [PATCH 02/42] block: add REQ_OP definitions and bi_op/op fields mchristi@redhat.com - 2016-04-15 13:30 +0200

csiph-web