summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorYu Kuai <yukuai3@huawei.com>2024-08-26 15:44:29 +0800
committerSong Liu <song@kernel.org>2024-08-27 10:14:16 -0700
commit696936838bc18a761ed778910975d51cf2c35e3a (patch)
tree96c4b334fe60a7b812bf5a211e818cd966d7e5a2
parentfe59b34676b4ec6b48a7b436d3422fc9317e047a (diff)
downloadlinux-stable-696936838bc18a761ed778910975d51cf2c35e3a.tar.gz
linux-stable-696936838bc18a761ed778910975d51cf2c35e3a.tar.bz2
linux-stable-696936838bc18a761ed778910975d51cf2c35e3a.zip
md/md-bitmap: merge md_bitmap_status() 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-20-yukuai1@huaweicloud.com Signed-off-by: Song Liu <song@kernel.org>
-rw-r--r--drivers/md/md-bitmap.c4
-rw-r--r--drivers/md/md-bitmap.h3
-rw-r--r--drivers/md/md-cluster.c8
-rw-r--r--drivers/md/md.c11
-rw-r--r--drivers/md/raid1.c2
5 files changed, 14 insertions, 14 deletions
diff --git a/drivers/md/md-bitmap.c b/drivers/md/md-bitmap.c
index 23c7d4be3ffd..b2fbec3997f2 100644
--- a/drivers/md/md-bitmap.c
+++ b/drivers/md/md-bitmap.c
@@ -2105,7 +2105,7 @@ void md_bitmap_set_pages(struct bitmap *bitmap, unsigned long pages)
}
EXPORT_SYMBOL_GPL(md_bitmap_set_pages);
-int md_bitmap_get_stats(struct bitmap *bitmap, struct md_bitmap_stats *stats)
+static int bitmap_get_stats(struct bitmap *bitmap, struct md_bitmap_stats *stats)
{
struct bitmap_storage *storage;
struct bitmap_counts *counts;
@@ -2131,7 +2131,6 @@ int md_bitmap_get_stats(struct bitmap *bitmap, struct md_bitmap_stats *stats)
stats->events_cleared = bitmap->events_cleared;
return 0;
}
-EXPORT_SYMBOL_GPL(md_bitmap_get_stats);
int md_bitmap_resize(struct bitmap *bitmap, sector_t blocks,
int chunksize, int init)
@@ -2723,6 +2722,7 @@ static struct bitmap_operations bitmap_ops = {
.flush = bitmap_flush,
.update_sb = bitmap_update_sb,
+ .get_stats = bitmap_get_stats,
};
void mddev_set_bitmap_ops(struct mddev *mddev)
diff --git a/drivers/md/md-bitmap.h b/drivers/md/md-bitmap.h
index ca0d8696136f..1df238cb82f0 100644
--- a/drivers/md/md-bitmap.h
+++ b/drivers/md/md-bitmap.h
@@ -253,6 +253,7 @@ struct bitmap_operations {
void (*flush)(struct mddev *mddev);
void (*update_sb)(struct bitmap *bitmap);
+ int (*get_stats)(struct bitmap *bitmap, struct md_bitmap_stats *stats);
};
/* the bitmap API */
@@ -260,8 +261,6 @@ void mddev_set_bitmap_ops(struct mddev *mddev);
/* these are used only by md/bitmap */
-int md_bitmap_get_stats(struct bitmap *bitmap, struct md_bitmap_stats *stats);
-
int md_bitmap_setallbits(struct bitmap *bitmap);
void md_bitmap_write_all(struct bitmap *bitmap);
diff --git a/drivers/md/md-cluster.c b/drivers/md/md-cluster.c
index ca30881556bd..a5f1135cc1fa 100644
--- a/drivers/md/md-cluster.c
+++ b/drivers/md/md-cluster.c
@@ -1148,7 +1148,7 @@ static int resize_bitmaps(struct mddev *mddev, sector_t newsize, sector_t oldsiz
unsigned long my_pages;
int i, rv;
- rv = md_bitmap_get_stats(bitmap, &stats);
+ rv = mddev->bitmap_ops->get_stats(bitmap, &stats);
if (rv)
return rv;
@@ -1175,7 +1175,7 @@ static int resize_bitmaps(struct mddev *mddev, sector_t newsize, sector_t oldsiz
goto out;
}
- rv = md_bitmap_get_stats(bitmap, &stats);
+ rv = mddev->bitmap_ops->get_stats(bitmap, &stats);
if (rv)
goto out;
/*
@@ -1225,7 +1225,7 @@ static int cluster_check_sync_size(struct mddev *mddev)
char str[64];
int i, rv;
- rv = md_bitmap_get_stats(bitmap, &stats);
+ rv = mddev->bitmap_ops->get_stats(bitmap, &stats);
if (rv)
return rv;
@@ -1258,7 +1258,7 @@ static int cluster_check_sync_size(struct mddev *mddev)
mddev->bitmap_ops->update_sb(bitmap);
lockres_free(bm_lockres);
- rv = md_bitmap_get_stats(bitmap, &stats);
+ rv = mddev->bitmap_ops->get_stats(bitmap, &stats);
if (rv) {
md_bitmap_free(bitmap);
return rv;
diff --git a/drivers/md/md.c b/drivers/md/md.c
index 5f9df96eab51..6c184748f317 100644
--- a/drivers/md/md.c
+++ b/drivers/md/md.c
@@ -1378,7 +1378,7 @@ static u64 md_bitmap_events_cleared(struct mddev *mddev)
struct md_bitmap_stats stats;
int err;
- err = md_bitmap_get_stats(mddev->bitmap, &stats);
+ err = mddev->bitmap_ops->get_stats(mddev->bitmap, &stats);
if (err)
return 0;
@@ -2354,11 +2354,12 @@ super_1_allow_new_offset(struct md_rdev *rdev,
return 0;
if (!rdev->mddev->bitmap_info.file) {
+ struct mddev *mddev = rdev->mddev;
struct md_bitmap_stats stats;
int err;
- err = md_bitmap_get_stats(rdev->mddev->bitmap, &stats);
- if (!err && rdev->sb_start + rdev->mddev->bitmap_info.offset +
+ err = mddev->bitmap_ops->get_stats(mddev->bitmap, &stats);
+ if (!err && rdev->sb_start + mddev->bitmap_info.offset +
stats.file_pages * (PAGE_SIZE >> 9) > new_offset)
return 0;
}
@@ -7588,7 +7589,7 @@ static int update_array_info(struct mddev *mddev, mdu_array_info_t *info)
} else {
struct md_bitmap_stats stats;
- rv = md_bitmap_get_stats(mddev->bitmap, &stats);
+ rv = mddev->bitmap_ops->get_stats(mddev->bitmap, &stats);
if (rv)
goto err;
@@ -8388,7 +8389,7 @@ static void md_bitmap_status(struct seq_file *seq, struct mddev *mddev)
unsigned long chunk_kb;
int err;
- err = md_bitmap_get_stats(mddev->bitmap, &stats);
+ err = mddev->bitmap_ops->get_stats(mddev->bitmap, &stats);
if (err)
return;
diff --git a/drivers/md/raid1.c b/drivers/md/raid1.c
index b6c4e44f9b4b..d490a9ac484f 100644
--- a/drivers/md/raid1.c
+++ b/drivers/md/raid1.c
@@ -1599,7 +1599,7 @@ static void raid1_write_request(struct mddev *mddev, struct bio *bio,
* Not if there are too many, or cannot
* allocate memory, or a reader on WriteMostly
* is waiting for behind writes to flush */
- err = md_bitmap_get_stats(bitmap, &stats);
+ err = mddev->bitmap_ops->get_stats(bitmap, &stats);
if (!err && write_behind && !stats.behind_wait &&
stats.behind_writes < max_write_behind)
alloc_behind_master_bio(r1_bio, bio);