diff mbox series

btrfs: cleanup finding rotating device

Message ID 1b19262076d9ae10d3ff81f73209249375ae25bc.1642048893.git.anand.jain@oracle.com (mailing list archive)
State New, archived
Headers show
Series btrfs: cleanup finding rotating device | expand

Commit Message

Anand Jain Jan. 13, 2022, 4:44 a.m. UTC
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>
---
 fs/btrfs/volumes.c | 8 ++------
 1 file changed, 2 insertions(+), 6 deletions(-)

Comments

Nikolay Borisov Jan. 13, 2022, 7:38 a.m. UTC | #1
On 13.01.22 г. 6:44, Anand Jain wrote:
> 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>
> ---
>  fs/btrfs/volumes.c | 8 ++------
>  1 file changed, 2 insertions(+), 6 deletions(-)
> 
> diff --git a/fs/btrfs/volumes.c b/fs/btrfs/volumes.c
> index 7e92bf130137..68ea15e8e3cb 100644
> --- a/fs/btrfs/volumes.c
> +++ b/fs/btrfs/volumes.c
> @@ -609,7 +609,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;
> @@ -651,8 +650,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;

Eliminate the altogether:

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

>  
>  	device->bdev = bdev;
> @@ -2600,7 +2598,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;
> @@ -2676,7 +2673,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;
> @@ -2724,7 +2720,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;

Ditto

>  
>  	orig_super_total_bytes = btrfs_super_total_bytes(fs_info->super_copy);
>
diff mbox series

Patch

diff --git a/fs/btrfs/volumes.c b/fs/btrfs/volumes.c
index 7e92bf130137..68ea15e8e3cb 100644
--- a/fs/btrfs/volumes.c
+++ b/fs/btrfs/volumes.c
@@ -609,7 +609,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;
@@ -651,8 +650,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;
@@ -2600,7 +2598,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;
@@ -2676,7 +2673,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;
@@ -2724,7 +2720,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);