diff mbox

Re: [PATCH] io-controller: Add io group reference handling for request

Message ID 4A0D1C55.9040700@cn.fujitsu.com (mailing list archive)
State New, archived
Headers show

Commit Message

Gui Jianfeng May 15, 2009, 7:40 a.m. UTC
Vivek Goyal wrote:
...
> Ok, here is the patch which gets rid of rq->iog and rq->rl fields. Good to
> see some code and data structures trimming. It seems to be working fine for me.
> 
> 
> o Get rid of rq->iog field and rq->rl fields. request descriptor stores
>   the pointer the the queue it belongs to (rq->ioq) and from the io queue one
>   can determine the group queue belongs to hence request belongs to. Thanks
>   to Nauman for the idea.
> 
> o There are couple of places where rq->ioq information is not present yet
>   as request and queue are being setup. In those places "bio" is passed 
>   around as function argument to determine the group rq will go into. I
>   did not pass "iog" as function argument becuase when memory is scarce,
>   we can release queue lock and sleep to wait for memory to become available
>   and once we wake up, it is possible that io group is gone. Passing bio
>   around helps that one shall have to remap bio to right group after waking
>   up. 
> 
> o Got rid of io_lookup_io_group_current() function and merged it with
>   io_get_io_group() to also take care of looking for group using current
>   task info and not from bio.

Hi Vivek,

This patch gets rid of "curr" from io_get_io_group, and seems to be 
working fine for me.

Signed-off-by: Gui Jianfeng <guijianfeng@cn.fujitsu.com>
---
 block/cfq-iosched.c |   12 ++++++------
 block/elevator-fq.c |   16 ++++++++--------
 block/elevator-fq.h |    2 +-
 3 files changed, 15 insertions(+), 15 deletions(-)
diff mbox

Patch

