Skip to content

Commit b4fdcb0

Browse files
committed
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
2 parents 044595d + 6dd9ad7 commit b4fdcb0

42 files changed

Lines changed: 587 additions & 621 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

‎arch/m68k/emu/nfblock.c‎

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ struct nfhd_device {
5959
struct gendisk *disk;
6060
};
6161

62-
static int nfhd_make_request(struct request_queue *queue, struct bio *bio)
62+
static void nfhd_make_request(struct request_queue *queue, struct bio *bio)
6363
{
6464
struct nfhd_device *dev = queue->queuedata;
6565
struct bio_vec *bvec;
@@ -76,7 +76,6 @@ static int nfhd_make_request(struct request_queue *queue, struct bio *bio)
7676
sec += len;
7777
}
7878
bio_endio(bio, 0);
79-
return 0;
8079
}
8180

8281
static int nfhd_getgeo(struct block_device *bdev, struct hd_geometry *geo)

‎arch/powerpc/sysdev/axonram.c‎

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@ axon_ram_irq_handler(int irq, void *dev)
104104
* axon_ram_make_request - make_request() method for block device
105105
* @queue, @bio: see blk_queue_make_request()
106106
*/
107-
static int
107+
static void
108108
axon_ram_make_request(struct request_queue *queue, struct bio *bio)
109109
{
110110
struct axon_ram_bank *bank = bio->bi_bdev->bd_disk->private_data;
@@ -113,16 +113,14 @@ axon_ram_make_request(struct request_queue *queue, struct bio *bio)
113113
struct bio_vec *vec;
114114
unsigned int transfered;
115115
unsigned short idx;
116-
int rc = 0;
117116

118117
phys_mem = bank->io_addr + (bio->bi_sector << AXON_RAM_SECTOR_SHIFT);
119118
phys_end = bank->io_addr + bank->size;
120119
transfered = 0;
121120
bio_for_each_segment(vec, bio, idx) {
122121
if (unlikely(phys_mem + vec->bv_len > phys_end)) {
123122
bio_io_error(bio);
124-
rc = -ERANGE;
125-
break;
123+
return;
126124
}
127125

128126
user_mem = page_address(vec->bv_page) + vec->bv_offset;
@@ -135,8 +133,6 @@ axon_ram_make_request(struct request_queue *queue, struct bio *bio)
135133
transfered += vec->bv_len;
136134
}
137135
bio_endio(bio, 0);
138-
139-
return rc;
140136
}
141137

142138
/**

‎block/blk-cgroup.c‎

Lines changed: 64 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -768,25 +768,14 @@ static uint64_t blkio_get_stat(struct blkio_group *blkg,
768768
return disk_total;
769769
}
770770

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-
783771
static int blkio_policy_parse_and_set(char *buf,
784772
struct blkio_policy_node *newpn, enum blkio_policy_id plid, int fileid)
785773
{
774+
struct gendisk *disk = NULL;
786775
char *s[4], *p, *major_s = NULL, *minor_s = NULL;
787-
int ret;
788776
unsigned long major, minor;
789-
int i = 0;
777+
int i = 0, ret = -EINVAL;
778+
int part;
790779
dev_t dev;
791780
u64 temp;
792781

@@ -804,37 +793,36 @@ static int blkio_policy_parse_and_set(char *buf,
804793
}
805794

806795
if (i != 2)
807-
return -EINVAL;
796+
goto out;
808797

809798
p = strsep(&s[0], ":");
810799
if (p != NULL)
811800
major_s = p;
812801
else
813-
return -EINVAL;
802+
goto out;
814803

815804
minor_s = s[0];
816805
if (!minor_s)
817-
return -EINVAL;
806+
goto out;
818807

819-
ret = strict_strtoul(major_s, 10, &major);
820-
if (ret)
821-
return -EINVAL;
808+
if (strict_strtoul(major_s, 10, &major))
809+
goto out;
822810

823-
ret = strict_strtoul(minor_s, 10, &minor);
824-
if (ret)
825-
return -EINVAL;
811+
if (strict_strtoul(minor_s, 10, &minor))
812+
goto out;
826813

827814
dev = MKDEV(major, minor);
828815

829-
ret = strict_strtoull(s[1], 10, &temp);
830-
if (ret)
831-
return -EINVAL;
816+
if (strict_strtoull(s[1], 10, &temp))
817+
goto out;
832818

833819
/* For rule removal, do not check for device presence. */
834820
if (temp) {
835-
ret = blkio_check_dev_num(dev);
836-
if (ret)
837-
return ret;
821+
disk = get_gendisk(dev, &part);
822+
if (!disk || part) {
823+
ret = -ENODEV;
824+
goto out;
825+
}
838826
}
839827

840828
newpn->dev = dev;
@@ -843,7 +831,7 @@ static int blkio_policy_parse_and_set(char *buf,
843831
case BLKIO_POLICY_PROP:
844832
if ((temp < BLKIO_WEIGHT_MIN && temp > 0) ||
845833
temp > BLKIO_WEIGHT_MAX)
846-
return -EINVAL;
834+
goto out;
847835

848836
newpn->plid = plid;
849837
newpn->fileid = fileid;
@@ -860,7 +848,7 @@ static int blkio_policy_parse_and_set(char *buf,
860848
case BLKIO_THROTL_read_iops_device:
861849
case BLKIO_THROTL_write_iops_device:
862850
if (temp > THROTL_IOPS_MAX)
863-
return -EINVAL;
851+
goto out;
864852

865853
newpn->plid = plid;
866854
newpn->fileid = fileid;
@@ -871,68 +859,96 @@ static int blkio_policy_parse_and_set(char *buf,
871859
default:
872860
BUG();
873861
}
874-
875-
return 0;
862+
ret = 0;
863+
out:
864+
put_disk(disk);
865+
return ret;
876866
}
877867

878868
unsigned int blkcg_get_weight(struct blkio_cgroup *blkcg,
879869
dev_t dev)
880870
{
881871
struct blkio_policy_node *pn;
872+
unsigned long flags;
873+
unsigned int weight;
874+
875+
spin_lock_irqsave(&blkcg->lock, flags);
882876

883877
pn = blkio_policy_search_node(blkcg, dev, BLKIO_POLICY_PROP,
884878
BLKIO_PROP_weight_device);
885879
if (pn)
886-
return pn->val.weight;
880+
weight = pn->val.weight;
887881
else
888-
return blkcg->weight;
882+
weight = blkcg->weight;
883+
884+
spin_unlock_irqrestore(&blkcg->lock, flags);
885+
886+
return weight;
889887
}
890888
EXPORT_SYMBOL_GPL(blkcg_get_weight);
891889

892890
uint64_t blkcg_get_read_bps(struct blkio_cgroup *blkcg, dev_t dev)
893891
{
894892
struct blkio_policy_node *pn;
893+
unsigned long flags;
894+
uint64_t bps = -1;
895895

896+
spin_lock_irqsave(&blkcg->lock, flags);
896897
pn = blkio_policy_search_node(blkcg, dev, BLKIO_POLICY_THROTL,
897898
BLKIO_THROTL_read_bps_device);
898899
if (pn)
899-
return pn->val.bps;
900-
else
901-
return -1;
900+
bps = pn->val.bps;
901+
spin_unlock_irqrestore(&blkcg->lock, flags);
902+
903+
return bps;
902904
}
903905

904906
uint64_t blkcg_get_write_bps(struct blkio_cgroup *blkcg, dev_t dev)
905907
{
906908
struct blkio_policy_node *pn;
909+
unsigned long flags;
910+
uint64_t bps = -1;
911+
912+
spin_lock_irqsave(&blkcg->lock, flags);
907913
pn = blkio_policy_search_node(blkcg, dev, BLKIO_POLICY_THROTL,
908914
BLKIO_THROTL_write_bps_device);
909915
if (pn)
910-
return pn->val.bps;
911-
else
912-
return -1;
916+
bps = pn->val.bps;
917+
spin_unlock_irqrestore(&blkcg->lock, flags);
918+
919+
return bps;
913920
}
914921

915922
unsigned int blkcg_get_read_iops(struct blkio_cgroup *blkcg, dev_t dev)
916923
{
917924
struct blkio_policy_node *pn;
925+
unsigned long flags;
926+
unsigned int iops = -1;
918927

928+
spin_lock_irqsave(&blkcg->lock, flags);
919929
pn = blkio_policy_search_node(blkcg, dev, BLKIO_POLICY_THROTL,
920930
BLKIO_THROTL_read_iops_device);
921931
if (pn)
922-
return pn->val.iops;
923-
else
924-
return -1;
932+
iops = pn->val.iops;
933+
spin_unlock_irqrestore(&blkcg->lock, flags);
934+
935+
return iops;
925936
}
926937

927938
unsigned int blkcg_get_write_iops(struct blkio_cgroup *blkcg, dev_t dev)
928939
{
929940
struct blkio_policy_node *pn;
941+
unsigned long flags;
942+
unsigned int iops = -1;
943+
944+
spin_lock_irqsave(&blkcg->lock, flags);
930945
pn = blkio_policy_search_node(blkcg, dev, BLKIO_POLICY_THROTL,
931946
BLKIO_THROTL_write_iops_device);
932947
if (pn)
933-
return pn->val.iops;
934-
else
935-
return -1;
948+
iops = pn->val.iops;
949+
spin_unlock_irqrestore(&blkcg->lock, flags);
950+
951+
return iops;
936952
}
937953

938954
/* Checks whether user asked for deleting a policy rule */
@@ -1085,6 +1101,7 @@ static int blkiocg_file_write(struct cgroup *cgrp, struct cftype *cft,
10851101

10861102
if (blkio_delete_rule_command(newpn)) {
10871103
blkio_policy_delete_node(pn);
1104+
kfree(pn);
10881105
spin_unlock_irq(&blkcg->lock);
10891106
goto update_io_group;
10901107
}

‎block/blk-cgroup.h‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -188,7 +188,7 @@ struct blkio_policy_node {
188188
union {
189189
unsigned int weight;
190190
/*
191-
* Rate read/write in terms of byptes per second
191+
* Rate read/write in terms of bytes per second
192192
* Whether this rate represents read or write is determined
193193
* by file type "fileid".
194194
*/

0 commit comments

Comments
 (0)