From: Jakub Radtke <jakub.radtke@xxxxxxxxx> The patch enables the implementation of a write-intent bitmap for external metadata. Configuration of the internal bitmaps for non-native metadata requires the extension in superswitch to perform an additional sysfs setup before the array is activated. Change-Id: I77be689b9f4f815dd00bb14ef52267686b273fb5 Signed-off-by: Jakub Radtke <jakub.radtke@xxxxxxxxx> --- Assemble.c | 6 ++++++ Create.c | 10 ++++++++++ mdadm.h | 3 +++ 3 files changed, 19 insertions(+) diff --git a/Assemble.c b/Assemble.c index ed0ddfb1..479ff5ec 100644 --- a/Assemble.c +++ b/Assemble.c @@ -2094,6 +2094,12 @@ int assemble_container_content(struct supertype *st, int mdfd, } } + /* Before activating the array, perform extra steps required to configure the internal + * write-intent bitmap. + */ + if (content->consistency_policy == CONSISTENCY_POLICY_BITMAP && + st->ss->set_bitmap) + st->ss->set_bitmap(st, content); if (start_reshape) { int spare = content->array.raid_disks + expansion; diff --git a/Create.c b/Create.c index 51f8826b..751f18c1 100644 --- a/Create.c +++ b/Create.c @@ -989,6 +989,16 @@ int Create(struct supertype *st, char *mddev, st->ss->free_super(st); goto abort_locked; } + /* Before activating the array, perform extra steps required + * to configure the internal write-intent bitmap. + */ + if (info_new.consistency_policy == + CONSISTENCY_POLICY_BITMAP && + st->ss->set_bitmap && + st->ss->set_bitmap(st, &info)) { + st->ss->free_super(st); + goto abort_locked; + } /* update parent container uuid */ if (me) { diff --git a/mdadm.h b/mdadm.h index 1ee6c92e..0cf94239 100644 --- a/mdadm.h +++ b/mdadm.h @@ -1006,6 +1006,9 @@ extern struct superswitch { int (*add_internal_bitmap)(struct supertype *st, int *chunkp, int delay, int write_behind, unsigned long long size, int may_change, int major); + /* Perform additional setup required to activate a bitmap. + */ + int (*set_bitmap)(struct supertype *st, struct mdinfo *info); /* Seek 'fd' to start of write-intent-bitmap. Must be an * md-native format bitmap */ -- 2.26.2