mirror of
https://github.com/AuxXxilium/linux_dsm_epyc7002.git
synced 2025-04-06 20:02:33 +07:00
MD: add a new disk role to present write journal device
Next patches will use a disk as raid5/6 journaling. We need a new disk role to present the journal device and add MD_FEATURE_JOURNAL to feature_map for backward compability. Signed-off-by: Song Liu <songliubraving@fb.com> Signed-off-by: Shaohua Li <shli@fb.com> Signed-off-by: NeilBrown <neilb@suse.com>
This commit is contained in:
parent
c4d4c91b44
commit
bac624f3f8
@ -1638,6 +1638,15 @@ static int super_1_validate(struct mddev *mddev, struct md_rdev *rdev)
|
|||||||
case MD_DISK_ROLE_FAULTY: /* faulty */
|
case MD_DISK_ROLE_FAULTY: /* faulty */
|
||||||
set_bit(Faulty, &rdev->flags);
|
set_bit(Faulty, &rdev->flags);
|
||||||
break;
|
break;
|
||||||
|
case MD_DISK_ROLE_JOURNAL: /* journal device */
|
||||||
|
if (!(le32_to_cpu(sb->feature_map) & MD_FEATURE_JOURNAL)) {
|
||||||
|
/* journal device without journal feature */
|
||||||
|
printk(KERN_WARNING
|
||||||
|
"md: journal device provided without journal feature, ignoring the device\n");
|
||||||
|
return -EINVAL;
|
||||||
|
}
|
||||||
|
set_bit(Journal, &rdev->flags);
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
rdev->saved_raid_disk = role;
|
rdev->saved_raid_disk = role;
|
||||||
if ((le32_to_cpu(sb->feature_map) &
|
if ((le32_to_cpu(sb->feature_map) &
|
||||||
@ -1796,7 +1805,10 @@ static void super_1_sync(struct mddev *mddev, struct md_rdev *rdev)
|
|||||||
sb->dev_roles[i] = cpu_to_le16(MD_DISK_ROLE_FAULTY);
|
sb->dev_roles[i] = cpu_to_le16(MD_DISK_ROLE_FAULTY);
|
||||||
else if (test_bit(In_sync, &rdev2->flags))
|
else if (test_bit(In_sync, &rdev2->flags))
|
||||||
sb->dev_roles[i] = cpu_to_le16(rdev2->raid_disk);
|
sb->dev_roles[i] = cpu_to_le16(rdev2->raid_disk);
|
||||||
else if (rdev2->raid_disk >= 0)
|
else if (test_bit(Journal, &rdev2->flags)) {
|
||||||
|
sb->dev_roles[i] = cpu_to_le16(MD_DISK_ROLE_JOURNAL);
|
||||||
|
sb->feature_map |= cpu_to_le32(MD_FEATURE_JOURNAL);
|
||||||
|
} else if (rdev2->raid_disk >= 0)
|
||||||
sb->dev_roles[i] = cpu_to_le16(rdev2->raid_disk);
|
sb->dev_roles[i] = cpu_to_le16(rdev2->raid_disk);
|
||||||
else
|
else
|
||||||
sb->dev_roles[i] = cpu_to_le16(MD_DISK_ROLE_SPARE);
|
sb->dev_roles[i] = cpu_to_le16(MD_DISK_ROLE_SPARE);
|
||||||
@ -5840,7 +5852,8 @@ static int get_disk_info(struct mddev *mddev, void __user * arg)
|
|||||||
else if (test_bit(In_sync, &rdev->flags)) {
|
else if (test_bit(In_sync, &rdev->flags)) {
|
||||||
info.state |= (1<<MD_DISK_ACTIVE);
|
info.state |= (1<<MD_DISK_ACTIVE);
|
||||||
info.state |= (1<<MD_DISK_SYNC);
|
info.state |= (1<<MD_DISK_SYNC);
|
||||||
}
|
} else if (test_bit(Journal, &rdev->flags))
|
||||||
|
info.state |= (1<<MD_DISK_JOURNAL);
|
||||||
if (test_bit(WriteMostly, &rdev->flags))
|
if (test_bit(WriteMostly, &rdev->flags))
|
||||||
info.state |= (1<<MD_DISK_WRITEMOSTLY);
|
info.state |= (1<<MD_DISK_WRITEMOSTLY);
|
||||||
} else {
|
} else {
|
||||||
@ -5955,6 +5968,8 @@ static int add_new_disk(struct mddev *mddev, mdu_disk_info_t *info)
|
|||||||
else
|
else
|
||||||
clear_bit(WriteMostly, &rdev->flags);
|
clear_bit(WriteMostly, &rdev->flags);
|
||||||
|
|
||||||
|
if (info->state & (1<<MD_DISK_JOURNAL))
|
||||||
|
set_bit(Journal, &rdev->flags);
|
||||||
/*
|
/*
|
||||||
* check whether the device shows up in other nodes
|
* check whether the device shows up in other nodes
|
||||||
*/
|
*/
|
||||||
@ -7330,6 +7345,10 @@ static int md_seq_show(struct seq_file *seq, void *v)
|
|||||||
seq_printf(seq, "(F)");
|
seq_printf(seq, "(F)");
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
if (test_bit(Journal, &rdev->flags)) {
|
||||||
|
seq_printf(seq, "(J)");
|
||||||
|
continue;
|
||||||
|
}
|
||||||
if (rdev->raid_disk < 0)
|
if (rdev->raid_disk < 0)
|
||||||
seq_printf(seq, "(S)"); /* spare */
|
seq_printf(seq, "(S)"); /* spare */
|
||||||
if (test_bit(Replacement, &rdev->flags))
|
if (test_bit(Replacement, &rdev->flags))
|
||||||
|
@ -172,6 +172,11 @@ enum flag_bits {
|
|||||||
* This device is seen locally but not
|
* This device is seen locally but not
|
||||||
* by the whole cluster
|
* by the whole cluster
|
||||||
*/
|
*/
|
||||||
|
Journal, /* This device is used as journal for
|
||||||
|
* raid-5/6.
|
||||||
|
* Usually, this device should be faster
|
||||||
|
* than other devices in the array
|
||||||
|
*/
|
||||||
};
|
};
|
||||||
|
|
||||||
#define BB_LEN_MASK (0x00000000000001FFULL)
|
#define BB_LEN_MASK (0x00000000000001FFULL)
|
||||||
|
@ -89,9 +89,11 @@
|
|||||||
* read requests will only be sent here in
|
* read requests will only be sent here in
|
||||||
* dire need
|
* dire need
|
||||||
*/
|
*/
|
||||||
|
#define MD_DISK_JOURNAL 18 /* disk is used as the write journal in RAID-5/6 */
|
||||||
|
|
||||||
#define MD_DISK_ROLE_SPARE 0xffff
|
#define MD_DISK_ROLE_SPARE 0xffff
|
||||||
#define MD_DISK_ROLE_FAULTY 0xfffe
|
#define MD_DISK_ROLE_FAULTY 0xfffe
|
||||||
|
#define MD_DISK_ROLE_JOURNAL 0xfffd
|
||||||
#define MD_DISK_ROLE_MAX 0xff00 /* max value of regular disk role */
|
#define MD_DISK_ROLE_MAX 0xff00 /* max value of regular disk role */
|
||||||
|
|
||||||
typedef struct mdp_device_descriptor_s {
|
typedef struct mdp_device_descriptor_s {
|
||||||
@ -307,6 +309,7 @@ struct mdp_superblock_1 {
|
|||||||
* is guided by bitmap.
|
* is guided by bitmap.
|
||||||
*/
|
*/
|
||||||
#define MD_FEATURE_CLUSTERED 256 /* clustered MD */
|
#define MD_FEATURE_CLUSTERED 256 /* clustered MD */
|
||||||
|
#define MD_FEATURE_JOURNAL 512 /* support write cache */
|
||||||
#define MD_FEATURE_ALL (MD_FEATURE_BITMAP_OFFSET \
|
#define MD_FEATURE_ALL (MD_FEATURE_BITMAP_OFFSET \
|
||||||
|MD_FEATURE_RECOVERY_OFFSET \
|
|MD_FEATURE_RECOVERY_OFFSET \
|
||||||
|MD_FEATURE_RESHAPE_ACTIVE \
|
|MD_FEATURE_RESHAPE_ACTIVE \
|
||||||
|
Loading…
Reference in New Issue
Block a user