summaryrefslogtreecommitdiffstats
path: root/sysfs.c
diff options
context:
space:
mode:
authorArtur Paszkiewicz <artur.paszkiewicz@intel.com>2017-03-29 11:54:17 +0200
committerJes Sorensen <Jes.Sorensen@gmail.com>2017-03-29 17:32:49 +0200
commit2432ce9b3235f34d00ef6c28ef6b624a32b85530 (patch)
treed707f5657bd71cf1ae23d108695dd154bb19fdcb /sysfs.c
parentDetail: show consistency policy (diff)
downloadmdadm-2432ce9b3235f34d00ef6c28ef6b624a32b85530.tar.xz
mdadm-2432ce9b3235f34d00ef6c28ef6b624a32b85530.zip
imsm: PPL support
Enable creating and assembling IMSM raid5 arrays with PPL. Update the IMSM metadata format to include new fields used for PPL. Add structures for PPL metadata. They are used also by super1 and shared with the kernel, so put them in md_p.h. Write the initial empty PPL header when creating an array. When assembling an array with PPL, validate the PPL header and in case it is not correct allow to overwrite it if --force was provided. Write the PPL location and size for a device to the new rdev sysfs attributes 'ppl_sector' and 'ppl_size'. Enable PPL in the kernel by writing to 'consistency_policy' before the array is activated. Signed-off-by: Artur Paszkiewicz <artur.paszkiewicz@intel.com> Signed-off-by: Jes Sorensen <Jes.Sorensen@gmail.com>
Diffstat (limited to 'sysfs.c')
-rw-r--r--sysfs.c14
1 files changed, 14 insertions, 0 deletions
diff --git a/sysfs.c b/sysfs.c
index 53589a76..2a91ba0a 100644
--- a/sysfs.c
+++ b/sysfs.c
@@ -689,6 +689,16 @@ int sysfs_set_array(struct mdinfo *info, int vers)
* once the reshape completes.
*/
}
+
+ if (info->consistency_policy == CONSISTENCY_POLICY_PPL) {
+ if (sysfs_set_str(info, NULL, "consistency_policy",
+ map_num(consistency_policies,
+ info->consistency_policy))) {
+ pr_err("This kernel does not support PPL\n");
+ return 1;
+ }
+ }
+
return rv;
}
@@ -720,6 +730,10 @@ int sysfs_add_disk(struct mdinfo *sra, struct mdinfo *sd, int resume)
rv = sysfs_set_num(sra, sd, "offset", sd->data_offset);
rv |= sysfs_set_num(sra, sd, "size", (sd->component_size+1) / 2);
if (sra->array.level != LEVEL_CONTAINER) {
+ if (sd->consistency_policy == CONSISTENCY_POLICY_PPL) {
+ rv |= sysfs_set_num(sra, sd, "ppl_sector", sd->ppl_sector);
+ rv |= sysfs_set_num(sra, sd, "ppl_size", sd->ppl_size);
+ }
if (sd->recovery_start == MaxSector)
/* This can correctly fail if array isn't started,
* yet, so just ignore status for now.