drm/nouveau/acr: store a mask of LS falcons the HSFW can bootstrap
[linux-2.6-microblaze.git] / fs / block_dev.c
index 93672c3..0ae656e 100644 (file)
@@ -75,7 +75,7 @@ static void bdev_write_inode(struct block_device *bdev)
 }
 
 /* Kill _all_ buffers and pagecache , dirty or not.. */
-void kill_bdev(struct block_device *bdev)
+static void kill_bdev(struct block_device *bdev)
 {
        struct address_space *mapping = bdev->bd_inode->i_mapping;
 
@@ -84,8 +84,7 @@ void kill_bdev(struct block_device *bdev)
 
        invalidate_bh_lrus();
        truncate_inode_pages(mapping, 0);
-}      
-EXPORT_SYMBOL(kill_bdev);
+}
 
 /* Invalidate clean unused buffers and pagecache. */
 void invalidate_bdev(struct block_device *bdev)
@@ -255,7 +254,7 @@ __blkdev_direct_IO_simple(struct kiocb *iocb, struct iov_iter *iter,
                        break;
                if (!(iocb->ki_flags & IOCB_HIPRI) ||
                    !blk_poll(bdev_get_queue(bdev), qc, true))
-                       io_schedule();
+                       blk_io_schedule();
        }
        __set_current_state(TASK_RUNNING);
 
@@ -449,7 +448,7 @@ __blkdev_direct_IO(struct kiocb *iocb, struct iov_iter *iter, int nr_pages)
 
                if (!(iocb->ki_flags & IOCB_HIPRI) ||
                    !blk_poll(bdev_get_queue(bdev), qc, true))
-                       io_schedule();
+                       blk_io_schedule();
        }
        __set_current_state(TASK_RUNNING);
 
@@ -614,10 +613,9 @@ static int blkdev_readpage(struct file * file, struct page * page)
        return block_read_full_page(page, blkdev_get_block);
 }
 
-static int blkdev_readpages(struct file *file, struct address_space *mapping,
-                       struct list_head *pages, unsigned nr_pages)
+static void blkdev_readahead(struct readahead_control *rac)
 {
-       return mpage_readpages(mapping, pages, nr_pages, blkdev_get_block);
+       mpage_readahead(rac, blkdev_get_block);
 }
 
 static int blkdev_write_begin(struct file *file, struct address_space *mapping,
@@ -672,7 +670,7 @@ int blkdev_fsync(struct file *filp, loff_t start, loff_t end, int datasync)
         * i_mutex and doing so causes performance issues with concurrent
         * O_SYNC writers to a block device.
         */
-       error = blkdev_issue_flush(bdev, GFP_KERNEL, NULL);
+       error = blkdev_issue_flush(bdev, GFP_KERNEL);
        if (error == -EOPNOTSUPP)
                error = 0;
 
@@ -713,7 +711,6 @@ int bdev_read_page(struct block_device *bdev, sector_t sector,
        blk_queue_exit(bdev->bd_queue);
        return result;
 }
-EXPORT_SYMBOL_GPL(bdev_read_page);
 
 /**
  * bdev_write_page() - Start writing a page to a block device
@@ -758,7 +755,6 @@ int bdev_write_page(struct block_device *bdev, sector_t sector,
        blk_queue_exit(bdev->bd_queue);
        return result;
 }
-EXPORT_SYMBOL_GPL(bdev_write_page);
 
 /*
  * pseudo-fs
@@ -882,21 +878,6 @@ static int bdev_set(struct inode *inode, void *data)
 
 static LIST_HEAD(all_bdevs);
 
-/*
- * If there is a bdev inode for this device, unhash it so that it gets evicted
- * as soon as last inode reference is dropped.
- */
-void bdev_unhash_inode(dev_t dev)
-{
-       struct inode *inode;
-
-       inode = ilookup5(blockdev_superblock, hash(dev), bdev_test, &dev);
-       if (inode) {
-               remove_inode_hash(inode);
-               iput(inode);
-       }
-}
-
 struct block_device *bdget(dev_t dev)
 {
        struct block_device *bdev;
@@ -1516,7 +1497,7 @@ int bdev_disk_changed(struct block_device *bdev, bool invalidate)
        lockdep_assert_held(&bdev->bd_mutex);
 
 rescan:
-       ret = blk_drop_partitions(disk, bdev);
+       ret = blk_drop_partitions(bdev);
        if (ret)
                return ret;
 
@@ -1583,10 +1564,8 @@ static int __blkdev_get(struct block_device *bdev, fmode_t mode, int for_part)
         */
        if (!for_part) {
                ret = devcgroup_inode_permission(bdev->bd_inode, perm);
-               if (ret != 0) {
-                       bdput(bdev);
+               if (ret != 0)
                        return ret;
-               }
        }
 
  restart:
@@ -1655,8 +1634,10 @@ static int __blkdev_get(struct block_device *bdev, fmode_t mode, int for_part)
                                goto out_clear;
                        BUG_ON(for_part);
                        ret = __blkdev_get(whole, mode, 1);
-                       if (ret)
+                       if (ret) {
+                               bdput(whole);
                                goto out_clear;
+                       }
                        bdev->bd_contains = whole;
                        bdev->bd_part = disk_get_part(disk, partno);
                        if (!(disk->flags & GENHD_FL_UP) ||
@@ -1706,7 +1687,6 @@ static int __blkdev_get(struct block_device *bdev, fmode_t mode, int for_part)
        disk_unblock_events(disk);
        put_disk_and_module(disk);
  out:
-       bdput(bdev);
 
        return ret;
 }
@@ -1773,6 +1753,9 @@ int blkdev_get(struct block_device *bdev, fmode_t mode, void *holder)
                bdput(whole);
        }
 
+       if (res)
+               bdput(bdev);
+
        return res;
 }
 EXPORT_SYMBOL(blkdev_get);
@@ -2023,8 +2006,7 @@ ssize_t blkdev_write_iter(struct kiocb *iocb, struct iov_iter *from)
        if (bdev_read_only(I_BDEV(bd_inode)))
                return -EPERM;
 
-       /* uswsusp needs write permission to the swap */
-       if (IS_SWAPFILE(bd_inode) && !hibernation_available())
+       if (IS_SWAPFILE(bd_inode) && !is_hibernate_resume_dev(bd_inode))
                return -ETXTBSY;
 
        if (!iov_iter_count(from))
@@ -2085,7 +2067,7 @@ static int blkdev_writepages(struct address_space *mapping,
 
 static const struct address_space_operations def_blk_aops = {
        .readpage       = blkdev_readpage,
-       .readpages      = blkdev_readpages,
+       .readahead      = blkdev_readahead,
        .writepage      = blkdev_writepage,
        .write_begin    = blkdev_write_begin,
        .write_end      = blkdev_write_end,
@@ -2183,18 +2165,6 @@ const struct file_operations def_blk_fops = {
        .fallocate      = blkdev_fallocate,
 };
 
-int ioctl_by_bdev(struct block_device *bdev, unsigned cmd, unsigned long arg)
-{
-       int res;
-       mm_segment_t old_fs = get_fs();
-       set_fs(KERNEL_DS);
-       res = blkdev_ioctl(bdev, 0, cmd, arg);
-       set_fs(old_fs);
-       return res;
-}
-
-EXPORT_SYMBOL(ioctl_by_bdev);
-
 /**
  * lookup_bdev  - lookup a struct block_device by name
  * @pathname:  special file representing the block device