]> git.ipfire.org Git - thirdparty/mdadm.git/commitdiff
Enable bitmap support for external metadata
authorJakub Radtke <jakub.radtke@intel.com>
Fri, 15 Jan 2021 05:46:55 +0000 (00:46 -0500)
committerJes Sorensen <jsorensen@fb.com>
Tue, 9 Mar 2021 22:17:43 +0000 (17:17 -0500)
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>
Assemble.c
Create.c
mdadm.h

index 48556d8c819dc85fac7ccda954cfbaefd9561908..5c6aca9253ac8da062b254847410ee2729562b45 100644 (file)
@@ -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;
index 51f8826b642cbafe52c9da6efbfefbf425ad75b0..b50cb246ed8390291b7f97f27945bf8fa0d1e74b 100644 (file)
--- 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 60575af0a3bb1bd6fbc96860fb3c333300aa7118..273fa5098b93ecb0d7bbbb9fce6f078ed7fc2c64 100644 (file)
--- 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
         */