From: Tejun Heo <tj@kernel.org>
To: axboe@kernel.dk
Cc: vgoyal@redhat.com, linux-kernel@vger.kernel.org,
avanzini.arianna@gmail.com, kernel-team@fb.com,
hannes@cmpxchg.org, lizefan@huawei.com, cgroups@vger.kernel.org,
Tejun Heo <tj@kernel.org>
Subject: [PATCH 08/10] blkcg: separate out tg_conf_updated() from tg_set_conf()
Date: Fri, 24 Jul 2015 14:43:52 -0400 [thread overview]
Message-ID: <1437763434-28699-9-git-send-email-tj@kernel.org> (raw)
In-Reply-To: <1437763434-28699-1-git-send-email-tj@kernel.org>
tg_set_conf() is largely consisted of parsing and setting the new
config and the follow-up application and propagation. This patch
separates out the latter part into tg_conf_updated(). This will be
used to implement interface for the unified hierarchy.
Signed-off-by: Tejun Heo <tj@kernel.org>
---
block/blk-throttle.c | 60 ++++++++++++++++++++++++++++------------------------
1 file changed, 32 insertions(+), 28 deletions(-)
diff --git a/block/blk-throttle.c b/block/blk-throttle.c
index 0e17c8f..a8bb2fd 100644
--- a/block/blk-throttle.c
+++ b/block/blk-throttle.c
@@ -1144,35 +1144,11 @@ static int tg_print_conf_uint(struct seq_file *sf, void *v)
return 0;
}
-static ssize_t tg_set_conf(struct kernfs_open_file *of,
- char *buf, size_t nbytes, loff_t off, bool is_u64)
+static void tg_conf_updated(struct throtl_grp *tg)
{
- struct blkcg *blkcg = css_to_blkcg(of_css(of));
- struct blkg_conf_ctx ctx;
- struct throtl_grp *tg;
- struct throtl_service_queue *sq;
- struct blkcg_gq *blkg;
+ struct throtl_service_queue *sq = &tg->service_queue;
struct cgroup_subsys_state *pos_css;
- int ret;
- u64 v;
-
- ret = blkg_conf_prep(blkcg, &blkcg_policy_throtl, buf, &ctx);
- if (ret)
- return ret;
-
- ret = -EINVAL;
- if (sscanf(ctx.body, "%llu", &v) != 1)
- goto out_finish;
- if (!v)
- v = -1;
-
- tg = blkg_to_tg(ctx.blkg);
- sq = &tg->service_queue;
-
- if (is_u64)
- *(u64 *)((void *)tg + of_cft(of)->private) = v;
- else
- *(unsigned int *)((void *)tg + of_cft(of)->private) = v;
+ struct blkcg_gq *blkg;
throtl_log(&tg->service_queue,
"limit change rbps=%llu wbps=%llu riops=%u wiops=%u",
@@ -1186,7 +1162,7 @@ static ssize_t tg_set_conf(struct kernfs_open_file *of,
* restrictions in the whole hierarchy and allows them to bypass
* blk-throttle.
*/
- blkg_for_each_descendant_pre(blkg, pos_css, ctx.blkg)
+ blkg_for_each_descendant_pre(blkg, pos_css, tg_to_blkg(tg))
tg_update_has_rules(blkg_to_tg(blkg));
/*
@@ -1204,7 +1180,35 @@ static ssize_t tg_set_conf(struct kernfs_open_file *of,
tg_update_disptime(tg);
throtl_schedule_next_dispatch(sq->parent_sq, true);
}
+}
+
+static ssize_t tg_set_conf(struct kernfs_open_file *of,
+ char *buf, size_t nbytes, loff_t off, bool is_u64)
+{
+ struct blkcg *blkcg = css_to_blkcg(of_css(of));
+ struct blkg_conf_ctx ctx;
+ struct throtl_grp *tg;
+ int ret;
+ u64 v;
+
+ ret = blkg_conf_prep(blkcg, &blkcg_policy_throtl, buf, &ctx);
+ if (ret)
+ return ret;
+
+ ret = -EINVAL;
+ if (sscanf(ctx.body, "%llu", &v) != 1)
+ goto out_finish;
+ if (!v)
+ v = -1;
+
+ tg = blkg_to_tg(ctx.blkg);
+
+ if (is_u64)
+ *(u64 *)((void *)tg + of_cft(of)->private) = v;
+ else
+ *(unsigned int *)((void *)tg + of_cft(of)->private) = v;
+ tg_conf_updated(tg);
ret = 0;
out_finish:
blkg_conf_finish(&ctx);
--
2.4.3
next prev parent reply other threads:[~2015-07-24 18:43 UTC|newest]
Thread overview: 32+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-07-24 18:43 [PATCHSET block/for-4.3] blkcg: implement interface for the unified hierarchy Tejun Heo
2015-07-24 18:43 ` Tejun Heo
2015-07-24 18:43 ` [PATCH 02/10] cgroup: introduce cgroup_subsys->legacy_name Tejun Heo
[not found] ` <1437763434-28699-3-git-send-email-tj-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>
2015-07-28 6:39 ` Zefan Li
2015-07-28 6:39 ` Zefan Li
2015-07-28 15:23 ` Tejun Heo
2015-07-28 17:56 ` [PATCH v2 " Tejun Heo
2015-08-18 21:01 ` Tejun Heo
2015-07-29 1:18 ` [PATCH " Zefan Li
2015-07-29 1:18 ` Zefan Li
2015-07-24 18:43 ` [PATCH 03/10] blkcg: remove unnecessary NULL checks from __cfqg_set_weight_device() Tejun Heo
2015-07-24 18:43 ` [PATCH 04/10] blkcg: refine error codes returned during blkcg configuration Tejun Heo
2015-07-24 18:43 ` [PATCH 07/10] blkcg: move body parsing from blkg_conf_prep() to its callers Tejun Heo
2015-07-24 18:43 ` Tejun Heo [this message]
2015-07-24 18:43 ` [PATCH 09/10] blkcg: misc preparations for unified hierarchy interface Tejun Heo
2015-07-24 18:43 ` [PATCH 10/10] blkcg: implement interface for the unified hierarchy Tejun Heo
[not found] ` <1437763434-28699-11-git-send-email-tj-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>
2015-07-30 22:58 ` [PATCH v2 " Tejun Heo
2015-07-30 22:58 ` Tejun Heo
[not found] ` <1437763434-28699-1-git-send-email-tj-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>
2015-07-24 18:43 ` [PATCH 01/10] cgroup: don't print subsystems for the default hierarchy Tejun Heo
2015-07-24 18:43 ` Tejun Heo
[not found] ` <1437763434-28699-2-git-send-email-tj-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>
2015-07-29 1:18 ` Zefan Li
2015-07-29 1:18 ` Zefan Li
2015-08-18 21:01 ` Tejun Heo
2015-08-18 21:01 ` Tejun Heo
2015-07-24 18:43 ` [PATCH 05/10] blkcg: rename subsystem name from blkio to io Tejun Heo
2015-07-24 18:43 ` Tejun Heo
2015-07-24 18:43 ` [PATCH 06/10] blkcg: mark existing cftypes as legacy Tejun Heo
2015-07-24 18:43 ` Tejun Heo
2015-07-27 16:12 ` [PATCHSET block/for-4.3] blkcg: implement interface for the unified hierarchy Vivek Goyal
2015-07-27 16:12 ` Vivek Goyal
[not found] ` <20150727161209.GB16064-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
2015-07-27 18:13 ` Tejun Heo
2015-07-27 18:13 ` Tejun Heo
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1437763434-28699-9-git-send-email-tj@kernel.org \
--to=tj@kernel.org \
--cc=avanzini.arianna@gmail.com \
--cc=axboe@kernel.dk \
--cc=cgroups@vger.kernel.org \
--cc=hannes@cmpxchg.org \
--cc=kernel-team@fb.com \
--cc=linux-kernel@vger.kernel.org \
--cc=lizefan@huawei.com \
--cc=vgoyal@redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.