summaryrefslogtreecommitdiffstats
path: root/drivers/md
diff options
context:
space:
mode:
authorYu Kuai <yukuai3@huawei.com>2024-08-26 09:44:50 +0200
committerSong Liu <song@kernel.org>2024-08-27 21:43:16 +0200
commit49f5f5e309e6127957babed7834f5a0e1022f936 (patch)
treeab7a00056d2108621f47c9488f29f3dbc80f5560 /drivers/md
parentmd/md-bitmap: merge md_bitmap_free() into bitmap_operations (diff)
downloadlinux-49f5f5e309e6127957babed7834f5a0e1022f936.tar.xz
linux-49f5f5e309e6127957babed7834f5a0e1022f936.zip
md/md-bitmap: merge md_bitmap_wait_behind_writes() 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. Signed-off-by: Yu Kuai <yukuai3@huawei.com> Link: https://lore.kernel.org/r/20240826074452.1490072-41-yukuai1@huaweicloud.com Signed-off-by: Song Liu <song@kernel.org>
Diffstat (limited to 'drivers/md')
-rw-r--r--drivers/md/md-bitmap.c6
-rw-r--r--drivers/md/md-bitmap.h4
-rw-r--r--drivers/md/md.c2
-rw-r--r--drivers/md/raid1.c2
4 files changed, 6 insertions, 8 deletions
diff --git a/drivers/md/md-bitmap.c b/drivers/md/md-bitmap.c
index 62e4f9d5a559..b5dbfa9728dc 100644
--- a/drivers/md/md-bitmap.c
+++ b/drivers/md/md-bitmap.c
@@ -1863,7 +1863,7 @@ static void md_bitmap_free(struct bitmap *bitmap)
kfree(bitmap);
}
-void md_bitmap_wait_behind_writes(struct mddev *mddev)
+static void bitmap_wait_behind_writes(struct mddev *mddev)
{
struct bitmap *bitmap = mddev->bitmap;
@@ -1876,7 +1876,6 @@ void md_bitmap_wait_behind_writes(struct mddev *mddev)
atomic_read(&bitmap->behind_writes) == 0);
}
}
-EXPORT_SYMBOL_GPL(md_bitmap_wait_behind_writes);
static void bitmap_destroy(struct mddev *mddev)
{
@@ -1885,7 +1884,7 @@ static void bitmap_destroy(struct mddev *mddev)
if (!bitmap) /* there was no bitmap */
return;
- md_bitmap_wait_behind_writes(mddev);
+ bitmap_wait_behind_writes(mddev);
if (!mddev->serialize_policy)
mddev_destroy_serial_pool(mddev, NULL);
@@ -2763,6 +2762,7 @@ static struct bitmap_operations bitmap_ops = {
.dirty_bits = bitmap_dirty_bits,
.unplug = bitmap_unplug,
.daemon_work = bitmap_daemon_work,
+ .wait_behind_writes = bitmap_wait_behind_writes,
.startwrite = bitmap_startwrite,
.endwrite = bitmap_endwrite,
diff --git a/drivers/md/md-bitmap.h b/drivers/md/md-bitmap.h
index 7f6cc6f616b3..bc9cb4ca676e 100644
--- a/drivers/md/md-bitmap.h
+++ b/drivers/md/md-bitmap.h
@@ -259,6 +259,7 @@ struct bitmap_operations {
unsigned long e);
void (*unplug)(struct mddev *mddev, bool sync);
void (*daemon_work)(struct mddev *mddev);
+ void (*wait_behind_writes)(struct mddev *mddev);
int (*startwrite)(struct mddev *mddev, sector_t offset,
unsigned long sectors, bool behind);
@@ -286,9 +287,6 @@ struct bitmap_operations {
/* the bitmap API */
void mddev_set_bitmap_ops(struct mddev *mddev);
-/* these are exported */
-void md_bitmap_wait_behind_writes(struct mddev *mddev);
-
static inline bool md_bitmap_enabled(struct bitmap *bitmap)
{
return bitmap && bitmap->storage.filemap &&
diff --git a/drivers/md/md.c b/drivers/md/md.c
index 00932bd9b0c8..6435688b7165 100644
--- a/drivers/md/md.c
+++ b/drivers/md/md.c
@@ -6498,7 +6498,7 @@ EXPORT_SYMBOL_GPL(md_stop_writes);
static void mddev_detach(struct mddev *mddev)
{
- md_bitmap_wait_behind_writes(mddev);
+ mddev->bitmap_ops->wait_behind_writes(mddev);
if (mddev->pers && mddev->pers->quiesce && !is_md_suspended(mddev)) {
mddev->pers->quiesce(mddev, 1);
mddev->pers->quiesce(mddev, 0);
diff --git a/drivers/md/raid1.c b/drivers/md/raid1.c
index 3e678af8f28a..b15725a7a581 100644
--- a/drivers/md/raid1.c
+++ b/drivers/md/raid1.c
@@ -1371,7 +1371,7 @@ static void raid1_read_request(struct mddev *mddev, struct bio *bio,
* over-take any writes that are 'behind'
*/
mddev_add_trace_msg(mddev, "raid1 wait behind writes");
- md_bitmap_wait_behind_writes(mddev);
+ mddev->bitmap_ops->wait_behind_writes(mddev);
}
if (max_sectors < bio_sectors(bio)) {