Skip to content

Commit

Permalink
btrfs: cleanup temporary variables when finding rotational device status
Browse files Browse the repository at this point in the history
The pointer to struct request_queue is used only to get device type
rotating or the non-rotating. So use it directly.

Signed-off-by: Anand Jain <anand.jain@oracle.com>
Reviewed-by: David Sterba <dsterba@suse.com>
Signed-off-by: David Sterba <dsterba@suse.com>
  • Loading branch information
Anand Jain authored and David Sterba committed Mar 14, 2022
1 parent 330a5bf commit 823f8e5
Showing 1 changed file with 2 additions and 6 deletions.
8 changes: 2 additions & 6 deletions fs/btrfs/volumes.c
Original file line number Diff line number Diff line change
Expand Up @@ -602,7 +602,6 @@ static int btrfs_open_one_device(struct btrfs_fs_devices *fs_devices,
struct btrfs_device *device, fmode_t flags,
void *holder)
{
struct request_queue *q;
struct block_device *bdev;
struct btrfs_super_block *disk_super;
u64 devid;
Expand Down Expand Up @@ -644,8 +643,7 @@ static int btrfs_open_one_device(struct btrfs_fs_devices *fs_devices,
set_bit(BTRFS_DEV_STATE_WRITEABLE, &device->dev_state);
}

q = bdev_get_queue(bdev);
if (!blk_queue_nonrot(q))
if (!blk_queue_nonrot(bdev_get_queue(bdev)))
fs_devices->rotating = true;

device->bdev = bdev;
Expand Down Expand Up @@ -2591,7 +2589,6 @@ static int btrfs_finish_sprout(struct btrfs_trans_handle *trans)
int btrfs_init_new_device(struct btrfs_fs_info *fs_info, const char *device_path)
{
struct btrfs_root *root = fs_info->dev_root;
struct request_queue *q;
struct btrfs_trans_handle *trans;
struct btrfs_device *device;
struct block_device *bdev;
Expand Down Expand Up @@ -2667,7 +2664,6 @@ int btrfs_init_new_device(struct btrfs_fs_info *fs_info, const char *device_path
goto error_free_zone;
}

q = bdev_get_queue(bdev);
set_bit(BTRFS_DEV_STATE_WRITEABLE, &device->dev_state);
device->generation = trans->transid;
device->io_width = fs_info->sectorsize;
Expand Down Expand Up @@ -2715,7 +2711,7 @@ int btrfs_init_new_device(struct btrfs_fs_info *fs_info, const char *device_path

atomic64_add(device->total_bytes, &fs_info->free_chunk_space);

if (!blk_queue_nonrot(q))
if (!blk_queue_nonrot(bdev_get_queue(bdev)))
fs_devices->rotating = true;

orig_super_total_bytes = btrfs_super_total_bytes(fs_info->super_copy);
Expand Down

0 comments on commit 823f8e5

Please sign in to comment.