]> www.infradead.org Git - users/jedix/linux-maple.git/commitdiff
md/md-bitmap: merge md_bitmap_update_sb() into bitmap_operations
authorYu Kuai <yukuai3@huawei.com>
Mon, 26 Aug 2024 07:44:28 +0000 (15:44 +0800)
committerSong Liu <song@kernel.org>
Tue, 27 Aug 2024 17:14:16 +0000 (10:14 -0700)
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-19-yukuai1@huaweicloud.com
Signed-off-by: Song Liu <song@kernel.org>
drivers/md/md-bitmap.c
drivers/md/md-bitmap.h
drivers/md/md-cluster.c
drivers/md/md.c

index 86444cbee56e15b7c1eb0195a202437de198f026..23c7d4be3ffdf2318ceb2097ee127d86a5b62ef6 100644 (file)
@@ -472,7 +472,7 @@ static void md_bitmap_wait_writes(struct bitmap *bitmap)
 
 
 /* update the event counter and sync the superblock to disk */
-void md_bitmap_update_sb(struct bitmap *bitmap)
+static void bitmap_update_sb(struct bitmap *bitmap)
 {
        bitmap_super_t *sb;
 
@@ -510,7 +510,6 @@ void md_bitmap_update_sb(struct bitmap *bitmap)
                write_sb_page(bitmap, bitmap->storage.sb_index,
                              bitmap->storage.sb_page, 1);
 }
-EXPORT_SYMBOL(md_bitmap_update_sb);
 
 static void bitmap_print_sb(struct bitmap *bitmap)
 {
@@ -892,7 +891,7 @@ static void md_bitmap_file_unmap(struct bitmap_storage *store)
 static void md_bitmap_file_kick(struct bitmap *bitmap)
 {
        if (!test_and_set_bit(BITMAP_STALE, &bitmap->flags)) {
-               md_bitmap_update_sb(bitmap);
+               bitmap_update_sb(bitmap);
 
                if (bitmap->storage.file) {
                        pr_warn("%s: kicking failed bitmap file %pD4 from array!\n",
@@ -1792,7 +1791,7 @@ static void bitmap_flush(struct mddev *mddev)
        md_bitmap_daemon_work(mddev);
        if (mddev->bitmap_info.external)
                md_super_wait(mddev);
-       md_bitmap_update_sb(bitmap);
+       bitmap_update_sb(bitmap);
 }
 
 /*
@@ -2022,7 +2021,7 @@ static int bitmap_load(struct mddev *mddev)
        mddev_set_timeout(mddev, mddev->bitmap_info.daemon_sleep, true);
        md_wakeup_thread(mddev->thread);
 
-       md_bitmap_update_sb(bitmap);
+       bitmap_update_sb(bitmap);
 
        if (test_bit(BITMAP_WRITE_ERROR, &bitmap->flags))
                err = -EIO;
@@ -2083,7 +2082,7 @@ int md_bitmap_copy_from_slot(struct mddev *mddev, int slot,
        }
 
        if (clear_bits) {
-               md_bitmap_update_sb(bitmap);
+               bitmap_update_sb(bitmap);
                /* BITMAP_PAGE_PENDING is set, but bitmap_unplug needs
                 * BITMAP_PAGE_DIRTY or _NEEDWRITE to write ... */
                for (i = 0; i < bitmap->storage.file_pages; i++)
@@ -2578,7 +2577,7 @@ backlog_store(struct mddev *mddev, const char *buf, size_t len)
                        mddev_create_serial_pool(mddev, rdev);
        }
        if (old_mwb != backlog)
-               md_bitmap_update_sb(mddev->bitmap);
+               bitmap_update_sb(mddev->bitmap);
 
        mddev_unlock_and_resume(mddev);
        return len;
@@ -2722,6 +2721,8 @@ static struct bitmap_operations bitmap_ops = {
        .load                   = bitmap_load,
        .destroy                = bitmap_destroy,
        .flush                  = bitmap_flush,
+
+       .update_sb              = bitmap_update_sb,
 };
 
 void mddev_set_bitmap_ops(struct mddev *mddev)
index 5d5811c89b77119e51c3c6bb9a8ba75bdd7e933a..ca0d8696136f6596ee31b7dc9c3b1b143e09291a 100644 (file)
@@ -251,6 +251,8 @@ struct bitmap_operations {
        int (*load)(struct mddev *mddev);
        void (*destroy)(struct mddev *mddev);
        void (*flush)(struct mddev *mddev);
+
+       void (*update_sb)(struct bitmap *bitmap);
 };
 
 /* the bitmap API */
@@ -258,7 +260,6 @@ void mddev_set_bitmap_ops(struct mddev *mddev);
 
 /* these are used only by md/bitmap */
 
-void md_bitmap_update_sb(struct bitmap *bitmap);
 int md_bitmap_get_stats(struct bitmap *bitmap, struct md_bitmap_stats *stats);
 
 int  md_bitmap_setallbits(struct bitmap *bitmap);
index 59f7fbca783bc8a5cefd3911a4c76ba85437d20a..ca30881556bdf4dd84e9a01a63228f030bdea41a 100644 (file)
@@ -1255,7 +1255,7 @@ static int cluster_check_sync_size(struct mddev *mddev)
                bm_lockres->flags |= DLM_LKF_NOQUEUE;
                rv = dlm_lock_sync(bm_lockres, DLM_LOCK_PW);
                if (!rv)
-                       md_bitmap_update_sb(bitmap);
+                       mddev->bitmap_ops->update_sb(bitmap);
                lockres_free(bm_lockres);
 
                rv = md_bitmap_get_stats(bitmap, &stats);
index b422acd4b2a45b03b7bb43888f0fd51c104aa227..5f9df96eab51d7dea7259c8c741e47fa26006891 100644 (file)
@@ -2838,7 +2838,7 @@ repeat:
 
        mddev_add_trace_msg(mddev, "md md_update_sb");
 rewrite:
-       md_bitmap_update_sb(mddev->bitmap);
+       mddev->bitmap_ops->update_sb(mddev->bitmap);
        rdev_for_each(rdev, mddev) {
                if (rdev->sb_loaded != 1)
                        continue; /* no noise on spare devices */
@@ -10002,7 +10002,7 @@ static void check_sb_changes(struct mddev *mddev, struct md_rdev *rdev)
                if (ret)
                        pr_info("md-cluster: resize failed\n");
                else
-                       md_bitmap_update_sb(mddev->bitmap);
+                       mddev->bitmap_ops->update_sb(mddev->bitmap);
        }
 
        /* Check for change of roles in the active devices */