]> Pileus Git - ~andy/linux/blobdiff - block/genhd.c
block cfq: don't use atomic_t for cfq_group
[~andy/linux] / block / genhd.c
index a8adf96a4b411bbb73e69ff9738fc6d546733bda..399d37ec7412d6af84ba1082721a54b0864f3195 100644 (file)
@@ -239,7 +239,7 @@ static struct blk_major_name {
 } *major_names[BLKDEV_MAJOR_HASH_SIZE];
 
 /* index in the above - for now: assume no multimajor ranges */
-static inline int major_to_index(int major)
+static inline int major_to_index(unsigned major)
 {
        return major % BLKDEV_MAJOR_HASH_SIZE;
 }
@@ -735,7 +735,7 @@ static void *show_partition_start(struct seq_file *seqf, loff_t *pos)
        static void *p;
 
        p = disk_seqf_start(seqf, pos);
-       if (!IS_ERR(p) && p && !*pos)
+       if (!IS_ERR_OR_NULL(p) && !*pos)
                seq_puts(seqf, "major minor  #blocks  name\n\n");
        return p;
 }
@@ -929,15 +929,8 @@ static void disk_free_ptbl_rcu_cb(struct rcu_head *head)
 {
        struct disk_part_tbl *ptbl =
                container_of(head, struct disk_part_tbl, rcu_head);
-       struct gendisk *disk = ptbl->disk;
-       struct request_queue *q = disk->queue;
-       unsigned long flags;
 
        kfree(ptbl);
-
-       spin_lock_irqsave(q->queue_lock, flags);
-       elv_quiesce_end(q);
-       spin_unlock_irqrestore(q->queue_lock, flags);
 }
 
 /**
@@ -955,17 +948,11 @@ static void disk_replace_part_tbl(struct gendisk *disk,
                                  struct disk_part_tbl *new_ptbl)
 {
        struct disk_part_tbl *old_ptbl = disk->part_tbl;
-       struct request_queue *q = disk->queue;
 
        rcu_assign_pointer(disk->part_tbl, new_ptbl);
 
        if (old_ptbl) {
                rcu_assign_pointer(old_ptbl->last_lookup, NULL);
-
-               spin_lock_irq(q->queue_lock);
-               elv_quiesce_start(q);
-               spin_unlock_irq(q->queue_lock);
-
                call_rcu(&old_ptbl->rcu_head, disk_free_ptbl_rcu_cb);
        }
 }
@@ -1006,7 +993,6 @@ int disk_expand_part_tbl(struct gendisk *disk, int partno)
                return -ENOMEM;
 
        new_ptbl->len = target;
-       new_ptbl->disk = disk;
 
        for (i = 0; i < len; i++)
                rcu_assign_pointer(new_ptbl->part[i], old_ptbl->part[i]);
@@ -1207,6 +1193,8 @@ struct gendisk *alloc_disk_node(int minors, int node_id)
                }
                disk->part_tbl->part[0] = &disk->part0;
 
+               hd_ref_init(&disk->part0);
+
                disk->minors = minors;
                rand_initialize_disk(disk);
                disk_to_dev(disk)->class = &block_class;