File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -8087,7 +8087,8 @@ void md_wakeup_thread(struct md_thread __rcu *thread)
80878087 if (t ) {
80888088 pr_debug ("md: waking up MD thread %s.\n" , t -> tsk -> comm );
80898089 set_bit (THREAD_WAKEUP , & t -> flags );
8090- wake_up (& t -> wqueue );
8090+ if (wq_has_sleeper (& t -> wqueue ))
8091+ wake_up (& t -> wqueue );
80918092 }
80928093 rcu_read_unlock ();
80938094}
@@ -8576,14 +8577,19 @@ static int is_mddev_idle(struct mddev *mddev, int init)
85768577{
85778578 struct md_rdev * rdev ;
85788579 int idle ;
8579- int curr_events ;
8580+ long long curr_events ;
85808581
85818582 idle = 1 ;
85828583 rcu_read_lock ();
85838584 rdev_for_each_rcu (rdev , mddev ) {
85848585 struct gendisk * disk = rdev -> bdev -> bd_disk ;
8585- curr_events = (int )part_stat_read_accum (disk -> part0 , sectors ) -
8586- atomic_read (& disk -> sync_io );
8586+
8587+ if (!init && !blk_queue_io_stat (disk -> queue ))
8588+ continue ;
8589+
8590+ curr_events =
8591+ (long long )part_stat_read_accum (disk -> part0 , sectors ) -
8592+ atomic64_read (& disk -> sync_io );
85878593 /* sync IO will cause sync_io to increase before the disk_stats
85888594 * as sync_io is counted when a request starts, and
85898595 * disk_stats is counted when it completes.
Original file line number Diff line number Diff line change @@ -51,7 +51,7 @@ struct md_rdev {
5151
5252 sector_t sectors ; /* Device size (in 512bytes sectors) */
5353 struct mddev * mddev ; /* RAID array if running */
54- int last_events ; /* IO event timestamp */
54+ long long last_events ; /* IO event timestamp */
5555
5656 /*
5757 * If meta_bdev is non-NULL, it means that a separate device is
@@ -621,7 +621,8 @@ extern void mddev_unlock(struct mddev *mddev);
621621
622622static inline void md_sync_acct (struct block_device * bdev , unsigned long nr_sectors )
623623{
624- atomic_add (nr_sectors , & bdev -> bd_disk -> sync_io );
624+ if (blk_queue_io_stat (bdev -> bd_disk -> queue ))
625+ atomic64_add (nr_sectors , & bdev -> bd_disk -> sync_io );
625626}
626627
627628static inline void md_sync_acct_bio (struct bio * bio , unsigned long nr_sectors )
Original file line number Diff line number Diff line change 3636 */
3737
3838#include <linux/blkdev.h>
39- #include <linux/delay.h>
4039#include <linux/kthread.h>
4140#include <linux/raid/pq.h>
4241#include <linux/async_tx.h>
@@ -6734,6 +6733,9 @@ static void raid5d(struct md_thread *thread)
67346733 int batch_size , released ;
67356734 unsigned int offset ;
67366735
6736+ if (test_bit (MD_SB_CHANGE_PENDING , & mddev -> sb_flags ))
6737+ break ;
6738+
67376739 released = release_stripe_list (conf , conf -> temp_inactive_list );
67386740 if (released )
67396741 clear_bit (R5_DID_ALLOC , & conf -> cache_state );
@@ -6770,18 +6772,7 @@ static void raid5d(struct md_thread *thread)
67706772 spin_unlock_irq (& conf -> device_lock );
67716773 md_check_recovery (mddev );
67726774 spin_lock_irq (& conf -> device_lock );
6773-
6774- /*
6775- * Waiting on MD_SB_CHANGE_PENDING below may deadlock
6776- * seeing md_check_recovery() is needed to clear
6777- * the flag when using mdmon.
6778- */
6779- continue ;
67806775 }
6781-
6782- wait_event_lock_irq (mddev -> sb_wait ,
6783- !test_bit (MD_SB_CHANGE_PENDING , & mddev -> sb_flags ),
6784- conf -> device_lock );
67856776 }
67866777 pr_debug ("%d stripes handled\n" , handled );
67876778
Original file line number Diff line number Diff line change @@ -172,7 +172,7 @@ struct gendisk {
172172 struct list_head slave_bdevs ;
173173#endif
174174 struct timer_rand_state * random ;
175- atomic_t sync_io ; /* RAID */
175+ atomic64_t sync_io ; /* RAID */
176176 struct disk_events * ev ;
177177
178178#ifdef CONFIG_BLK_DEV_ZONED
You can’t perform that action at this time.
0 commit comments