* [PATCH] block/throttle: Call throtl_update_dispatch_stats with throtl_grp directly.
@ 2012-08-31 5:08 Tao Ma
2012-09-04 12:44 ` Vivek Goyal
0 siblings, 1 reply; 2+ messages in thread
From: Tao Ma @ 2012-08-31 5:08 UTC (permalink / raw)
To: linux-kernel; +Cc: Tejun Heo, Vivek Goyal, Jens Axboe
From: Tao Ma <boyu.mt@taobao.com>
All callers of throtl_update_dispatch_stats uses tg_to_blkg and then
in this function we use blkg_to_tg again to change it back. So remove
all these useless conversion and use throtl_grp directly to call
throtl_update_dispatch_stats.
Cc: Tejun Heo <tj@kernel.org>
Cc: Vivek Goyal <vgoyal@redhat.com>
Cc: Jens Axboe <axboe@kernel.dk>
Signed-off-by: Tao Ma <boyu.mt@taobao.com>
---
block/blk-throttle.c | 7 +++----
1 files changed, 3 insertions(+), 4 deletions(-)
diff --git a/block/blk-throttle.c b/block/blk-throttle.c
index e287c19..1588c2d 100644
--- a/block/blk-throttle.c
+++ b/block/blk-throttle.c
@@ -675,10 +675,9 @@ static bool tg_may_dispatch(struct throtl_data *td, struct throtl_grp *tg,
return 0;
}
-static void throtl_update_dispatch_stats(struct blkcg_gq *blkg, u64 bytes,
+static void throtl_update_dispatch_stats(struct throtl_grp *tg, u64 bytes,
int rw)
{
- struct throtl_grp *tg = blkg_to_tg(blkg);
struct tg_stats_cpu *stats_cpu;
unsigned long flags;
@@ -709,7 +708,7 @@ static void throtl_charge_bio(struct throtl_grp *tg, struct bio *bio)
tg->bytes_disp[rw] += bio->bi_size;
tg->io_disp[rw]++;
- throtl_update_dispatch_stats(tg_to_blkg(tg), bio->bi_size, bio->bi_rw);
+ throtl_update_dispatch_stats(tg, bio->bi_size, bio->bi_rw);
}
static void throtl_add_bio_tg(struct throtl_data *td, struct throtl_grp *tg,
@@ -1133,7 +1132,7 @@ bool blk_throtl_bio(struct request_queue *q, struct bio *bio)
tg = throtl_lookup_tg(td, blkcg);
if (tg) {
if (tg_no_rule_group(tg, rw)) {
- throtl_update_dispatch_stats(tg_to_blkg(tg),
+ throtl_update_dispatch_stats(tg,
bio->bi_size, bio->bi_rw);
goto out_unlock_rcu;
}
--
1.7.0.4
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] block/throttle: Call throtl_update_dispatch_stats with throtl_grp directly.
2012-08-31 5:08 [PATCH] block/throttle: Call throtl_update_dispatch_stats with throtl_grp directly Tao Ma
@ 2012-09-04 12:44 ` Vivek Goyal
0 siblings, 0 replies; 2+ messages in thread
From: Vivek Goyal @ 2012-09-04 12:44 UTC (permalink / raw)
To: Tao Ma; +Cc: linux-kernel, Tejun Heo, Jens Axboe
On Fri, Aug 31, 2012 at 01:08:23PM +0800, Tao Ma wrote:
> From: Tao Ma <boyu.mt@taobao.com>
>
> All callers of throtl_update_dispatch_stats uses tg_to_blkg and then
> in this function we use blkg_to_tg again to change it back. So remove
> all these useless conversion and use throtl_grp directly to call
> throtl_update_dispatch_stats.
>
> Cc: Tejun Heo <tj@kernel.org>
> Cc: Vivek Goyal <vgoyal@redhat.com>
> Cc: Jens Axboe <axboe@kernel.dk>
> Signed-off-by: Tao Ma <boyu.mt@taobao.com>
> ---
Simple. Looks good.
Acked-by: Vivek Goyal <vgoyal@redhat.com>
Vivek
> block/blk-throttle.c | 7 +++----
> 1 files changed, 3 insertions(+), 4 deletions(-)
>
> diff --git a/block/blk-throttle.c b/block/blk-throttle.c
> index e287c19..1588c2d 100644
> --- a/block/blk-throttle.c
> +++ b/block/blk-throttle.c
> @@ -675,10 +675,9 @@ static bool tg_may_dispatch(struct throtl_data *td, struct throtl_grp *tg,
> return 0;
> }
>
> -static void throtl_update_dispatch_stats(struct blkcg_gq *blkg, u64 bytes,
> +static void throtl_update_dispatch_stats(struct throtl_grp *tg, u64 bytes,
> int rw)
> {
> - struct throtl_grp *tg = blkg_to_tg(blkg);
> struct tg_stats_cpu *stats_cpu;
> unsigned long flags;
>
> @@ -709,7 +708,7 @@ static void throtl_charge_bio(struct throtl_grp *tg, struct bio *bio)
> tg->bytes_disp[rw] += bio->bi_size;
> tg->io_disp[rw]++;
>
> - throtl_update_dispatch_stats(tg_to_blkg(tg), bio->bi_size, bio->bi_rw);
> + throtl_update_dispatch_stats(tg, bio->bi_size, bio->bi_rw);
> }
>
> static void throtl_add_bio_tg(struct throtl_data *td, struct throtl_grp *tg,
> @@ -1133,7 +1132,7 @@ bool blk_throtl_bio(struct request_queue *q, struct bio *bio)
> tg = throtl_lookup_tg(td, blkcg);
> if (tg) {
> if (tg_no_rule_group(tg, rw)) {
> - throtl_update_dispatch_stats(tg_to_blkg(tg),
> + throtl_update_dispatch_stats(tg,
> bio->bi_size, bio->bi_rw);
> goto out_unlock_rcu;
> }
> --
> 1.7.0.4
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2012-09-04 12:44 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-08-31 5:08 [PATCH] block/throttle: Call throtl_update_dispatch_stats with throtl_grp directly Tao Ma
2012-09-04 12:44 ` Vivek Goyal
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).