btrfs: cleanup temporary variables when finding rotational device status
authorAnand Jain <anand.jain@oracle.com>
Thu, 13 Jan 2022 04:44:10 +0000 (12:44 +0800)
committerDavid Sterba <dsterba@suse.com>
Mon, 14 Mar 2022 12:13:47 +0000 (13:13 +0100)
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>
fs/btrfs/volumes.c

index 1e1120e..a91e51b 100644 (file)
@@ -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;
@@ -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;
@@ -2591,7 +2589,6 @@ error:
 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;
@@ -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;
@@ -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);