]> www.infradead.org Git - users/dwmw2/linux.git/commitdiff
md/md-bitmap: merge bitmap_unplug() into bitmap_operations
authorYu Kuai <yukuai3@huawei.com>
Mon, 26 Aug 2024 07:44:42 +0000 (15:44 +0800)
committerSong Liu <song@kernel.org>
Tue, 27 Aug 2024 19:43:14 +0000 (12:43 -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-33-yukuai1@huaweicloud.com
Signed-off-by: Song Liu <song@kernel.org>
drivers/md/md-bitmap.c
drivers/md/md-bitmap.h
drivers/md/md.c
drivers/md/raid1-10.c
drivers/md/raid5.c

index ecfc3a02a9760e12066de09642a521e6d92584e3..4e6e31e364f68eb400bd2af2de98cd34424c4cef 100644 (file)
@@ -1087,7 +1087,7 @@ static void bitmap_unplug_async(struct bitmap *bitmap)
        wait_for_completion(&done);
 }
 
-void md_bitmap_unplug(struct mddev *mddev, bool sync)
+static void bitmap_unplug(struct mddev *mddev, bool sync)
 {
        struct bitmap *bitmap = mddev->bitmap;
 
@@ -1099,7 +1099,6 @@ void md_bitmap_unplug(struct mddev *mddev, bool sync)
        else
                bitmap_unplug_async(bitmap);
 }
-EXPORT_SYMBOL_GPL(md_bitmap_unplug);
 
 static void md_bitmap_set_memory_bits(struct bitmap *bitmap, sector_t offset, int needed);
 
@@ -2754,6 +2753,7 @@ static struct bitmap_operations bitmap_ops = {
        .flush                  = bitmap_flush,
        .write_all              = bitmap_write_all,
        .dirty_bits             = bitmap_dirty_bits,
+       .unplug                 = bitmap_unplug,
 
        .startwrite             = bitmap_startwrite,
        .endwrite               = bitmap_endwrite,
index ba8ba7e49ef9e2a30956feff8c46c2d0ba00b02a..dbe9b27091f48505a52b457c62ccfb3131819f28 100644 (file)
@@ -254,6 +254,7 @@ struct bitmap_operations {
        void (*write_all)(struct mddev *mddev);
        void (*dirty_bits)(struct mddev *mddev, unsigned long s,
                           unsigned long e);
+       void (*unplug)(struct mddev *mddev, bool sync);
 
        int (*startwrite)(struct mddev *mddev, sector_t offset,
                          unsigned long sectors, bool behind);
@@ -277,7 +278,6 @@ struct bitmap_operations {
 void mddev_set_bitmap_ops(struct mddev *mddev);
 
 /* these are exported */
-void md_bitmap_unplug(struct mddev *mddev, bool sync);
 void md_bitmap_daemon_work(struct mddev *mddev);
 
 int md_bitmap_resize(struct bitmap *bitmap, sector_t blocks,
index b3bc0c76aeb889ea29d3400c6b3c64215a46739f..b45d9b6456065bc2209e1a25da699fb3174a431c 100644 (file)
@@ -4715,7 +4715,7 @@ bitmap_store(struct mddev *mddev, const char *buf, size_t len)
                mddev->bitmap_ops->dirty_bits(mddev, chunk, end_chunk);
                buf = skip_spaces(end);
        }
-       md_bitmap_unplug(mddev, true); /* flush the bits to disk */
+       mddev->bitmap_ops->unplug(mddev, true); /* flush the bits to disk */
 out:
        mddev_unlock(mddev);
        return len;
index 45b30f08f3a50013c9ed9b32d91231ebf7f89705..e8207513eb1b649b96159e26e38e4e78fe8982bc 100644 (file)
@@ -168,7 +168,7 @@ static inline bool raid1_add_bio_to_plug(struct mddev *mddev, struct bio *bio,
  */
 static inline void raid1_prepare_flush_writes(struct mddev *mddev)
 {
-       md_bitmap_unplug(mddev, current->bio_list == NULL);
+       mddev->bitmap_ops->unplug(mddev, current->bio_list == NULL);
 }
 
 /*
index e98061c01b44a61bb439be9c7ce841fd3a98b04e..91b610d11c6a4942954ab3505688e8c8ff72eee3 100644 (file)
@@ -6768,7 +6768,7 @@ static void raid5d(struct md_thread *thread)
                        /* Now is a good time to flush some bitmap updates */
                        conf->seq_flush++;
                        spin_unlock_irq(&conf->device_lock);
-                       md_bitmap_unplug(mddev, true);
+                       mddev->bitmap_ops->unplug(mddev, true);
                        spin_lock_irq(&conf->device_lock);
                        conf->seq_write = conf->seq_flush;
                        activate_bit_delay(conf, conf->temp_inactive_list);