[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20141029182353.4879.67152.stgit@stg-AndroidDev-VirtualBox>
Date: Wed, 29 Oct 2014 11:23:53 -0700
From: "Jason B. Akers" <jason.b.akers@...el.com>
To: linux-ide@...r.kernel.org
Cc: axboe@...com, dan.j.williams@...el.com, kapil.karkra@...el.com,
linux-kernel@...r.kernel.org
Subject: [RFC PATCH 2/5] block: ioprio hint to low-level device drivers
From: Dan Williams <dan.j.williams@...el.com>
The priority in the io_context is consumed by the io scheduler. For
caching advice we need the request->ioprio field to be up-to-date. Set
the bio ioprio at submit time.
Signed-off-by: Dan Williams <dan.j.williams@...el.com>
Signed-off-by: Jason B. Akers <jason.b.akers@...el.com>
---
block/bio.c | 1 +
block/ioprio.c | 22 ++++++++++++++++------
2 files changed, 17 insertions(+), 6 deletions(-)
diff --git a/block/bio.c b/block/bio.c
index 3e6e198..e133b5c 100644
--- a/block/bio.c
+++ b/block/bio.c
@@ -2009,6 +2009,7 @@ int bio_associate_current(struct bio *bio)
/* acquire active ref on @ioc and associate */
get_io_context_active(ioc);
bio->bi_ioc = ioc;
+ bio_set_prio(bio, ioprio_best(ioc->ioprio, bio_prio(bio)));
/* associate blkcg if exists */
rcu_read_lock();
diff --git a/block/ioprio.c b/block/ioprio.c
index e50170c..fec1202 100644
--- a/block/ioprio.c
+++ b/block/ioprio.c
@@ -159,18 +159,28 @@ int ioprio_best(unsigned short aprio, unsigned short bprio)
{
unsigned short aclass = IOPRIO_PRIO_CLASS(aprio);
unsigned short bclass = IOPRIO_PRIO_CLASS(bprio);
+ unsigned short class, data, advice;
if (aclass == IOPRIO_CLASS_NONE)
aclass = IOPRIO_CLASS_BE;
if (bclass == IOPRIO_CLASS_NONE)
bclass = IOPRIO_CLASS_BE;
- if (aclass == bclass)
- return min(aprio, bprio);
- if (aclass > bclass)
- return bprio;
- else
- return aprio;
+ /* best priority */
+ if (aclass == bclass) {
+ class = aclass;
+ data = min(IOPRIO_PRIO_DATA(aprio), IOPRIO_PRIO_DATA(bprio));
+ } else if (aclass > bclass) {
+ class = bclass;
+ data = IOPRIO_PRIO_DATA(bprio);
+ } else {
+ class = aclass;
+ data = IOPRIO_PRIO_DATA(aprio);
+ }
+
+ /* best cache advice, assumes invalid advice is zero */
+ advice = max(IOPRIO_ADVICE(aprio), IOPRIO_ADVICE(bprio));
+ return IOPRIO_ADVISE(class, data, advice);
}
SYSCALL_DEFINE2(ioprio_get, int, which, int, who)
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists