diff options
-rw-r--r-- | block/blk-cgroup.c | 11 | ||||
-rw-r--r-- | block/blk-cgroup.h | 3 |
2 files changed, 10 insertions, 4 deletions
diff --git a/block/blk-cgroup.c b/block/blk-cgroup.c index 52c12130a5de..0f59b23096db 100644 --- a/block/blk-cgroup.c +++ b/block/blk-cgroup.c | |||
@@ -656,10 +656,10 @@ static int blkio_policy_parse_and_set(char *buf, | |||
656 | { | 656 | { |
657 | char *s[4], *p, *major_s = NULL, *minor_s = NULL; | 657 | char *s[4], *p, *major_s = NULL, *minor_s = NULL; |
658 | int ret; | 658 | int ret; |
659 | unsigned long major, minor, temp, iops; | 659 | unsigned long major, minor, temp; |
660 | int i = 0; | 660 | int i = 0; |
661 | dev_t dev; | 661 | dev_t dev; |
662 | u64 bps; | 662 | u64 bps, iops; |
663 | 663 | ||
664 | memset(s, 0, sizeof(s)); | 664 | memset(s, 0, sizeof(s)); |
665 | 665 | ||
@@ -731,13 +731,16 @@ static int blkio_policy_parse_and_set(char *buf, | |||
731 | break; | 731 | break; |
732 | case BLKIO_THROTL_read_iops_device: | 732 | case BLKIO_THROTL_read_iops_device: |
733 | case BLKIO_THROTL_write_iops_device: | 733 | case BLKIO_THROTL_write_iops_device: |
734 | ret = strict_strtoul(s[1], 10, &iops); | 734 | ret = strict_strtoull(s[1], 10, &iops); |
735 | if (ret) | 735 | if (ret) |
736 | return -EINVAL; | 736 | return -EINVAL; |
737 | 737 | ||
738 | if (iops > THROTL_IOPS_MAX) | ||
739 | return -EINVAL; | ||
740 | |||
738 | newpn->plid = plid; | 741 | newpn->plid = plid; |
739 | newpn->fileid = fileid; | 742 | newpn->fileid = fileid; |
740 | newpn->val.iops = iops; | 743 | newpn->val.iops = (unsigned int)iops; |
741 | break; | 744 | break; |
742 | } | 745 | } |
743 | break; | 746 | break; |
diff --git a/block/blk-cgroup.h b/block/blk-cgroup.h index 034c35562dba..ea4861bdd549 100644 --- a/block/blk-cgroup.h +++ b/block/blk-cgroup.h | |||
@@ -20,6 +20,9 @@ enum blkio_policy_id { | |||
20 | BLKIO_POLICY_THROTL, /* Throttling */ | 20 | BLKIO_POLICY_THROTL, /* Throttling */ |
21 | }; | 21 | }; |
22 | 22 | ||
23 | /* Max limits for throttle policy */ | ||
24 | #define THROTL_IOPS_MAX UINT_MAX | ||
25 | |||
23 | #if defined(CONFIG_BLK_CGROUP) || defined(CONFIG_BLK_CGROUP_MODULE) | 26 | #if defined(CONFIG_BLK_CGROUP) || defined(CONFIG_BLK_CGROUP_MODULE) |
24 | 27 | ||
25 | #ifndef CONFIG_BLK_CGROUP | 28 | #ifndef CONFIG_BLK_CGROUP |