summaryrefslogtreecommitdiff
path: root/block/bfq-cgroup.c
diff options
context:
space:
mode:
authorAndré Fabian Silva Delgado <emulatorman@parabola.nu>2016-10-20 00:10:27 -0300
committerAndré Fabian Silva Delgado <emulatorman@parabola.nu>2016-10-20 00:10:27 -0300
commitd0b2f91bede3bd5e3d24dd6803e56eee959c1797 (patch)
tree7fee4ab0509879c373c4f2cbd5b8a5be5b4041ee /block/bfq-cgroup.c
parente914f8eb445e8f74b00303c19c2ffceaedd16a05 (diff)
Linux-libre 4.8.2-gnupck-4.8.2-gnu
Diffstat (limited to 'block/bfq-cgroup.c')
-rw-r--r--block/bfq-cgroup.c54
1 files changed, 36 insertions, 18 deletions
diff --git a/block/bfq-cgroup.c b/block/bfq-cgroup.c
index 32cd8ab1c..569988bda 100644
--- a/block/bfq-cgroup.c
+++ b/block/bfq-cgroup.c
@@ -7,7 +7,9 @@
* Copyright (C) 2008 Fabio Checconi <fabio@gandalf.sssup.it>
* Paolo Valente <paolo.valente@unimore.it>
*
- * Copyright (C) 2010 Paolo Valente <paolo.valente@unimore.it>
+ * Copyright (C) 2015 Paolo Valente <paolo.valente@unimore.it>
+ *
+ * Copyright (C) 2016 Paolo Valente <paolo.valente@linaro.org>
*
* Licensed under the GPL-2 as detailed in the accompanying COPYING.BFQ
* file.
@@ -162,6 +164,7 @@ static struct blkcg_gq *bfqg_to_blkg(struct bfq_group *bfqg)
static struct bfq_group *blkg_to_bfqg(struct blkcg_gq *blkg)
{
struct blkg_policy_data *pd = blkg_to_pd(blkg, &blkcg_policy_bfq);
+
return pd_to_bfqg(pd);
}
@@ -205,34 +208,38 @@ static void bfqg_put(struct bfq_group *bfqg)
static void bfqg_stats_update_io_add(struct bfq_group *bfqg,
struct bfq_queue *bfqq,
- int rw)
+ int op, int op_flags)
{
- blkg_rwstat_add(&bfqg->stats.queued, rw, 1);
+ blkg_rwstat_add(&bfqg->stats.queued, op, op_flags, 1);
bfqg_stats_end_empty_time(&bfqg->stats);
if (!(bfqq == ((struct bfq_data *)bfqg->bfqd)->in_service_queue))
bfqg_stats_set_start_group_wait_time(bfqg, bfqq_group(bfqq));
}
-static void bfqg_stats_update_io_remove(struct bfq_group *bfqg, int rw)
+static void bfqg_stats_update_io_remove(struct bfq_group *bfqg, int op,
+ int op_flags)
{
- blkg_rwstat_add(&bfqg->stats.queued, rw, -1);
+ blkg_rwstat_add(&bfqg->stats.queued, op, op_flags, -1);
}
-static void bfqg_stats_update_io_merged(struct bfq_group *bfqg, int rw)
+static void bfqg_stats_update_io_merged(struct bfq_group *bfqg, int op,
+ int op_flags)
{
- blkg_rwstat_add(&bfqg->stats.merged, rw, 1);
+ blkg_rwstat_add(&bfqg->stats.merged, op, op_flags, 1);
}
static void bfqg_stats_update_completion(struct bfq_group *bfqg,
- uint64_t start_time, uint64_t io_start_time, int rw)
+ uint64_t start_time, uint64_t io_start_time, int op,
+ int op_flags)
{
struct bfqg_stats *stats = &bfqg->stats;
unsigned long long now = sched_clock();
if (time_after64(now, io_start_time))
- blkg_rwstat_add(&stats->service_time, rw, now - io_start_time);
+ blkg_rwstat_add(&stats->service_time, op, op_flags,
+ now - io_start_time);
if (time_after64(io_start_time, start_time))
- blkg_rwstat_add(&stats->wait_time, rw,
+ blkg_rwstat_add(&stats->wait_time, op, op_flags,
io_start_time - start_time);
}
@@ -600,6 +607,10 @@ static struct bfq_group *__bfq_bic_change_cgroup(struct bfq_data *bfqd,
lockdep_assert_held(bfqd->queue->queue_lock);
bfqg = bfq_find_set_group(bfqd, blkcg);
+
+ if (unlikely(!bfqg))
+ bfqg = bfqd->root_group;
+
if (async_bfqq) {
entity = &async_bfqq->entity;
@@ -1123,13 +1134,17 @@ static struct cftype bfq_blkg_files[] = {
#else /* CONFIG_BFQ_GROUP_IOSCHED */
static inline void bfqg_stats_update_io_add(struct bfq_group *bfqg,
- struct bfq_queue *bfqq, int rw) { }
-static inline void bfqg_stats_update_io_remove(struct bfq_group *bfqg, int rw) { }
-static inline void bfqg_stats_update_io_merged(struct bfq_group *bfqg, int rw) { }
+ struct bfq_queue *bfqq, int op, int op_flags) { }
+static inline void
+bfqg_stats_update_io_remove(struct bfq_group *bfqg, int op, int op_flags) { }
+static inline void
+bfqg_stats_update_io_merged(struct bfq_group *bfqg, int op, int op_flags) { }
static inline void bfqg_stats_update_completion(struct bfq_group *bfqg,
- uint64_t start_time, uint64_t io_start_time, int rw) { }
-static inline void bfqg_stats_set_start_group_wait_time(struct bfq_group *bfqg,
-struct bfq_group *curr_bfqg) { }
+ uint64_t start_time, uint64_t io_start_time, int op,
+ int op_flags) { }
+static inline void
+bfqg_stats_set_start_group_wait_time(struct bfq_group *bfqg,
+ struct bfq_group *curr_bfqg) { }
static inline void bfqg_stats_end_empty_time(struct bfqg_stats *stats) { }
static inline void bfqg_stats_update_dequeue(struct bfq_group *bfqg) { }
static inline void bfqg_stats_set_start_empty_time(struct bfq_group *bfqg) { }
@@ -1141,6 +1156,7 @@ static void bfq_init_entity(struct bfq_entity *entity,
struct bfq_group *bfqg)
{
struct bfq_queue *bfqq = bfq_entity_to_bfqq(entity);
+
entity->weight = entity->new_weight;
entity->orig_weight = entity->new_weight;
if (bfqq) {
@@ -1154,6 +1170,7 @@ static struct bfq_group *
bfq_bic_update_cgroup(struct bfq_io_cq *bic, struct bio *bio)
{
struct bfq_data *bfqd = bic_to_bfqd(bic);
+
return bfqd->root_group;
}
@@ -1163,7 +1180,7 @@ static void bfq_end_wr_async(struct bfq_data *bfqd)
}
static struct bfq_group *bfq_find_set_group(struct bfq_data *bfqd,
- struct blkcg *blkcg)
+ struct blkcg *blkcg)
{
return bfqd->root_group;
}
@@ -1173,7 +1190,8 @@ static struct bfq_group *bfqq_group(struct bfq_queue *bfqq)
return bfqq->bfqd->root_group;
}
-static struct bfq_group *bfq_create_group_hierarchy(struct bfq_data *bfqd, int node)
+static struct bfq_group *
+bfq_create_group_hierarchy(struct bfq_data *bfqd, int node)
{
struct bfq_group *bfqg;
int i;