Commit efa7c9f9 authored by Jan Kara's avatar Jan Kara Committed by Jens Axboe

block: Get rid of blk_get_backing_dev_info()

blk_get_backing_dev_info() is now a simple dereference. Remove that
function and simplify some code around that.
Signed-off-by: default avatarJan Kara <jack@suse.cz>
Signed-off-by: default avatarJens Axboe <axboe@fb.com>
parent b1d2dc56
...@@ -105,20 +105,6 @@ void blk_queue_congestion_threshold(struct request_queue *q) ...@@ -105,20 +105,6 @@ void blk_queue_congestion_threshold(struct request_queue *q)
q->nr_congestion_off = nr; q->nr_congestion_off = nr;
} }
/**
* blk_get_backing_dev_info - get the address of a queue's backing_dev_info
* @bdev: device
*
* Locates the passed device's request queue and returns the address of its
* backing_dev_info. The return value is never NULL however we may return
* &noop_backing_dev_info if the bdev is not currently open.
*/
struct backing_dev_info *blk_get_backing_dev_info(struct block_device *bdev)
{
return bdev->bd_bdi;
}
EXPORT_SYMBOL(blk_get_backing_dev_info);
void blk_rq_init(struct request_queue *q, struct request *rq) void blk_rq_init(struct request_queue *q, struct request *rq)
{ {
memset(rq, 0, sizeof(*rq)); memset(rq, 0, sizeof(*rq));
......
...@@ -661,7 +661,6 @@ long compat_blkdev_ioctl(struct file *file, unsigned cmd, unsigned long arg) ...@@ -661,7 +661,6 @@ long compat_blkdev_ioctl(struct file *file, unsigned cmd, unsigned long arg)
struct block_device *bdev = inode->i_bdev; struct block_device *bdev = inode->i_bdev;
struct gendisk *disk = bdev->bd_disk; struct gendisk *disk = bdev->bd_disk;
fmode_t mode = file->f_mode; fmode_t mode = file->f_mode;
struct backing_dev_info *bdi;
loff_t size; loff_t size;
unsigned int max_sectors; unsigned int max_sectors;
...@@ -708,9 +707,8 @@ long compat_blkdev_ioctl(struct file *file, unsigned cmd, unsigned long arg) ...@@ -708,9 +707,8 @@ long compat_blkdev_ioctl(struct file *file, unsigned cmd, unsigned long arg)
case BLKFRAGET: case BLKFRAGET:
if (!arg) if (!arg)
return -EINVAL; return -EINVAL;
bdi = blk_get_backing_dev_info(bdev);
return compat_put_long(arg, return compat_put_long(arg,
(bdi->ra_pages * PAGE_SIZE) / 512); (bdev->bd_bdi->ra_pages * PAGE_SIZE) / 512);
case BLKROGET: /* compatible */ case BLKROGET: /* compatible */
return compat_put_int(arg, bdev_read_only(bdev) != 0); return compat_put_int(arg, bdev_read_only(bdev) != 0);
case BLKBSZGET_32: /* get the logical block size (cf. BLKSSZGET) */ case BLKBSZGET_32: /* get the logical block size (cf. BLKSSZGET) */
...@@ -728,8 +726,7 @@ long compat_blkdev_ioctl(struct file *file, unsigned cmd, unsigned long arg) ...@@ -728,8 +726,7 @@ long compat_blkdev_ioctl(struct file *file, unsigned cmd, unsigned long arg)
case BLKFRASET: case BLKFRASET:
if (!capable(CAP_SYS_ADMIN)) if (!capable(CAP_SYS_ADMIN))
return -EACCES; return -EACCES;
bdi = blk_get_backing_dev_info(bdev); bdev->bd_bdi->ra_pages = (arg * 512) / PAGE_SIZE;
bdi->ra_pages = (arg * 512) / PAGE_SIZE;
return 0; return 0;
case BLKGETSIZE: case BLKGETSIZE:
size = i_size_read(bdev->bd_inode); size = i_size_read(bdev->bd_inode);
......
...@@ -505,7 +505,6 @@ static int blkdev_bszset(struct block_device *bdev, fmode_t mode, ...@@ -505,7 +505,6 @@ static int blkdev_bszset(struct block_device *bdev, fmode_t mode,
int blkdev_ioctl(struct block_device *bdev, fmode_t mode, unsigned cmd, int blkdev_ioctl(struct block_device *bdev, fmode_t mode, unsigned cmd,
unsigned long arg) unsigned long arg)
{ {
struct backing_dev_info *bdi;
void __user *argp = (void __user *)arg; void __user *argp = (void __user *)arg;
loff_t size; loff_t size;
unsigned int max_sectors; unsigned int max_sectors;
...@@ -532,8 +531,7 @@ int blkdev_ioctl(struct block_device *bdev, fmode_t mode, unsigned cmd, ...@@ -532,8 +531,7 @@ int blkdev_ioctl(struct block_device *bdev, fmode_t mode, unsigned cmd,
case BLKFRAGET: case BLKFRAGET:
if (!arg) if (!arg)
return -EINVAL; return -EINVAL;
bdi = blk_get_backing_dev_info(bdev); return put_long(arg, (bdev->bd_bdi->ra_pages*PAGE_SIZE) / 512);
return put_long(arg, (bdi->ra_pages * PAGE_SIZE) / 512);
case BLKROGET: case BLKROGET:
return put_int(arg, bdev_read_only(bdev) != 0); return put_int(arg, bdev_read_only(bdev) != 0);
case BLKBSZGET: /* get block device soft block size (cf. BLKSSZGET) */ case BLKBSZGET: /* get block device soft block size (cf. BLKSSZGET) */
...@@ -560,8 +558,7 @@ int blkdev_ioctl(struct block_device *bdev, fmode_t mode, unsigned cmd, ...@@ -560,8 +558,7 @@ int blkdev_ioctl(struct block_device *bdev, fmode_t mode, unsigned cmd,
case BLKFRASET: case BLKFRASET:
if(!capable(CAP_SYS_ADMIN)) if(!capable(CAP_SYS_ADMIN))
return -EACCES; return -EACCES;
bdi = blk_get_backing_dev_info(bdev); bdev->bd_bdi->ra_pages = (arg * 512) / PAGE_SIZE;
bdi->ra_pages = (arg * 512) / PAGE_SIZE;
return 0; return 0;
case BLKBSZSET: case BLKBSZSET:
return blkdev_bszset(bdev, mode, argp); return blkdev_bszset(bdev, mode, argp);
......
...@@ -1800,7 +1800,7 @@ static int btrfs_congested_fn(void *congested_data, int bdi_bits) ...@@ -1800,7 +1800,7 @@ static int btrfs_congested_fn(void *congested_data, int bdi_bits)
list_for_each_entry_rcu(device, &info->fs_devices->devices, dev_list) { list_for_each_entry_rcu(device, &info->fs_devices->devices, dev_list) {
if (!device->bdev) if (!device->bdev)
continue; continue;
bdi = blk_get_backing_dev_info(device->bdev); bdi = device->bdev->bd_bdi;
if (bdi_congested(bdi, bdi_bits)) { if (bdi_congested(bdi, bdi_bits)) {
ret = 1; ret = 1;
break; break;
......
...@@ -366,7 +366,7 @@ static noinline void run_scheduled_bios(struct btrfs_device *device) ...@@ -366,7 +366,7 @@ static noinline void run_scheduled_bios(struct btrfs_device *device)
*/ */
blk_start_plug(&plug); blk_start_plug(&plug);
bdi = blk_get_backing_dev_info(device->bdev); bdi = device->bdev->bd_bdi;
limit = btrfs_async_submit_limit(fs_info); limit = btrfs_async_submit_limit(fs_info);
limit = limit * 2 / 3; limit = limit * 2 / 3;
......
...@@ -757,7 +757,7 @@ xfs_buf_readahead_map( ...@@ -757,7 +757,7 @@ xfs_buf_readahead_map(
int nmaps, int nmaps,
const struct xfs_buf_ops *ops) const struct xfs_buf_ops *ops)
{ {
if (bdi_read_congested(target->bt_bdi)) if (bdi_read_congested(target->bt_bdev->bd_bdi))
return; return;
xfs_buf_read_map(target, map, nmaps, xfs_buf_read_map(target, map, nmaps,
...@@ -1790,7 +1790,6 @@ xfs_alloc_buftarg( ...@@ -1790,7 +1790,6 @@ xfs_alloc_buftarg(
btp->bt_mount = mp; btp->bt_mount = mp;
btp->bt_dev = bdev->bd_dev; btp->bt_dev = bdev->bd_dev;
btp->bt_bdev = bdev; btp->bt_bdev = bdev;
btp->bt_bdi = blk_get_backing_dev_info(bdev);
if (xfs_setsize_buftarg_early(btp, bdev)) if (xfs_setsize_buftarg_early(btp, bdev))
goto error; goto error;
......
...@@ -109,7 +109,6 @@ typedef unsigned int xfs_buf_flags_t; ...@@ -109,7 +109,6 @@ typedef unsigned int xfs_buf_flags_t;
typedef struct xfs_buftarg { typedef struct xfs_buftarg {
dev_t bt_dev; dev_t bt_dev;
struct block_device *bt_bdev; struct block_device *bt_bdev;
struct backing_dev_info *bt_bdi;
struct xfs_mount *bt_mount; struct xfs_mount *bt_mount;
unsigned int bt_meta_sectorsize; unsigned int bt_meta_sectorsize;
size_t bt_meta_sectormask; size_t bt_meta_sectormask;
......
...@@ -191,7 +191,7 @@ static inline struct backing_dev_info *inode_to_bdi(struct inode *inode) ...@@ -191,7 +191,7 @@ static inline struct backing_dev_info *inode_to_bdi(struct inode *inode)
sb = inode->i_sb; sb = inode->i_sb;
#ifdef CONFIG_BLOCK #ifdef CONFIG_BLOCK
if (sb_is_blkdev_sb(sb)) if (sb_is_blkdev_sb(sb))
return blk_get_backing_dev_info(I_BDEV(inode)); return I_BDEV(inode)->bd_bdi;
#endif #endif
return sb->s_bdi; return sb->s_bdi;
} }
......
...@@ -1187,7 +1187,6 @@ extern void blk_queue_rq_timed_out(struct request_queue *, rq_timed_out_fn *); ...@@ -1187,7 +1187,6 @@ extern void blk_queue_rq_timed_out(struct request_queue *, rq_timed_out_fn *);
extern void blk_queue_rq_timeout(struct request_queue *, unsigned int); extern void blk_queue_rq_timeout(struct request_queue *, unsigned int);
extern void blk_queue_flush_queueable(struct request_queue *q, bool queueable); extern void blk_queue_flush_queueable(struct request_queue *q, bool queueable);
extern void blk_queue_write_cache(struct request_queue *q, bool enabled, bool fua); extern void blk_queue_write_cache(struct request_queue *q, bool enabled, bool fua);
extern struct backing_dev_info *blk_get_backing_dev_info(struct block_device *bdev);
static inline unsigned short blk_rq_nr_phys_segments(struct request *rq) static inline unsigned short blk_rq_nr_phys_segments(struct request *rq)
{ {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment