@@ -418,74 +418,10 @@ static void md_submit_bio(struct bio *bio)
418418 md_handle_request (mddev , bio );
419419}
420420
421- /* mddev_suspend makes sure no new requests are submitted
422- * to the device, and that any requests that have been submitted
423- * are completely handled.
424- * Once mddev_detach() is called and completes, the module will be
425- * completely unused.
421+ /*
422+ * Make sure no new requests are submitted to the device, and any requests that
423+ * have been submitted are completely handled.
426424 */
427- void mddev_suspend (struct mddev * mddev )
428- {
429- struct md_thread * thread = rcu_dereference_protected (mddev -> thread ,
430- lockdep_is_held (& mddev -> reconfig_mutex ));
431-
432- WARN_ON_ONCE (thread && current == thread -> tsk );
433-
434- /* can't concurrent with __mddev_suspend() and __mddev_resume() */
435- mutex_lock (& mddev -> suspend_mutex );
436- if (mddev -> suspended ++ ) {
437- mutex_unlock (& mddev -> suspend_mutex );
438- return ;
439- }
440-
441- wake_up (& mddev -> sb_wait );
442- set_bit (MD_ALLOW_SB_UPDATE , & mddev -> flags );
443- percpu_ref_kill (& mddev -> active_io );
444-
445- /*
446- * TODO: cleanup 'pers->prepare_suspend after all callers are replaced
447- * by __mddev_suspend().
448- */
449- if (mddev -> pers && mddev -> pers -> prepare_suspend )
450- mddev -> pers -> prepare_suspend (mddev );
451-
452- wait_event (mddev -> sb_wait , percpu_ref_is_zero (& mddev -> active_io ));
453- clear_bit_unlock (MD_ALLOW_SB_UPDATE , & mddev -> flags );
454- wait_event (mddev -> sb_wait , !test_bit (MD_UPDATING_SB , & mddev -> flags ));
455-
456- del_timer_sync (& mddev -> safemode_timer );
457- /* restrict memory reclaim I/O during raid array is suspend */
458- mddev -> noio_flag = memalloc_noio_save ();
459-
460- mutex_unlock (& mddev -> suspend_mutex );
461- }
462- EXPORT_SYMBOL_GPL (mddev_suspend );
463-
464- void mddev_resume (struct mddev * mddev )
465- {
466- lockdep_assert_held (& mddev -> reconfig_mutex );
467-
468- /* can't concurrent with __mddev_suspend() and __mddev_resume() */
469- mutex_lock (& mddev -> suspend_mutex );
470- if (-- mddev -> suspended ) {
471- mutex_unlock (& mddev -> suspend_mutex );
472- return ;
473- }
474-
475- /* entred the memalloc scope from mddev_suspend() */
476- memalloc_noio_restore (mddev -> noio_flag );
477-
478- percpu_ref_resurrect (& mddev -> active_io );
479- wake_up (& mddev -> sb_wait );
480-
481- set_bit (MD_RECOVERY_NEEDED , & mddev -> recovery );
482- md_wakeup_thread (mddev -> thread );
483- md_wakeup_thread (mddev -> sync_thread ); /* possibly kick off a reshape */
484-
485- mutex_unlock (& mddev -> suspend_mutex );
486- }
487- EXPORT_SYMBOL_GPL (mddev_resume );
488-
489425int __mddev_suspend (struct mddev * mddev , bool interruptible )
490426{
491427 int err = 0 ;
@@ -9503,18 +9439,6 @@ static void md_start_sync(struct work_struct *ws)
95039439 */
95049440void md_check_recovery (struct mddev * mddev )
95059441{
9506- if (test_bit (MD_ALLOW_SB_UPDATE , & mddev -> flags ) && mddev -> sb_flags ) {
9507- /* Write superblock - thread that called mddev_suspend()
9508- * holds reconfig_mutex for us.
9509- */
9510- set_bit (MD_UPDATING_SB , & mddev -> flags );
9511- smp_mb__after_atomic ();
9512- if (test_bit (MD_ALLOW_SB_UPDATE , & mddev -> flags ))
9513- md_update_sb (mddev , 0 );
9514- clear_bit_unlock (MD_UPDATING_SB , & mddev -> flags );
9515- wake_up (& mddev -> sb_wait );
9516- }
9517-
95189442 if (READ_ONCE (mddev -> suspended ))
95199443 return ;
95209444
0 commit comments