@@ -916,24 +916,6 @@ static void loop_free_idle_workers_timer(struct timer_list *timer)
916
916
return loop_free_idle_workers (lo , false);
917
917
}
918
918
919
- static void loop_update_rotational (struct loop_device * lo )
920
- {
921
- struct file * file = lo -> lo_backing_file ;
922
- struct inode * file_inode = file -> f_mapping -> host ;
923
- struct block_device * file_bdev = file_inode -> i_sb -> s_bdev ;
924
- struct request_queue * q = lo -> lo_queue ;
925
- bool nonrot = true;
926
-
927
- /* not all filesystems (e.g. tmpfs) have a sb->s_bdev */
928
- if (file_bdev )
929
- nonrot = bdev_nonrot (file_bdev );
930
-
931
- if (nonrot )
932
- blk_queue_flag_set (QUEUE_FLAG_NONROT , q );
933
- else
934
- blk_queue_flag_clear (QUEUE_FLAG_NONROT , q );
935
- }
936
-
937
919
/**
938
920
* loop_set_status_from_info - configure device from loop_info
939
921
* @lo: struct loop_device to configure
@@ -1003,6 +985,10 @@ static int loop_reconfigure_limits(struct loop_device *lo, unsigned short bsize)
1003
985
lim .logical_block_size = bsize ;
1004
986
lim .physical_block_size = bsize ;
1005
987
lim .io_min = bsize ;
988
+ if (!backing_bdev || bdev_nonrot (backing_bdev ))
989
+ blk_queue_flag_set (QUEUE_FLAG_NONROT , lo -> lo_queue );
990
+ else
991
+ blk_queue_flag_clear (QUEUE_FLAG_NONROT , lo -> lo_queue );
1006
992
loop_config_discard (lo , & lim );
1007
993
return queue_limits_commit_update (lo -> lo_queue , & lim );
1008
994
}
@@ -1099,7 +1085,6 @@ static int loop_configure(struct loop_device *lo, blk_mode_t mode,
1099
1085
if (WARN_ON_ONCE (error ))
1100
1086
goto out_unlock ;
1101
1087
1102
- loop_update_rotational (lo );
1103
1088
loop_update_dio (lo );
1104
1089
loop_sysfs_init (lo );
1105
1090
0 commit comments