summaryrefslogtreecommitdiff
path: root/drivers/md/md.c
diff options
context:
space:
mode:
authorYu Kuai <yukuai3@huawei.com>2024-08-26 10:44:32 +0300
committerSong Liu <song@kernel.org>2024-08-27 20:14:17 +0300
commit2d3b130e177f14b461c47880b6e0b338fd6872f5 (patch)
treec6076129bf905a1344f69b32fb722a3657b680a6 /drivers/md/md.c
parentb26313cb96f1b3fd6f07d3243f6cd426c5cbaf39 (diff)
downloadlinux-2d3b130e177f14b461c47880b6e0b338fd6872f5.tar.xz
md/md-bitmap: merge md_bitmap_dirty_bits() into bitmap_operations
So that the implementation won't be exposed, and it'll be possible to invent a new bitmap by replacing bitmap_operations. Also change the parameter from bitmap to mddev, to avoid access bitmap outside md-bitmap.c as much as possible. And while we're here, also fix coding style for bitmap_store(). Signed-off-by: Yu Kuai <yukuai3@huawei.com> Link: https://lore.kernel.org/r/20240826074452.1490072-23-yukuai1@huaweicloud.com Signed-off-by: Song Liu <song@kernel.org>
Diffstat (limited to 'drivers/md/md.c')
-rw-r--r--drivers/md/md.c14
1 files changed, 10 insertions, 4 deletions
diff --git a/drivers/md/md.c b/drivers/md/md.c
index 1dc800113b7b..f72fa8e872f8 100644
--- a/drivers/md/md.c
+++ b/drivers/md/md.c
@@ -4699,14 +4699,20 @@ bitmap_store(struct mddev *mddev, const char *buf, size_t len)
/* buf should be <chunk> <chunk> ... or <chunk>-<chunk> ... (range) */
while (*buf) {
chunk = end_chunk = simple_strtoul(buf, &end, 0);
- if (buf == end) break;
+ if (buf == end)
+ break;
+
if (*end == '-') { /* range */
buf = end + 1;
end_chunk = simple_strtoul(buf, &end, 0);
- if (buf == end) break;
+ if (buf == end)
+ break;
}
- if (*end && !isspace(*end)) break;
- md_bitmap_dirty_bits(mddev->bitmap, chunk, end_chunk);
+
+ if (*end && !isspace(*end))
+ break;
+
+ mddev->bitmap_ops->dirty_bits(mddev, chunk, end_chunk);
buf = skip_spaces(end);
}
md_bitmap_unplug(mddev->bitmap); /* flush the bits to disk */