Merge branch 'work.aio' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs
[linux-2.6-block.git] / fs / block_dev.c
index 11ba99e79d2a21084ed8f96dda1d4bfcaa9a7213..05e12aea24043dac01826bcc833be0e9e8c2e13b 100644 (file)
@@ -273,7 +273,7 @@ struct blkdev_dio {
        struct bio              bio;
 };
 
-static struct bio_set *blkdev_dio_pool __read_mostly;
+static struct bio_set blkdev_dio_pool;
 
 static void blkdev_bio_end_io(struct bio *bio)
 {
@@ -335,7 +335,7 @@ __blkdev_direct_IO(struct kiocb *iocb, struct iov_iter *iter, int nr_pages)
            (bdev_logical_block_size(bdev) - 1))
                return -EINVAL;
 
-       bio = bio_alloc_bioset(GFP_KERNEL, nr_pages, blkdev_dio_pool);
+       bio = bio_alloc_bioset(GFP_KERNEL, nr_pages, &blkdev_dio_pool);
        bio_get(bio); /* extra ref for the completion handler */
 
        dio = container_of(bio, struct blkdev_dio, bio);
@@ -434,10 +434,7 @@ blkdev_direct_IO(struct kiocb *iocb, struct iov_iter *iter)
 
 static __init int blkdev_init(void)
 {
-       blkdev_dio_pool = bioset_create(4, offsetof(struct blkdev_dio, bio), BIOSET_NEED_BVECS);
-       if (!blkdev_dio_pool)
-               return -ENOMEM;
-       return 0;
+       return bioset_init(&blkdev_dio_pool, 4, offsetof(struct blkdev_dio, bio), BIOSET_NEED_BVECS);
 }
 module_init(blkdev_init);
 
@@ -1324,27 +1321,30 @@ static void flush_disk(struct block_device *bdev, bool kill_dirty)
  * check_disk_size_change - checks for disk size change and adjusts bdev size.
  * @disk: struct gendisk to check
  * @bdev: struct bdev to adjust.
+ * @verbose: if %true log a message about a size change if there is any
  *
  * This routine checks to see if the bdev size does not match the disk size
  * and adjusts it if it differs. When shrinking the bdev size, its all caches
  * are freed.
  */
-void check_disk_size_change(struct gendisk *disk, struct block_device *bdev)
+void check_disk_size_change(struct gendisk *disk, struct block_device *bdev,
+               bool verbose)
 {
        loff_t disk_size, bdev_size;
 
        disk_size = (loff_t)get_capacity(disk) << 9;
        bdev_size = i_size_read(bdev->bd_inode);
        if (disk_size != bdev_size) {
-               printk(KERN_INFO
-                      "%s: detected capacity change from %lld to %lld\n",
-                      disk->disk_name, bdev_size, disk_size);
+               if (verbose) {
+                       printk(KERN_INFO
+                              "%s: detected capacity change from %lld to %lld\n",
+                              disk->disk_name, bdev_size, disk_size);
+               }
                i_size_write(bdev->bd_inode, disk_size);
                if (bdev_size > disk_size)
                        flush_disk(bdev, false);
        }
 }
-EXPORT_SYMBOL(check_disk_size_change);
 
 /**
  * revalidate_disk - wrapper for lower-level driver's revalidate_disk call-back
@@ -1366,7 +1366,7 @@ int revalidate_disk(struct gendisk *disk)
                return ret;
 
        mutex_lock(&bdev->bd_mutex);
-       check_disk_size_change(disk, bdev);
+       check_disk_size_change(disk, bdev, ret == 0);
        bdev->bd_invalidated = 0;
        mutex_unlock(&bdev->bd_mutex);
        bdput(bdev);