aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTejun Heo <tj@kernel.org>2012-04-01 17:38:44 -0400
committerTejun Heo <tj@kernel.org>2012-04-01 17:38:44 -0400
commitd366e7ec41882791c970dfb7c67b737be8c3a174 (patch)
tree78d3c73d90276b797e1553c004272af869a30075
parentaf133ceb261033eb43c03d161a991c3b772e8c56 (diff)
blkcg: pass around pd->pdata instead of pd itself in prfill functions
Now that all conf and stat fields are moved into policy specific blkio_policy_data->pdata areas, there's no reason to use blkio_policy_data itself in prfill functions. Pass around @pd->pdata instead of @pd. Signed-off-by: Tejun Heo <tj@kernel.org>
-rw-r--r--block/blk-cgroup.c33
-rw-r--r--block/blk-cgroup.h6
-rw-r--r--block/blk-throttle.c21
-rw-r--r--block/cfq-iosched.c14
4 files changed, 33 insertions, 41 deletions
diff --git a/block/blk-cgroup.c b/block/blk-cgroup.c
index c0e239b8455e..7de19d7954c7 100644
--- a/block/blk-cgroup.c
+++ b/block/blk-cgroup.c
@@ -359,7 +359,7 @@ static const char *blkg_dev_name(struct blkio_group *blkg)
359 * cftype->read_seq_string method. 359 * cftype->read_seq_string method.
360 */ 360 */
361void blkcg_print_blkgs(struct seq_file *sf, struct blkio_cgroup *blkcg, 361void blkcg_print_blkgs(struct seq_file *sf, struct blkio_cgroup *blkcg,
362 u64 (*prfill)(struct seq_file *, struct blkg_policy_data *, int), 362 u64 (*prfill)(struct seq_file *, void *, int),
363 int pol, int data, bool show_total) 363 int pol, int data, bool show_total)
364{ 364{
365 struct blkio_group *blkg; 365 struct blkio_group *blkg;
@@ -369,7 +369,7 @@ void blkcg_print_blkgs(struct seq_file *sf, struct blkio_cgroup *blkcg,
369 spin_lock_irq(&blkcg->lock); 369 spin_lock_irq(&blkcg->lock);
370 hlist_for_each_entry(blkg, n, &blkcg->blkg_list, blkcg_node) 370 hlist_for_each_entry(blkg, n, &blkcg->blkg_list, blkcg_node)
371 if (blkg->pd[pol]) 371 if (blkg->pd[pol])
372 total += prfill(sf, blkg->pd[pol], data); 372 total += prfill(sf, blkg->pd[pol]->pdata, data);
373 spin_unlock_irq(&blkcg->lock); 373 spin_unlock_irq(&blkcg->lock);
374 374
375 if (show_total) 375 if (show_total)
@@ -380,14 +380,14 @@ EXPORT_SYMBOL_GPL(blkcg_print_blkgs);
380/** 380/**
381 * __blkg_prfill_u64 - prfill helper for a single u64 value 381 * __blkg_prfill_u64 - prfill helper for a single u64 value
382 * @sf: seq_file to print to 382 * @sf: seq_file to print to
383 * @pd: policy data of interest 383 * @pdata: policy private data of interest
384 * @v: value to print 384 * @v: value to print
385 * 385 *
386 * Print @v to @sf for the device assocaited with @pd. 386 * Print @v to @sf for the device assocaited with @pdata.
387 */ 387 */
388u64 __blkg_prfill_u64(struct seq_file *sf, struct blkg_policy_data *pd, u64 v) 388u64 __blkg_prfill_u64(struct seq_file *sf, void *pdata, u64 v)
389{ 389{
390 const char *dname = blkg_dev_name(pd->blkg); 390 const char *dname = blkg_dev_name(pdata_to_blkg(pdata));
391 391
392 if (!dname) 392 if (!dname)
393 return 0; 393 return 0;
@@ -400,12 +400,12 @@ EXPORT_SYMBOL_GPL(__blkg_prfill_u64);
400/** 400/**
401 * __blkg_prfill_rwstat - prfill helper for a blkg_rwstat 401 * __blkg_prfill_rwstat - prfill helper for a blkg_rwstat
402 * @sf: seq_file to print to 402 * @sf: seq_file to print to
403 * @pd: policy data of interest 403 * @pdata: policy private data of interest
404 * @rwstat: rwstat to print 404 * @rwstat: rwstat to print
405 * 405 *
406 * Print @rwstat to @sf for the device assocaited with @pd. 406 * Print @rwstat to @sf for the device assocaited with @pdata.
407 */ 407 */
408u64 __blkg_prfill_rwstat(struct seq_file *sf, struct blkg_policy_data *pd, 408u64 __blkg_prfill_rwstat(struct seq_file *sf, void *pdata,
409 const struct blkg_rwstat *rwstat) 409 const struct blkg_rwstat *rwstat)
410{ 410{
411 static const char *rwstr[] = { 411 static const char *rwstr[] = {
@@ -414,7 +414,7 @@ u64 __blkg_prfill_rwstat(struct seq_file *sf, struct blkg_policy_data *pd,
414 [BLKG_RWSTAT_SYNC] = "Sync", 414 [BLKG_RWSTAT_SYNC] = "Sync",
415 [BLKG_RWSTAT_ASYNC] = "Async", 415 [BLKG_RWSTAT_ASYNC] = "Async",
416 }; 416 };
417 const char *dname = blkg_dev_name(pd->blkg); 417 const char *dname = blkg_dev_name(pdata_to_blkg(pdata));
418 u64 v; 418 u64 v;
419 int i; 419 int i;
420 420
@@ -430,19 +430,16 @@ u64 __blkg_prfill_rwstat(struct seq_file *sf, struct blkg_policy_data *pd,
430 return v; 430 return v;
431} 431}
432 432
433static u64 blkg_prfill_stat(struct seq_file *sf, struct blkg_policy_data *pd, 433static u64 blkg_prfill_stat(struct seq_file *sf, void *pdata, int off)
434 int off)
435{ 434{
436 return __blkg_prfill_u64(sf, pd, 435 return __blkg_prfill_u64(sf, pdata, blkg_stat_read(pdata + off));
437 blkg_stat_read((void *)pd->pdata + off));
438} 436}
439 437
440static u64 blkg_prfill_rwstat(struct seq_file *sf, struct blkg_policy_data *pd, 438static u64 blkg_prfill_rwstat(struct seq_file *sf, void *pdata, int off)
441 int off)
442{ 439{
443 struct blkg_rwstat rwstat = blkg_rwstat_read((void *)pd->pdata + off); 440 struct blkg_rwstat rwstat = blkg_rwstat_read(pdata + off);
444 441
445 return __blkg_prfill_rwstat(sf, pd, &rwstat); 442 return __blkg_prfill_rwstat(sf, pdata, &rwstat);
446} 443}
447 444
448/* print blkg_stat specified by BLKCG_STAT_PRIV() */ 445/* print blkg_stat specified by BLKCG_STAT_PRIV() */
diff --git a/block/blk-cgroup.h b/block/blk-cgroup.h
index a77ab1ac53a7..c930895bfac9 100644
--- a/block/blk-cgroup.h
+++ b/block/blk-cgroup.h
@@ -126,10 +126,10 @@ extern void update_root_blkg_pd(struct request_queue *q,
126 enum blkio_policy_id plid); 126 enum blkio_policy_id plid);
127 127
128void blkcg_print_blkgs(struct seq_file *sf, struct blkio_cgroup *blkcg, 128void blkcg_print_blkgs(struct seq_file *sf, struct blkio_cgroup *blkcg,
129 u64 (*prfill)(struct seq_file *, struct blkg_policy_data *, int), 129 u64 (*prfill)(struct seq_file *, void *, int),
130 int pol, int data, bool show_total); 130 int pol, int data, bool show_total);
131u64 __blkg_prfill_u64(struct seq_file *sf, struct blkg_policy_data *pd, u64 v); 131u64 __blkg_prfill_u64(struct seq_file *sf, void *pdata, u64 v);
132u64 __blkg_prfill_rwstat(struct seq_file *sf, struct blkg_policy_data *pd, 132u64 __blkg_prfill_rwstat(struct seq_file *sf, void *pdata,
133 const struct blkg_rwstat *rwstat); 133 const struct blkg_rwstat *rwstat);
134int blkcg_print_stat(struct cgroup *cgrp, struct cftype *cft, 134int blkcg_print_stat(struct cgroup *cgrp, struct cftype *cft,
135 struct seq_file *sf); 135 struct seq_file *sf);
diff --git a/block/blk-throttle.c b/block/blk-throttle.c
index 004964bb6fdd..bd6dbfe1e4e9 100644
--- a/block/blk-throttle.c
+++ b/block/blk-throttle.c
@@ -924,10 +924,9 @@ throtl_schedule_delayed_work(struct throtl_data *td, unsigned long delay)
924 } 924 }
925} 925}
926 926
927static u64 tg_prfill_cpu_rwstat(struct seq_file *sf, 927static u64 tg_prfill_cpu_rwstat(struct seq_file *sf, void *pdata, int off)
928 struct blkg_policy_data *pd, int off)
929{ 928{
930 struct throtl_grp *tg = (void *)pd->pdata; 929 struct throtl_grp *tg = pdata;
931 struct blkg_rwstat rwstat = { }, tmp; 930 struct blkg_rwstat rwstat = { }, tmp;
932 int i, cpu; 931 int i, cpu;
933 932
@@ -939,7 +938,7 @@ static u64 tg_prfill_cpu_rwstat(struct seq_file *sf,
939 rwstat.cnt[i] += tmp.cnt[i]; 938 rwstat.cnt[i] += tmp.cnt[i];
940 } 939 }
941 940
942 return __blkg_prfill_rwstat(sf, pd, &rwstat); 941 return __blkg_prfill_rwstat(sf, pdata, &rwstat);
943} 942}
944 943
945/* print per-cpu blkg_rwstat specified by BLKCG_STAT_PRIV() */ 944/* print per-cpu blkg_rwstat specified by BLKCG_STAT_PRIV() */
@@ -954,24 +953,22 @@ static int tg_print_cpu_rwstat(struct cgroup *cgrp, struct cftype *cft,
954 return 0; 953 return 0;
955} 954}
956 955
957static u64 tg_prfill_conf_u64(struct seq_file *sf, struct blkg_policy_data *pd, 956static u64 tg_prfill_conf_u64(struct seq_file *sf, void *pdata, int off)
958 int off)
959{ 957{
960 u64 v = *(u64 *)((void *)pd->pdata + off); 958 u64 v = *(u64 *)(pdata + off);
961 959
962 if (v == -1) 960 if (v == -1)
963 return 0; 961 return 0;
964 return __blkg_prfill_u64(sf, pd, v); 962 return __blkg_prfill_u64(sf, pdata, v);
965} 963}
966 964
967static u64 tg_prfill_conf_uint(struct seq_file *sf, struct blkg_policy_data *pd, 965static u64 tg_prfill_conf_uint(struct seq_file *sf, void *pdata, int off)
968 int off)
969{ 966{
970 unsigned int v = *(unsigned int *)((void *)pd->pdata + off); 967 unsigned int v = *(unsigned int *)(pdata + off);
971 968
972 if (v == -1) 969 if (v == -1)
973 return 0; 970 return 0;
974 return __blkg_prfill_u64(sf, pd, v); 971 return __blkg_prfill_u64(sf, pdata, v);
975} 972}
976 973
977static int tg_print_conf_u64(struct cgroup *cgrp, struct cftype *cft, 974static int tg_print_conf_u64(struct cgroup *cgrp, struct cftype *cft,
diff --git a/block/cfq-iosched.c b/block/cfq-iosched.c
index adab10de6eea..fd505f721f61 100644
--- a/block/cfq-iosched.c
+++ b/block/cfq-iosched.c
@@ -1368,14 +1368,13 @@ static void cfq_link_cfqq_cfqg(struct cfq_queue *cfqq, struct cfq_group *cfqg)
1368 cfqg_get(cfqg); 1368 cfqg_get(cfqg);
1369} 1369}
1370 1370
1371static u64 cfqg_prfill_weight_device(struct seq_file *sf, 1371static u64 cfqg_prfill_weight_device(struct seq_file *sf, void *pdata, int off)
1372 struct blkg_policy_data *pd, int off)
1373{ 1372{
1374 struct cfq_group *cfqg = (void *)pd->pdata; 1373 struct cfq_group *cfqg = pdata;
1375 1374
1376 if (!cfqg->dev_weight) 1375 if (!cfqg->dev_weight)
1377 return 0; 1376 return 0;
1378 return __blkg_prfill_u64(sf, pd, cfqg->dev_weight); 1377 return __blkg_prfill_u64(sf, pdata, cfqg->dev_weight);
1379} 1378}
1380 1379
1381static int cfqg_print_weight_device(struct cgroup *cgrp, struct cftype *cft, 1380static int cfqg_print_weight_device(struct cgroup *cgrp, struct cftype *cft,
@@ -1443,10 +1442,9 @@ static int cfq_set_weight(struct cgroup *cgrp, struct cftype *cft, u64 val)
1443} 1442}
1444 1443
1445#ifdef CONFIG_DEBUG_BLK_CGROUP 1444#ifdef CONFIG_DEBUG_BLK_CGROUP
1446static u64 cfqg_prfill_avg_queue_size(struct seq_file *sf, 1445static u64 cfqg_prfill_avg_queue_size(struct seq_file *sf, void *pdata, int off)
1447 struct blkg_policy_data *pd, int off)
1448{ 1446{
1449 struct cfq_group *cfqg = (void *)pd->pdata; 1447 struct cfq_group *cfqg = pdata;
1450 u64 samples = blkg_stat_read(&cfqg->stats.avg_queue_size_samples); 1448 u64 samples = blkg_stat_read(&cfqg->stats.avg_queue_size_samples);
1451 u64 v = 0; 1449 u64 v = 0;
1452 1450
@@ -1454,7 +1452,7 @@ static u64 cfqg_prfill_avg_queue_size(struct seq_file *sf,
1454 v = blkg_stat_read(&cfqg->stats.avg_queue_size_sum); 1452 v = blkg_stat_read(&cfqg->stats.avg_queue_size_sum);
1455 do_div(v, samples); 1453 do_div(v, samples);
1456 } 1454 }
1457 __blkg_prfill_u64(sf, pd, v); 1455 __blkg_prfill_u64(sf, pdata, v);
1458 return 0; 1456 return 0;
1459} 1457}
1460 1458