]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
dm-pcache: allow built-in build and rename flush helper
authorLi Chen <chenl311@chinatelecom.cn>
Tue, 11 Nov 2025 12:13:34 +0000 (20:13 +0800)
committerMikulas Patocka <mpatocka@redhat.com>
Tue, 18 Nov 2025 18:01:47 +0000 (19:01 +0100)
CONFIG_BCACHE is tristate, so dm-pcache can also be built-in.
Switch the Makefile to use obj-$(CONFIG_DM_PCACHE) so the target can be
linked into vmlinux instead of always being a loadable module.

Also rename cache_flush() to pcache_cache_flush() to avoid a global
symbol clash with sunrpc/cache.c's cache_flush().

Signed-off-by: Li Chen <chenl311@chinatelecom.cn>
Signed-off-by: Mikulas Patocka <mpatocka@redhat.com>
drivers/md/dm-pcache/Makefile
drivers/md/dm-pcache/cache.c
drivers/md/dm-pcache/cache.h
drivers/md/dm-pcache/cache_req.c

index 86776e4acad24a6d3e3c47203882d7014271bba8..cedfd38854f630534234d3ab735d37a82a97169a 100644 (file)
@@ -1,3 +1,3 @@
 dm-pcache-y := dm_pcache.o cache_dev.o segment.o backing_dev.o cache.o cache_gc.o cache_writeback.o cache_segment.o cache_key.o cache_req.o
 
-obj-m += dm-pcache.o
+obj-$(CONFIG_DM_PCACHE) += dm-pcache.o
index d8e92367d9470cd7a3fbacf8796d09cbbb663449..d516d49042272e6d1e15a8a0e078049437bcf000 100644 (file)
@@ -411,7 +411,7 @@ void pcache_cache_stop(struct dm_pcache *pcache)
 {
        struct pcache_cache *cache = &pcache->cache;
 
-       cache_flush(cache);
+       pcache_cache_flush(cache);
 
        cancel_delayed_work_sync(&cache->gc_work);
        flush_work(&cache->clean_work);
index 1136d86958c8c4520f26cb8049b3c8a79cdfab5a..27613b56be54c2ef29d566c916eec7ae340140c8 100644 (file)
@@ -339,7 +339,7 @@ void cache_seg_put(struct pcache_cache_segment *cache_seg);
 void cache_seg_set_next_seg(struct pcache_cache_segment *cache_seg, u32 seg_id);
 
 /* cache request*/
-int cache_flush(struct pcache_cache *cache);
+int pcache_cache_flush(struct pcache_cache *cache);
 void miss_read_end_work_fn(struct work_struct *work);
 int pcache_cache_handle_req(struct pcache_cache *cache, struct pcache_request *pcache_req);
 
index 27f94c1fa968c6d376feb6cf045e0f128eb2e850..7854a30e07b7f5a316e98609e874ea5fc354143b 100644 (file)
@@ -790,7 +790,7 @@ err:
 }
 
 /**
- * cache_flush - Flush all ksets to persist any pending cache data
+ * pcache_cache_flush - Flush all ksets to persist any pending cache data
  * @cache: Pointer to the cache structure
  *
  * This function iterates through all ksets associated with the provided `cache`
@@ -802,7 +802,7 @@ err:
  * the respective error code, preventing the flush operation from proceeding to
  * subsequent ksets.
  */
-int cache_flush(struct pcache_cache *cache)
+int pcache_cache_flush(struct pcache_cache *cache)
 {
        struct pcache_cache_kset *kset;
        int ret;
@@ -827,7 +827,7 @@ int pcache_cache_handle_req(struct pcache_cache *cache, struct pcache_request *p
        struct bio *bio = pcache_req->bio;
 
        if (unlikely(bio->bi_opf & REQ_PREFLUSH))
-               return cache_flush(cache);
+               return pcache_cache_flush(cache);
 
        if (bio_data_dir(bio) == READ)
                return cache_read(cache, pcache_req);