Skip to content

Commit dfe15ac

Browse files
hreineckeneilbrown
authored andcommitted
md: wakeup thread upon rdev_dec_pending()
After each call to rdev_dec_pending() we should wakeup the md thread if the device is found to be faulty. Otherwise we'll incur heavy delays on failing devices. Signed-off-by: Neil Brown <[email protected]> Signed-off-by: Hannes Reinecke <[email protected]>
1 parent 6791875 commit dfe15ac

File tree

1 file changed

+10
-7
lines changed

1 file changed

+10
-7
lines changed

drivers/md/md.h

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -474,13 +474,6 @@ static inline int mddev_trylock(struct mddev *mddev)
474474
}
475475
extern void mddev_unlock(struct mddev *mddev);
476476

477-
static inline void rdev_dec_pending(struct md_rdev *rdev, struct mddev *mddev)
478-
{
479-
int faulty = test_bit(Faulty, &rdev->flags);
480-
if (atomic_dec_and_test(&rdev->nr_pending) && faulty)
481-
set_bit(MD_RECOVERY_NEEDED, &mddev->recovery);
482-
}
483-
484477
static inline void md_sync_acct(struct block_device *bdev, unsigned long nr_sectors)
485478
{
486479
atomic_add(nr_sectors, &bdev->bd_contains->bd_disk->sync_io);
@@ -666,4 +659,14 @@ static inline int mddev_check_plugged(struct mddev *mddev)
666659
return !!blk_check_plugged(md_unplug, mddev,
667660
sizeof(struct blk_plug_cb));
668661
}
662+
663+
static inline void rdev_dec_pending(struct md_rdev *rdev, struct mddev *mddev)
664+
{
665+
int faulty = test_bit(Faulty, &rdev->flags);
666+
if (atomic_dec_and_test(&rdev->nr_pending) && faulty) {
667+
set_bit(MD_RECOVERY_NEEDED, &mddev->recovery);
668+
md_wakeup_thread(mddev->thread);
669+
}
670+
}
671+
669672
#endif /* _MD_MD_H */

0 commit comments

Comments
 (0)