diff mbox series

[v4,mdadm,4/5] mdadm: ask user if bitmap is not set

Message ID 20241202015913.3815936-5-yukuai1@huaweicloud.com (mailing list archive)
State New
Headers show
Series mdadm: remove bitmap file support | expand

Checks

Context Check Description
mdraidci/vmtest-md-6_13-PR fail merge-conflict

Commit Message

Yu Kuai Dec. 2, 2024, 1:59 a.m. UTC
From: Yu Kuai <yukuai3@huawei.com>

Instead of auto-forcing bitmap only for large arrays, it is more
reasonable to let user do the chooice if bimtap is not set.

Signed-off-by: Yu Kuai <yukuai3@huawei.com>
---
 Create.c | 12 ------------
 mdadm.c  |  8 ++++++++
 2 files changed, 8 insertions(+), 12 deletions(-)
diff mbox series

Patch

diff --git a/Create.c b/Create.c
index 140a7098..f6d14f76 100644
--- a/Create.c
+++ b/Create.c
@@ -949,18 +949,6 @@  int Create(struct supertype *st, struct mddev_ident *ident, int subdevs,
 		}
 	}
 
-	if (!s->bitmap_file &&
-	    !st->ss->external &&
-	    s->level >= 1 &&
-	    st->ss->add_internal_bitmap &&
-	    s->journaldisks == 0 &&
-	    (s->consistency_policy != CONSISTENCY_POLICY_RESYNC &&
-	     s->consistency_policy != CONSISTENCY_POLICY_PPL) &&
-	    (s->write_behind || s->size > 100*1024*1024ULL)) {
-		if (c->verbose > 0)
-			pr_err("automatically enabling write-intent bitmap on large array\n");
-		s->bitmap_file = "internal";
-	}
 	if (s->bitmap_file && str_is_none(s->bitmap_file) == true)
 		s->bitmap_file = NULL;
 
diff --git a/mdadm.c b/mdadm.c
index 8cb4ba66..b7bcb336 100644
--- a/mdadm.c
+++ b/mdadm.c
@@ -1535,6 +1535,14 @@  int main(int argc, char *argv[])
 			break;
 		}
 
+		if (!s.bitmap_file) {
+			if (c.runstop != 1 && s.level >= 1 &&
+			    ask("To optimalize recovery speed, it is recommended to enable write-indent bitmap, do you want to enable it now?"))
+				s.bitmap_file = "internal";
+			else
+				s.bitmap_file = "none";
+		}
+
 		rv = Create(ss, &ident, devs_found - 1, devlist->next, &s, &c);
 		break;
 	case MISC: