Commit 18db2a9c authored by Yu Kuai's avatar Yu Kuai Committed by Song Liu

md/md-bitmap: merge md_bitmap_daemon_work() 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: default avatarYu Kuai <yukuai3@huawei.com>
Link: https://lore.kernel.org/r/20240826074452.1490072-34-yukuai1@huaweicloud.comSigned-off-by: default avatarSong Liu <song@kernel.org>
parent 3c9883e7
...@@ -1298,7 +1298,7 @@ static void mddev_set_timeout(struct mddev *mddev, unsigned long timeout, ...@@ -1298,7 +1298,7 @@ static void mddev_set_timeout(struct mddev *mddev, unsigned long timeout,
* bitmap daemon -- periodically wakes up to clean bits and flush pages * bitmap daemon -- periodically wakes up to clean bits and flush pages
* out to disk * out to disk
*/ */
void md_bitmap_daemon_work(struct mddev *mddev) static void bitmap_daemon_work(struct mddev *mddev)
{ {
struct bitmap *bitmap; struct bitmap *bitmap;
unsigned long j; unsigned long j;
...@@ -1815,11 +1815,11 @@ static void bitmap_flush(struct mddev *mddev) ...@@ -1815,11 +1815,11 @@ static void bitmap_flush(struct mddev *mddev)
*/ */
sleep = mddev->bitmap_info.daemon_sleep * 2; sleep = mddev->bitmap_info.daemon_sleep * 2;
bitmap->daemon_lastrun -= sleep; bitmap->daemon_lastrun -= sleep;
md_bitmap_daemon_work(mddev); bitmap_daemon_work(mddev);
bitmap->daemon_lastrun -= sleep; bitmap->daemon_lastrun -= sleep;
md_bitmap_daemon_work(mddev); bitmap_daemon_work(mddev);
bitmap->daemon_lastrun -= sleep; bitmap->daemon_lastrun -= sleep;
md_bitmap_daemon_work(mddev); bitmap_daemon_work(mddev);
if (mddev->bitmap_info.external) if (mddev->bitmap_info.external)
md_super_wait(mddev); md_super_wait(mddev);
bitmap_update_sb(bitmap); bitmap_update_sb(bitmap);
...@@ -2754,6 +2754,7 @@ static struct bitmap_operations bitmap_ops = { ...@@ -2754,6 +2754,7 @@ static struct bitmap_operations bitmap_ops = {
.write_all = bitmap_write_all, .write_all = bitmap_write_all,
.dirty_bits = bitmap_dirty_bits, .dirty_bits = bitmap_dirty_bits,
.unplug = bitmap_unplug, .unplug = bitmap_unplug,
.daemon_work = bitmap_daemon_work,
.startwrite = bitmap_startwrite, .startwrite = bitmap_startwrite,
.endwrite = bitmap_endwrite, .endwrite = bitmap_endwrite,
......
...@@ -255,6 +255,7 @@ struct bitmap_operations { ...@@ -255,6 +255,7 @@ struct bitmap_operations {
void (*dirty_bits)(struct mddev *mddev, unsigned long s, void (*dirty_bits)(struct mddev *mddev, unsigned long s,
unsigned long e); unsigned long e);
void (*unplug)(struct mddev *mddev, bool sync); void (*unplug)(struct mddev *mddev, bool sync);
void (*daemon_work)(struct mddev *mddev);
int (*startwrite)(struct mddev *mddev, sector_t offset, int (*startwrite)(struct mddev *mddev, sector_t offset,
unsigned long sectors, bool behind); unsigned long sectors, bool behind);
...@@ -278,7 +279,6 @@ struct bitmap_operations { ...@@ -278,7 +279,6 @@ struct bitmap_operations {
void mddev_set_bitmap_ops(struct mddev *mddev); void mddev_set_bitmap_ops(struct mddev *mddev);
/* these are exported */ /* these are exported */
void md_bitmap_daemon_work(struct mddev *mddev);
int md_bitmap_resize(struct bitmap *bitmap, sector_t blocks, int md_bitmap_resize(struct bitmap *bitmap, sector_t blocks,
int chunksize, int init); int chunksize, int init);
......
...@@ -9638,7 +9638,7 @@ static void unregister_sync_thread(struct mddev *mddev) ...@@ -9638,7 +9638,7 @@ static void unregister_sync_thread(struct mddev *mddev)
void md_check_recovery(struct mddev *mddev) void md_check_recovery(struct mddev *mddev)
{ {
if (mddev->bitmap) if (mddev->bitmap)
md_bitmap_daemon_work(mddev); mddev->bitmap_ops->daemon_work(mddev);
if (signal_pending(current)) { if (signal_pending(current)) {
if (mddev->pers->sync_request && !mddev->external) { if (mddev->pers->sync_request && !mddev->external) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment