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


Groups > linux.kernel > #1380153

[PATCH 29/42] block: prepare elevator to use REQ_OPs.

From mchristi@redhat.com
Newsgroups linux.kernel
Subject [PATCH 29/42] block: prepare elevator to use REQ_OPs.
Date 2016-04-15 21:20 +0200
Message-ID <rohrB-81o-45@gated-at.bofh.it> (permalink)
References <rohrA-81o-9@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 elevator code to use separate variables
for the operation and flags, and to check request->op for the REQ_OP.

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         | 2 +-
 block/cfq-iosched.c      | 4 ++--
 block/elevator.c         | 7 +++----
 include/linux/elevator.h | 4 ++--
 4 files changed, 8 insertions(+), 9 deletions(-)

diff --git a/block/blk-core.c b/block/blk-core.c
index 3168962..a796b35 100644
--- a/block/blk-core.c
+++ b/block/blk-core.c
@@ -1081,7 +1081,7 @@ static struct request *__get_request(struct request_list *rl, int op,
 	if (unlikely(blk_queue_dying(q)))
 		return ERR_PTR(-ENODEV);
 
-	may_queue = elv_may_queue(q, op | op_flags);
+	may_queue = elv_may_queue(q, op, op_flags);
 	if (may_queue == ELV_MQUEUE_NO)
 		goto rq_starved;
 
diff --git a/block/cfq-iosched.c b/block/cfq-iosched.c
index 4a34978..3fcc598 100644
--- a/block/cfq-iosched.c
+++ b/block/cfq-iosched.c
@@ -4285,7 +4285,7 @@ static inline int __cfq_may_queue(struct cfq_queue *cfqq)
 	return ELV_MQUEUE_MAY;
 }
 
-static int cfq_may_queue(struct request_queue *q, int rw)
+static int cfq_may_queue(struct request_queue *q, int op, int op_flags)
 {
 	struct cfq_data *cfqd = q->elevator->elevator_data;
 	struct task_struct *tsk = current;
@@ -4302,7 +4302,7 @@ static int cfq_may_queue(struct request_queue *q, int rw)
 	if (!cic)
 		return ELV_MQUEUE_MAY;
 
-	cfqq = cic_to_cfqq(cic, rw_is_sync(rw));
+	cfqq = cic_to_cfqq(cic, rw_is_sync(op | op_flags));
 	if (cfqq) {
 		cfq_init_prio_data(cfqq, cic);
 
diff --git a/block/elevator.c b/block/elevator.c
index c3555c9..6a282bf 100644
--- a/block/elevator.c
+++ b/block/elevator.c
@@ -366,8 +366,7 @@ void elv_dispatch_sort(struct request_queue *q, struct request *rq)
 	list_for_each_prev(entry, &q->queue_head) {
 		struct request *pos = list_entry_rq(entry);
 
-		if ((rq->cmd_flags & REQ_DISCARD) !=
-		    (pos->cmd_flags & REQ_DISCARD))
+		if ((rq->op == REQ_OP_DISCARD) != (pos->op == REQ_OP_DISCARD))
 			break;
 		if (rq_data_dir(rq) != rq_data_dir(pos))
 			break;
@@ -717,12 +716,12 @@ void elv_put_request(struct request_queue *q, struct request *rq)
 		e->type->ops.elevator_put_req_fn(rq);
 }
 
-int elv_may_queue(struct request_queue *q, int rw)
+int elv_may_queue(struct request_queue *q, int op, int op_flags)
 {
 	struct elevator_queue *e = q->elevator;
 
 	if (e->type->ops.elevator_may_queue_fn)
-		return e->type->ops.elevator_may_queue_fn(q, rw);
+		return e->type->ops.elevator_may_queue_fn(q, op, op_flags);
 
 	return ELV_MQUEUE_MAY;
 }
diff --git a/include/linux/elevator.h b/include/linux/elevator.h
index 638b324..953d286 100644
--- a/include/linux/elevator.h
+++ b/include/linux/elevator.h
@@ -26,7 +26,7 @@ typedef int (elevator_dispatch_fn) (struct request_queue *, int);
 typedef void (elevator_add_req_fn) (struct request_queue *, struct request *);
 typedef struct request *(elevator_request_list_fn) (struct request_queue *, struct request *);
 typedef void (elevator_completed_req_fn) (struct request_queue *, struct request *);
-typedef int (elevator_may_queue_fn) (struct request_queue *, int);
+typedef int (elevator_may_queue_fn) (struct request_queue *, int, int);
 
 typedef void (elevator_init_icq_fn) (struct io_cq *);
 typedef void (elevator_exit_icq_fn) (struct io_cq *);
@@ -134,7 +134,7 @@ extern struct request *elv_former_request(struct request_queue *, struct request
 extern struct request *elv_latter_request(struct request_queue *, struct request *);
 extern int elv_register_queue(struct request_queue *q);
 extern void elv_unregister_queue(struct request_queue *q);
-extern int elv_may_queue(struct request_queue *, int);
+extern int elv_may_queue(struct request_queue *, int, int);
 extern void elv_completed_request(struct request_queue *, struct request *);
 extern int elv_set_request(struct request_queue *q, struct request *rq,
 			   struct bio *bio, gfp_t gfp_mask);
-- 
2.7.2

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


Thread

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

csiph-web