summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJakub Radtke <jakub.radtke@intel.com>2021-01-15 00:46:55 -0500
committerJes Sorensen <jsorensen@fb.com>2021-03-09 17:17:43 -0500
commitb554ab5c9bba537b4a282b3863ead6b3b52dd2e1 (patch)
tree0e13c7c9a6557674ff460346d992880ea6baff5e
parentb090e910756ea1165be5ac879746ab4bb83a2f91 (diff)
downloadmdadm-b554ab5c9bba537b4a282b3863ead6b3b52dd2e1.tar.gz
Enable bitmap support for external metadata
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. Signed-off-by: Jakub Radtke <jakub.radtke@intel.com> Signed-off-by: Jes Sorensen <jsorensen@fb.com>
-rw-r--r--Assemble.c7
-rw-r--r--Create.c12
-rw-r--r--mdadm.h3
3 files changed, 22 insertions, 0 deletions
diff --git a/Assemble.c b/Assemble.c
index 48556d8c..5c6aca92 100644
--- a/Assemble.c
+++ b/Assemble.c
@@ -2094,6 +2094,13 @@ 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..b50cb246 100644
--- a/Create.c
+++ b/Create.c
@@ -989,6 +989,18 @@ 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 60575af0..273fa509 100644
--- a/mdadm.h
+++ b/mdadm.h
@@ -1007,6 +1007,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
*/