aboutsummaryrefslogtreecommitdiffstats
path: root/block/blk-cgroup.c
diff options
context:
space:
mode:
Diffstat (limited to 'block/blk-cgroup.c')
-rw-r--r--block/blk-cgroup.c22
1 files changed, 14 insertions, 8 deletions
diff --git a/block/blk-cgroup.c b/block/blk-cgroup.c
index 429726bed560..8ee1ca4d4f2f 100644
--- a/block/blk-cgroup.c
+++ b/block/blk-cgroup.c
@@ -24,6 +24,7 @@
24#include <linux/genhd.h> 24#include <linux/genhd.h>
25#include <linux/delay.h> 25#include <linux/delay.h>
26#include <linux/atomic.h> 26#include <linux/atomic.h>
27#include <linux/ctype.h>
27#include <linux/blk-cgroup.h> 28#include <linux/blk-cgroup.h>
28#include "blk.h" 29#include "blk.h"
29 30
@@ -773,23 +774,28 @@ EXPORT_SYMBOL_GPL(blkg_rwstat_recursive_sum);
773 * @ctx: blkg_conf_ctx to be filled 774 * @ctx: blkg_conf_ctx to be filled
774 * 775 *
775 * Parse per-blkg config update from @input and initialize @ctx with the 776 * Parse per-blkg config update from @input and initialize @ctx with the
776 * result. @ctx->blkg points to the blkg to be updated and @ctx->v the new 777 * result. @ctx->blkg points to the blkg to be updated and @ctx->body the
777 * value. This function returns with RCU read lock and queue lock held and 778 * part of @input following MAJ:MIN. This function returns with RCU read
778 * must be paired with blkg_conf_finish(). 779 * lock and queue lock held and must be paired with blkg_conf_finish().
779 */ 780 */
780int blkg_conf_prep(struct blkcg *blkcg, const struct blkcg_policy *pol, 781int blkg_conf_prep(struct blkcg *blkcg, const struct blkcg_policy *pol,
781 const char *input, struct blkg_conf_ctx *ctx) 782 char *input, struct blkg_conf_ctx *ctx)
782 __acquires(rcu) __acquires(disk->queue->queue_lock) 783 __acquires(rcu) __acquires(disk->queue->queue_lock)
783{ 784{
784 struct gendisk *disk; 785 struct gendisk *disk;
785 struct blkcg_gq *blkg; 786 struct blkcg_gq *blkg;
786 unsigned int major, minor; 787 unsigned int major, minor;
787 unsigned long long v; 788 int key_len, part, ret;
788 int part, ret; 789 char *body;
789 790
790 if (sscanf(input, "%u:%u %llu", &major, &minor, &v) != 3) 791 if (sscanf(input, "%u:%u%n", &major, &minor, &key_len) != 2)
791 return -EINVAL; 792 return -EINVAL;
792 793
794 body = input + key_len;
795 if (!isspace(*body))
796 return -EINVAL;
797 body = skip_spaces(body);
798
793 disk = get_gendisk(MKDEV(major, minor), &part); 799 disk = get_gendisk(MKDEV(major, minor), &part);
794 if (!disk) 800 if (!disk)
795 return -ENODEV; 801 return -ENODEV;
@@ -826,7 +832,7 @@ int blkg_conf_prep(struct blkcg *blkcg, const struct blkcg_policy *pol,
826 832
827 ctx->disk = disk; 833 ctx->disk = disk;
828 ctx->blkg = blkg; 834 ctx->blkg = blkg;
829 ctx->v = v; 835 ctx->body = body;
830 return 0; 836 return 0;
831} 837}
832EXPORT_SYMBOL_GPL(blkg_conf_prep); 838EXPORT_SYMBOL_GPL(blkg_conf_prep);