diff --git a/block/cfq-iosched.c b/block/cfq-iosched.c
index c0bb8db..bf87843 100644
--- a/block/cfq-iosched.c
+++ b/block/cfq-iosched.c
@@ -196,7 +196,7 @@  static struct cfq_queue *cic_bio_to_cfqq(struct cfq_data *cfqd,
 		 * async bio tracking is enabled and we are not caching
 		 * async queue pointer in cic.
 		 */
-		iog = io_get_io_group(cfqd->queue, bio, 0, 0);
+		iog = io_get_io_group(cfqd->queue, bio, 0);
 		if (!iog) {
 			/*
 			 * May be this is first rq/bio and io group has not
@@ -1294,7 +1294,7 @@  static void changed_cgroup(struct io_context *ioc, struct cfq_io_context *cic)
 
 	spin_lock_irqsave(q->queue_lock, flags);
 
-	iog = io_get_io_group(q, NULL, 0, 1);
+	iog = io_get_io_group(q, NULL, 0);
 
 	if (async_cfqq != NULL) {
 		__iog = cfqq_to_io_group(async_cfqq);
@@ -1346,9 +1346,9 @@  retry:
 	 * back.
 	 */
 	if (bio)
-		iog = io_get_io_group(q, bio, 1, 0);
+		iog = io_get_io_group(q, bio, 1);
 	else
-		iog = io_get_io_group(q, NULL, 1, 1);
+		iog = io_get_io_group(q, NULL, 1);
 
 	cic = cfq_cic_lookup(cfqd, ioc);
 	/* cic always exists here */
@@ -1469,9 +1469,9 @@  cfq_get_queue(struct cfq_data *cfqd, struct bio *bio, int is_sync,
 	struct io_group *iog = NULL;
 
 	if (bio)
-		iog = io_get_io_group(cfqd->queue, bio, 1, 0);
+		iog = io_get_io_group(cfqd->queue, bio, 1);
 	else
-		iog = io_get_io_group(cfqd->queue, NULL, 1, 1);
+		iog = io_get_io_group(cfqd->queue, NULL, 1);
 
 	if (!is_sync) {
 		async_cfqq = io_group_async_queue_prio(iog, ioprio_class,
diff --git a/block/elevator-fq.c b/block/elevator-fq.c
index 9b7319e..951c163 100644
--- a/block/elevator-fq.c
+++ b/block/elevator-fq.c
@@ -1006,7 +1006,7 @@  struct request_list *io_group_get_request_list(struct request_queue *q,
 {
 	struct io_group *iog;
 
-	iog = io_get_io_group(q, bio, 1, 0);
+	iog = io_get_io_group(q, bio, 1);
 	BUG_ON(!iog);
 	return &iog->rl;
 }
@@ -1470,7 +1470,7 @@  struct io_cgroup *get_iocg_from_bio(struct bio *bio)
  *
  */
 struct io_group *io_get_io_group(struct request_queue *q, struct bio *bio,
-					int create, int curr)
+					int create)
 {
 	struct cgroup *cgroup;
 	struct io_group *iog;
@@ -1478,7 +1478,7 @@  struct io_group *io_get_io_group(struct request_queue *q, struct bio *bio,
 
 	rcu_read_lock();
 
-	if (curr)
+	if (!bio)
 		cgroup = task_cgroup(current, io_subsys_id);
 	else
 		cgroup = get_cgroup_from_bio(bio);
@@ -1959,7 +1959,7 @@  int io_group_allow_merge(struct request *rq, struct bio *bio)
 		return 1;
 
 	/* Determine the io group of the bio submitting task */
-	iog = io_get_io_group(q, bio, 0, 0);
+	iog = io_get_io_group(q, bio, 0);
 	if (!iog) {
 		/* May be task belongs to a differet cgroup for which io
 		 * group has not been setup yet. */
@@ -2000,9 +2000,9 @@  int elv_fq_set_request_ioq(struct request_queue *q, struct request *rq,
 retry:
 	/* Determine the io group request belongs to */
 	if (bio)
-		iog = io_get_io_group(q, bio, 1, 0);
+		iog = io_get_io_group(q, bio, 1);
 	else
-		iog = io_get_io_group(q, bio, 1, 1);
+		iog = io_get_io_group(q, NULL, 1);
 
 	BUG_ON(!iog);
 
@@ -2098,7 +2098,7 @@  struct io_queue *elv_lookup_ioq_bio(struct request_queue *q, struct bio *bio)
 	struct io_group *iog;
 
 	/* lookup the io group and io queue of the bio submitting task */
-	iog = io_get_io_group(q, bio, 0, 0);
+	iog = io_get_io_group(q, bio, 0);
 	if (!iog) {
 		/* May be bio belongs to a cgroup for which io group has
 		 * not been setup yet. */
@@ -2159,7 +2159,7 @@  struct io_group *io_lookup_io_group_current(struct request_queue *q)
 EXPORT_SYMBOL(io_lookup_io_group_current);
 
 struct io_group *io_get_io_group(struct request_queue *q, struct bio *bio,
-					int create, int curr)
+					int create)
 {
 	return q->elevator->efqd.root_group;
 }
diff --git a/block/elevator-fq.h b/block/elevator-fq.h
index 8d190ab..d8d8f61 100644
--- a/block/elevator-fq.h
+++ b/block/elevator-fq.h
@@ -657,7 +657,7 @@  extern void io_group_set_async_queue(struct io_group *iog, int ioprio_class,
 					int ioprio, struct io_queue *ioq);
 extern struct io_group *io_lookup_io_group_current(struct request_queue *q);
 extern struct io_group *io_get_io_group(struct request_queue *q,
-				struct bio *bio, int create, int curr);
+				struct bio *bio, int create);
 extern int elv_nr_busy_ioq(struct elevator_queue *e);
 extern int elv_nr_busy_rt_ioq(struct elevator_queue *e);
 extern struct io_queue *elv_alloc_ioq(struct request_queue *q, gfp_t gfp_mask);