summaryrefslogtreecommitdiff
path: root/drivers/md/md-bitmap.c
diff options
context:
space:
mode:
authorYu Kuai <yukuai3@huawei.com>2024-08-26 10:44:31 +0300
committerSong Liu <song@kernel.org>2024-08-27 20:14:16 +0300
commitb26313cb96f1b3fd6f07d3243f6cd426c5cbaf39 (patch)
tree37a0acad4c6bc56cb661eac395b9b907886b0d43 /drivers/md/md-bitmap.c
parentea076ceb35d66d29fc0a50c15a4b0248c5122d2c (diff)
downloadlinux-b26313cb96f1b3fd6f07d3243f6cd426c5cbaf39.tar.xz
md/md-bitmap: merge bitmap_write_all() 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. Signed-off-by: Yu Kuai <yukuai3@huawei.com> Link: https://lore.kernel.org/r/20240826074452.1490072-22-yukuai1@huaweicloud.com Signed-off-by: Song Liu <song@kernel.org>
Diffstat (limited to 'drivers/md/md-bitmap.c')
-rw-r--r--drivers/md/md-bitmap.c14
1 files changed, 7 insertions, 7 deletions
diff --git a/drivers/md/md-bitmap.c b/drivers/md/md-bitmap.c
index b2fbec3997f2..47d074bf292d 100644
--- a/drivers/md/md-bitmap.c
+++ b/drivers/md/md-bitmap.c
@@ -1224,22 +1224,21 @@ static int md_bitmap_init_from_disk(struct bitmap *bitmap, sector_t start)
return ret;
}
-void md_bitmap_write_all(struct bitmap *bitmap)
+/* just flag bitmap pages as needing to be written. */
+static void bitmap_write_all(struct mddev *mddev)
{
- /* We don't actually write all bitmap blocks here,
- * just flag them as needing to be written
- */
int i;
+ struct bitmap *bitmap = mddev->bitmap;
if (!bitmap || !bitmap->storage.filemap)
return;
+
+ /* Only one copy, so nothing needed */
if (bitmap->storage.file)
- /* Only one copy, so nothing needed */
return;
for (i = 0; i < bitmap->storage.file_pages; i++)
- set_page_attr(bitmap, i,
- BITMAP_PAGE_NEEDWRITE);
+ set_page_attr(bitmap, i, BITMAP_PAGE_NEEDWRITE);
bitmap->allclean = 0;
}
@@ -2720,6 +2719,7 @@ static struct bitmap_operations bitmap_ops = {
.load = bitmap_load,
.destroy = bitmap_destroy,
.flush = bitmap_flush,
+ .write_all = bitmap_write_all,
.update_sb = bitmap_update_sb,
.get_stats = bitmap_get_stats,