37
37
#include <linux/msdos_fs.h>
38
38
#include <linux/vfs_compat.h>
39
39
40
- char * zfs_vdev_scheduler = VDEV_SCHEDULER ;
41
40
static void * zfs_vdev_holder = VDEV_HOLDER ;
42
41
43
42
/* size of the "reserved" partition, in blocks */
@@ -141,75 +140,6 @@ vdev_disk_error(zio_t *zio)
141
140
zio -> io_flags );
142
141
}
143
142
144
- /*
145
- * Use the Linux 'noop' elevator for zfs managed block devices. This
146
- * strikes the ideal balance by allowing the zfs elevator to do all
147
- * request ordering and prioritization. While allowing the Linux
148
- * elevator to do the maximum front/back merging allowed by the
149
- * physical device. This yields the largest possible requests for
150
- * the device with the lowest total overhead.
151
- */
152
- static void
153
- vdev_elevator_switch (vdev_t * v , char * elevator )
154
- {
155
- vdev_disk_t * vd = v -> vdev_tsd ;
156
- struct request_queue * q ;
157
- char * device ;
158
- int error ;
159
-
160
- for (int c = 0 ; c < v -> vdev_children ; c ++ )
161
- vdev_elevator_switch (v -> vdev_child [c ], elevator );
162
-
163
- if (!v -> vdev_ops -> vdev_op_leaf || vd -> vd_bdev == NULL )
164
- return ;
165
-
166
- q = bdev_get_queue (vd -> vd_bdev );
167
- device = vd -> vd_bdev -> bd_disk -> disk_name ;
168
-
169
- /*
170
- * Skip devices which are not whole disks (partitions).
171
- * Device-mapper devices are excepted since they may be whole
172
- * disks despite the vdev_wholedisk flag, in which case we can
173
- * and should switch the elevator. If the device-mapper device
174
- * does not have an elevator (i.e. dm-raid, dm-crypt, etc.) the
175
- * "Skip devices without schedulers" check below will fail.
176
- */
177
- if (!v -> vdev_wholedisk && strncmp (device , "dm-" , 3 ) != 0 )
178
- return ;
179
-
180
- /* Leave existing scheduler when set to "none" */
181
- if ((strncmp (elevator , "none" , 4 ) == 0 ) && (strlen (elevator ) == 4 ))
182
- return ;
183
-
184
- /*
185
- * The elevator_change() function was available in kernels from
186
- * 2.6.36 to 4.11. When not available fall back to using the user
187
- * mode helper functionality to set the elevator via sysfs. This
188
- * requires /bin/echo and sysfs to be mounted which may not be true
189
- * early in the boot process.
190
- */
191
- #ifdef HAVE_ELEVATOR_CHANGE
192
- error = elevator_change (q , elevator );
193
- #else
194
- #define SET_SCHEDULER_CMD \
195
- "exec 0</dev/null " \
196
- " 1>/sys/block/%s/queue/scheduler " \
197
- " 2>/dev/null; " \
198
- "echo %s"
199
-
200
- char * argv [] = { "/bin/sh" , "-c" , NULL , NULL };
201
- char * envp [] = { NULL };
202
-
203
- argv [2 ] = kmem_asprintf (SET_SCHEDULER_CMD , device , elevator );
204
- error = call_usermodehelper (argv [0 ], argv , envp , UMH_NO_WAIT );
205
- kmem_strfree (argv [2 ]);
206
- #endif /* HAVE_ELEVATOR_CHANGE */
207
- if (error ) {
208
- zfs_dbgmsg ("Unable to set \"%s\" scheduler for %s (%s): %d" ,
209
- elevator , v -> vdev_path , device , error );
210
- }
211
- }
212
-
213
143
static int
214
144
vdev_disk_open (vdev_t * v , uint64_t * psize , uint64_t * max_psize ,
215
145
uint64_t * ashift )
@@ -343,9 +273,6 @@ vdev_disk_open(vdev_t *v, uint64_t *psize, uint64_t *max_psize,
343
273
/* Based on the minimum sector size set the block size */
344
274
* ashift = highbit64 (MAX (block_size , SPA_MINBLOCKSIZE )) - 1 ;
345
275
346
- /* Try to set the io scheduler elevator algorithm */
347
- (void ) vdev_elevator_switch (v , zfs_vdev_scheduler );
348
-
349
276
return (0 );
350
277
}
351
278
@@ -857,44 +784,6 @@ vdev_disk_rele(vdev_t *vd)
857
784
/* XXX: Implement me as a vnode rele for the device */
858
785
}
859
786
860
- static int
861
- param_set_vdev_scheduler (const char * val , zfs_kernel_param_t * kp )
862
- {
863
- spa_t * spa = NULL ;
864
- char * p ;
865
-
866
- if (val == NULL )
867
- return (SET_ERROR (- EINVAL ));
868
-
869
- if ((p = strchr (val , '\n' )) != NULL )
870
- * p = '\0' ;
871
-
872
- if (spa_mode_global != SPA_MODE_UNINIT ) {
873
- mutex_enter (& spa_namespace_lock );
874
- while ((spa = spa_next (spa )) != NULL ) {
875
- if (spa_state (spa ) != POOL_STATE_ACTIVE ||
876
- !spa_writeable (spa ) || spa_suspended (spa ))
877
- continue ;
878
-
879
- spa_open_ref (spa , FTAG );
880
- mutex_exit (& spa_namespace_lock );
881
- vdev_elevator_switch (spa -> spa_root_vdev , (char * )val );
882
- mutex_enter (& spa_namespace_lock );
883
- spa_close (spa , FTAG );
884
- }
885
- mutex_exit (& spa_namespace_lock );
886
- }
887
-
888
-
889
- int error = param_set_charp (val , kp );
890
- if (error == 0 ) {
891
- printk (KERN_INFO "The 'zfs_vdev_scheduler' module option "
892
- "will be removed in a future release.\n" );
893
- }
894
-
895
- return (error );
896
- }
897
-
898
787
vdev_ops_t vdev_disk_ops = {
899
788
.vdev_op_open = vdev_disk_open ,
900
789
.vdev_op_close = vdev_disk_close ,
@@ -911,6 +800,25 @@ vdev_ops_t vdev_disk_ops = {
911
800
.vdev_op_leaf = B_TRUE /* leaf vdev */
912
801
};
913
802
803
+ /*
804
+ * The zfs_vdev_scheduler module option has been deprecated. Setting this
805
+ * value no longer has any effect. It has not yet been entirely removed
806
+ * to allow the module to be loaded if this option is specified in the
807
+ * /etc/modprobe.d/zfs.conf file. The following warning will be logged.
808
+ */
809
+ static int
810
+ param_set_vdev_scheduler (const char * val , zfs_kernel_param_t * kp )
811
+ {
812
+ int error = param_set_charp (val , kp );
813
+ if (error == 0 ) {
814
+ printk (KERN_INFO "The 'zfs_vdev_scheduler' module option "
815
+ "is not supported.\n" );
816
+ }
817
+
818
+ return (error );
819
+ }
820
+
821
+ char * zfs_vdev_scheduler = "unused" ;
914
822
module_param_call (zfs_vdev_scheduler , param_set_vdev_scheduler ,
915
823
param_get_charp , & zfs_vdev_scheduler , 0644 );
916
824
MODULE_PARM_DESC (zfs_vdev_scheduler , "I/O scheduler" );
0 commit comments