diff options
| author | Linus Torvalds <torvalds@linux-foundation.org> | 2011-11-04 20:06:58 -0400 |
|---|---|---|
| committer | Linus Torvalds <torvalds@linux-foundation.org> | 2011-11-04 20:06:58 -0400 |
| commit | b4fdcb02f1e39c27058a885905bd0277370ba441 (patch) | |
| tree | fd4cfd1994f21f44afe5e7904681fb5ac09f81b8 /block | |
| parent | 044595d4e448305fbaec472eb7d22636d24e7d8c (diff) | |
| parent | 6dd9ad7df2019b1e33a372a501907db293ebcd0d (diff) | |
Merge branch 'for-3.2/core' of git://git.kernel.dk/linux-block
* 'for-3.2/core' of git://git.kernel.dk/linux-block: (29 commits)
block: don't call blk_drain_queue() if elevator is not up
blk-throttle: use queue_is_locked() instead of lockdep_is_held()
blk-throttle: Take blkcg->lock while traversing blkcg->policy_list
blk-throttle: Free up policy node associated with deleted rule
block: warn if tag is greater than real_max_depth.
block: make gendisk hold a reference to its queue
blk-flush: move the queue kick into
blk-flush: fix invalid BUG_ON in blk_insert_flush
block: Remove the control of complete cpu from bio.
block: fix a typo in the blk-cgroup.h file
block: initialize the bounce pool if high memory may be added later
block: fix request_queue lifetime handling by making blk_queue_cleanup() properly shutdown
block: drop @tsk from attempt_plug_merge() and explain sync rules
block: make get_request[_wait]() fail if queue is dead
block: reorganize throtl_get_tg() and blk_throtl_bio()
block: reorganize queue draining
block: drop unnecessary blk_get/put_queue() in scsi_cmd_ioctl() and blk_get_tg()
block: pass around REQ_* flags instead of broken down booleans during request alloc/free
block: move blk_throtl prototypes to block/blk.h
block: fix genhd refcounting in blkio_policy_parse_and_set()
...
Fix up trivial conflicts due to "mddev_t" -> "struct mddev" conversion
and making the request functions be of type "void" instead of "int" in
- drivers/md/{faulty.c,linear.c,md.c,md.h,multipath.c,raid0.c,raid1.c,raid10.c,raid5.c}
- drivers/staging/zram/zram_drv.c
Diffstat (limited to 'block')
| -rw-r--r-- | block/blk-cgroup.c | 111 | ||||
| -rw-r--r-- | block/blk-cgroup.h | 2 | ||||
| -rw-r--r-- | block/blk-core.c | 461 | ||||
| -rw-r--r-- | block/blk-flush.c | 3 | ||||
| -rw-r--r-- | block/blk-sysfs.c | 7 | ||||
| -rw-r--r-- | block/blk-tag.c | 6 | ||||
| -rw-r--r-- | block/blk-throttle.c | 106 | ||||
| -rw-r--r-- | block/blk.h | 20 | ||||
| -rw-r--r-- | block/elevator.c | 39 | ||||
| -rw-r--r-- | block/genhd.c | 8 | ||||
| -rw-r--r-- | block/scsi_ioctl.c | 3 |
11 files changed, 439 insertions, 327 deletions
diff --git a/block/blk-cgroup.c b/block/blk-cgroup.c index b596e54ddd71..8f630cec906e 100644 --- a/block/blk-cgroup.c +++ b/block/blk-cgroup.c | |||
| @@ -768,25 +768,14 @@ static uint64_t blkio_get_stat(struct blkio_group *blkg, | |||
| 768 | return disk_total; | 768 | return disk_total; |
| 769 | } | 769 | } |
| 770 | 770 | ||
| 771 | static int blkio_check_dev_num(dev_t dev) | ||
| 772 | { | ||
| 773 | int part = 0; | ||
| 774 | struct gendisk *disk; | ||
| 775 | |||
| 776 | disk = get_gendisk(dev, &part); | ||
| 777 | if (!disk || part) | ||
| 778 | return -ENODEV; | ||
| 779 | |||
| 780 | return 0; | ||
| 781 | } | ||
| 782 | |||
| 783 | static int blkio_policy_parse_and_set(char *buf, | 771 | static int blkio_policy_parse_and_set(char *buf, |
| 784 | struct blkio_policy_node *newpn, enum blkio_policy_id plid, int fileid) | 772 | struct blkio_policy_node *newpn, enum blkio_policy_id plid, int fileid) |
| 785 | { | 773 | { |
| 774 | struct gendisk *disk = NULL; | ||
| 786 | char *s[4], *p, *major_s = NULL, *minor_s = NULL; | 775 | char *s[4], *p, *major_s = NULL, *minor_s = NULL; |
| 787 | int ret; | ||
| 788 | unsigned long major, minor; | 776 | unsigned long major, minor; |
| 789 | int i = 0; | 777 | int i = 0, ret = -EINVAL; |
| 778 | int part; | ||
| 790 | dev_t dev; | 779 | dev_t dev; |
| 791 | u64 temp; | 780 | u64 temp; |
| 792 | 781 | ||
| @@ -804,37 +793,36 @@ static int blkio_policy_parse_and_set(char *buf, | |||
| 804 | } | 793 | } |
| 805 | 794 | ||
| 806 | if (i != 2) | 795 | if (i != 2) |
| 807 | return -EINVAL; | 796 | goto out; |
| 808 | 797 | ||
| 809 | p = strsep(&s[0], ":"); | 798 | p = strsep(&s[0], ":"); |
| 810 | if (p != NULL) | 799 | if (p != NULL) |
| 811 | major_s = p; | 800 | major_s = p; |
| 812 | else | 801 | else |
| 813 | return -EINVAL; | 802 | goto out; |
| 814 | 803 | ||
| 815 | minor_s = s[0]; | 804 | minor_s = s[0]; |
| 816 | if (!minor_s) | 805 | if (!minor_s) |
| 817 | return -EINVAL; | 806 | goto out; |
| 818 | 807 | ||
| 819 | ret = strict_strtoul(major_s, 10, &major); | 808 | if (strict_strtoul(major_s, 10, &major)) |
| 820 | if (ret) | 809 | goto out; |
| 821 | return -EINVAL; | ||
| 822 | 810 | ||
| 823 | ret = strict_strtoul(minor_s, 10, &minor); | 811 | if (strict_strtoul(minor_s, 10, &minor)) |
| 824 | if (ret) | 812 | goto out; |
| 825 | return -EINVAL; | ||
| 826 | 813 | ||
| 827 | dev = MKDEV(major, minor); | 814 | dev = MKDEV(major, minor); |
| 828 | 815 | ||
| 829 | ret = strict_strtoull(s[1], 10, &temp); | 816 | if (strict_strtoull(s[1], 10, &temp)) |
| 830 | if (ret) | 817 | goto out; |
| 831 | return -EINVAL; | ||
| 832 | 818 | ||
| 833 | /* For rule removal, do not check for device presence. */ | 819 | /* For rule removal, do not check for device presence. */ |
| 834 | if (temp) { | 820 | if (temp) { |
| 835 | ret = blkio_check_dev_num(dev); | 821 | disk = get_gendisk(dev, &part); |
| 836 | if (ret) | 822 | if (!disk || part) { |
| 837 | return ret; | 823 | ret = -ENODEV; |
| 824 | goto out; | ||
| 825 | } | ||
| 838 | } | 826 | } |
| 839 | 827 | ||
| 840 | newpn->dev = dev; | 828 | newpn->dev = dev; |
| @@ -843,7 +831,7 @@ static int blkio_policy_parse_and_set(char *buf, | |||
| 843 | case BLKIO_POLICY_PROP: | 831 | case BLKIO_POLICY_PROP: |
| 844 | if ((temp < BLKIO_WEIGHT_MIN && temp > 0) || | 832 | if ((temp < BLKIO_WEIGHT_MIN && temp > 0) || |
| 845 | temp > BLKIO_WEIGHT_MAX) | 833 | temp > BLKIO_WEIGHT_MAX) |
| 846 | return -EINVAL; | 834 | goto out; |
| 847 | 835 | ||
| 848 | newpn->plid = plid; | 836 | newpn->plid = plid; |
| 849 | newpn->fileid = fileid; | 837 | newpn->fileid = fileid; |
| @@ -860,7 +848,7 @@ static int blkio_policy_parse_and_set(char *buf, | |||
| 860 | case BLKIO_THROTL_read_iops_device: | 848 | case BLKIO_THROTL_read_iops_device: |
| 861 | case BLKIO_THROTL_write_iops_device: | 849 | case BLKIO_THROTL_write_iops_device: |
| 862 | if (temp > THROTL_IOPS_MAX) | 850 | if (temp > THROTL_IOPS_MAX) |
| 863 | return -EINVAL; | 851 | goto out; |
| 864 | 852 | ||
| 865 | newpn->plid = plid; | 853 | newpn->plid = plid; |
| 866 | newpn->fileid = fileid; | 854 | newpn->fileid = fileid; |
| @@ -871,68 +859,96 @@ static int blkio_policy_parse_and_set(char *buf, | |||
| 871 | default: | 859 | default: |
| 872 | BUG(); | 860 | BUG(); |
| 873 | } | 861 | } |
| 874 | 862 | ret = 0; | |
| 875 | return 0; | 863 | out: |
| 864 | put_disk(disk); | ||
| 865 | return ret; | ||
| 876 | } | 866 | } |
| 877 | 867 | ||
| 878 | unsigned int blkcg_get_weight(struct blkio_cgroup *blkcg, | 868 | unsigned int blkcg_get_weight(struct blkio_cgroup *blkcg, |
| 879 | dev_t dev) | 869 | dev_t dev) |
| 880 | { | 870 | { |
| 881 | struct blkio_policy_node *pn; | 871 | struct blkio_policy_node *pn; |
| 872 | unsigned long flags; | ||
| 873 | unsigned int weight; | ||
| 874 | |||
| 875 | spin_lock_irqsave(&blkcg->lock, flags); | ||
| 882 | 876 | ||
| 883 | pn = blkio_policy_search_node(blkcg, dev, BLKIO_POLICY_PROP, | 877 | pn = blkio_policy_search_node(blkcg, dev, BLKIO_POLICY_PROP, |
| 884 | BLKIO_PROP_weight_device); | 878 | BLKIO_PROP_weight_device); |
| 885 | if (pn) | 879 | if (pn) |
| 886 | return pn->val.weight; | 880 | weight = pn->val.weight; |
| 887 | else | 881 | else |
| 888 | return blkcg->weight; | 882 | weight = blkcg->weight; |
| 883 | |||
| 884 | spin_unlock_irqrestore(&blkcg->lock, flags); | ||
| 885 | |||
| 886 | return weight; | ||
| 889 | } | 887 | } |
| 890 | EXPORT_SYMBOL_GPL(blkcg_get_weight); | 888 | EXPORT_SYMBOL_GPL(blkcg_get_weight); |
| 891 | 889 | ||
| 892 | uint64_t blkcg_get_read_bps(struct blkio_cgroup *blkcg, dev_t dev) | 890 | uint64_t blkcg_get_read_bps(struct blkio_cgroup *blkcg, dev_t dev) |
| 893 | { | 891 | { |
| 894 | struct blkio_policy_node *pn; | 892 | struct blkio_policy_node *pn; |
| 893 | unsigned long flags; | ||
| 894 | uint64_t bps = -1; | ||
| 895 | 895 | ||
| 896 | spin_lock_irqsave(&blkcg->lock, flags); | ||
| 896 | pn = blkio_policy_search_node(blkcg, dev, BLKIO_POLICY_THROTL, | 897 | pn = blkio_policy_search_node(blkcg, dev, BLKIO_POLICY_THROTL, |
| 897 | BLKIO_THROTL_read_bps_device); | 898 | BLKIO_THROTL_read_bps_device); |
| 898 | if (pn) | 899 | if (pn) |
| 899 | return pn->val.bps; | 900 | bps = pn->val.bps; |
| 900 | else | 901 | spin_unlock_irqrestore(&blkcg->lock, flags); |
| 901 | return -1; | 902 | |
| 903 | return bps; | ||
| 902 | } | 904 | } |
| 903 | |||
