summaryrefslogtreecommitdiffstats
path: root/bitmap.c
diff options
context:
space:
mode:
authorYu Kuai <yukuai3@huawei.com>2024-12-02 02:59:13 +0100
committerMariusz Tkaczyk <mariusz.tkaczyk@linux.intel.com>2024-12-03 15:55:15 +0100
commit581ba1341017943d740ed8163d68f04671c2fdde (patch)
treee356c38fbe7b86af13593f321fa0da09a991e76f /bitmap.c
parentmdadm: ask user if bitmap is not set (diff)
downloadmdadm-581ba1341017943d740ed8163d68f04671c2fdde.tar.xz
mdadm-581ba1341017943d740ed8163d68f04671c2fdde.zip
mdadm: remove bitmap file support
Because it's marked deprecated for a long time now, and it's not worthy to support it for new bitmap. Now that we don't need to store filename for bitmap, also declare a new enum type bitmap_type to simplify code. Signed-off-by: Yu Kuai <yukuai3@huawei.com> Signed-off-by: Mariusz Tkaczyk <mariusz.tkaczyk@linux.intel.com>
Diffstat (limited to 'bitmap.c')
-rw-r--r--bitmap.c44
1 files changed, 24 insertions, 20 deletions
diff --git a/bitmap.c b/bitmap.c
index 5110ae2f..c62d18d4 100644
--- a/bitmap.c
+++ b/bitmap.c
@@ -200,28 +200,32 @@ bitmap_file_open(char *filename, struct supertype **stp, int node_num, int fd)
close(fd);
return -1;
}
- if ((stb.st_mode & S_IFMT) == S_IFBLK) {
- /* block device, so we are probably after an internal bitmap */
- if (!st)
- st = guess_super(fd);
- if (!st) {
- /* just look at device... */
- lseek(fd, 0, 0);
- } else if (!st->ss->locate_bitmap) {
- pr_err("No bitmap possible with %s metadata\n",
- st->ss->name);
- close(fd);
- return -1;
- } else {
- if (st->ss->locate_bitmap(st, fd, node_num)) {
- pr_err("%s doesn't have bitmap\n", filename);
- close(fd);
- fd = -1;
- }
- }
- *stp = st;
+
+ if ((stb.st_mode & S_IFMT) != S_IFBLK) {
+ pr_err("bitmap file is not supported %s\n", filename);
+ close(fd);
+ return -1;
+ }
+
+ if (!st)
+ st = guess_super(fd);
+
+ if (!st) {
+ /* just look at device... */
+ lseek(fd, 0, 0);
+ } else if (!st->ss->locate_bitmap) {
+ pr_err("No bitmap possible with %s metadata\n", st->ss->name);
+ close(fd);
+ return -1;
+ }
+
+ if (st->ss->locate_bitmap(st, fd, node_num)) {
+ pr_err("%s doesn't have bitmap\n", filename);
+ close(fd);
+ fd = -1;
}
+ *stp = st;
return fd;
}