]> git.ipfire.org Git - thirdparty/linux.git/blobdiff - fs/block_dev.c
Merge tag 'for-5.8/drivers-2020-06-01' of git://git.kernel.dk/linux-block
[thirdparty/linux.git] / fs / block_dev.c
index 93672c3f1c78c886eaeffaff6746bf2ee2937d99..47860e5893883253ce8e8bbf03018878bda709a7 100644 (file)
@@ -255,7 +255,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 +449,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 +614,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 +671,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 +712,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 +756,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 +879,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 +1498,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;
 
@@ -2023,8 +2005,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 +2066,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 +2164,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