mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2024-12-28 16:53:49 +00:00
md: add a new helper rdev_blocked()
The helper will be used in later patches for raid1/raid10/raid5, the difference is that Faulty rdev with unacknowledged bad block will not be considered blocked. Signed-off-by: Yu Kuai <yukuai3@huawei.com> Tested-by: Mariusz Tkaczyk <mariusz.tkaczyk@linux.intel.com> Link: https://lore.kernel.org/r/20241031033114.3845582-2-yukuai1@huaweicloud.com Signed-off-by: Song Liu <song@kernel.org>
This commit is contained in:
parent
1e79892e76
commit
4abfce19c7
@ -1002,6 +1002,30 @@ static inline void mddev_trace_remap(struct mddev *mddev, struct bio *bio,
|
||||
trace_block_bio_remap(bio, disk_devt(mddev->gendisk), sector);
|
||||
}
|
||||
|
||||
static inline bool rdev_blocked(struct md_rdev *rdev)
|
||||
{
|
||||
/*
|
||||
* Blocked will be set by error handler and cleared by daemon after
|
||||
* updating superblock, meanwhile write IO should be blocked to prevent
|
||||
* reading old data after power failure.
|
||||
*/
|
||||
if (test_bit(Blocked, &rdev->flags))
|
||||
return true;
|
||||
|
||||
/*
|
||||
* Faulty device should not be accessed anymore, there is no need to
|
||||
* wait for bad block to be acknowledged.
|
||||
*/
|
||||
if (test_bit(Faulty, &rdev->flags))
|
||||
return false;
|
||||
|
||||
/* rdev is blocked by badblocks. */
|
||||
if (test_bit(BlockedBadBlocks, &rdev->flags))
|
||||
return true;
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
#define mddev_add_trace_msg(mddev, fmt, args...) \
|
||||
do { \
|
||||
if (!mddev_is_dm(mddev)) \
|
||||
|
Loading…
Reference in New Issue
Block a user