summaryrefslogtreecommitdiff
path: root/drivers/md/md.c
diff options
context:
space:
mode:
authorChristoph Hellwig <hch@lst.de>2023-06-15 08:48:39 +0200
committerSong Liu <song@kernel.org>2023-07-27 00:13:29 -0700
commita34d4ef82c3c4bd8bda817e9fb53ef37c5595ddd (patch)
tree19f0e7a3a90aadd603d603382a0a6fdb8a5cadd7 /drivers/md/md.c
parentd7038f951828da19fa9aafddfa087b69032c9687 (diff)
downloadlwn-a34d4ef82c3c4bd8bda817e9fb53ef37c5595ddd.tar.gz
lwn-a34d4ef82c3c4bd8bda817e9fb53ef37c5595ddd.zip
md: make bitmap file support optional
The support for write intent bitmaps in files on an external files in md is a hot mess that abuses ->bmap to map file offsets into physical device objects, and also abuses buffer_heads in a creative way. Make this code optional so that MD can be built into future kernels without buffer_head support, and so that we can eventually deprecate it. Note this does not affect the internal bitmap support, which has none of the problems. Signed-off-by: Christoph Hellwig <hch@lst.de> Reviewed-by: Hannes Reinecke <hare@suse.de> Reviewed-by: Himanshu Madhani <himanshu.madhani@oracle.com> Signed-off-by: Song Liu <song@kernel.org> Link: https://lore.kernel.org/r/20230615064840.629492-11-hch@lst.de
Diffstat (limited to 'drivers/md/md.c')
-rw-r--r--drivers/md/md.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/drivers/md/md.c b/drivers/md/md.c
index 320d71537359..f46996a95b0c 100644
--- a/drivers/md/md.c
+++ b/drivers/md/md.c
@@ -7043,6 +7043,13 @@ static int set_bitmap_file(struct mddev *mddev, int fd)
if (mddev->bitmap || mddev->bitmap_info.file)
return -EEXIST; /* cannot add when bitmap is present */
+
+ if (!IS_ENABLED(CONFIG_MD_BITMAP_FILE)) {
+ pr_warn("%s: bitmap files not supported by this kernel\n",
+ mdname(mddev));
+ return -EINVAL;
+ }
+
f = fget(fd);
if (f == NULL) {