<feed xmlns='http://www.w3.org/2005/Atom'>
<title>kernel/linux.git/drivers/md/dm-pcache, branch v6.18.22</title>
<subtitle>Linux kernel stable tree (mirror)</subtitle>
<id>https://git.radix-linux.su/kernel/linux.git/atom?h=v6.18.22</id>
<link rel='self' href='https://git.radix-linux.su/kernel/linux.git/atom?h=v6.18.22'/>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/'/>
<updated>2026-01-08T09:17:03+00:00</updated>
<entry>
<title>dm pcache: fix segment info indexing</title>
<updated>2026-01-08T09:17:03+00:00</updated>
<author>
<name>Li Chen</name>
<email>chenl311@chinatelecom.cn</email>
</author>
<published>2025-12-05T05:46:20+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=527f5ea4ced1b3bc99f2cba619c4886ef6abe80d'/>
<id>urn:sha1:527f5ea4ced1b3bc99f2cba619c4886ef6abe80d</id>
<content type='text'>
commit 13ea55ea20176736516b20b9ea2d8cf97dbe74f5 upstream.

Segment info indexing also used sizeof(struct) instead of the
4K metadata stride, so info_index could point between slots and
subsequent writes would advance incorrectly. Derive info_index
from the pointer returned by the segment meta search using
PCACHE_SEG_INFO_SIZE and advance to the next slot for future
updates.

Signed-off-by: Li Chen &lt;chenl311@chinatelecom.cn&gt;
Signed-off-by: Dongsheng Yang &lt;dongsheng.yang@linux.dev&gt;
Signed-off-by: Mikulas Patocka &lt;mpatocka@redhat.com&gt;
Reviewed-by: Zheng Gu &lt;cengku@gmail.com&gt;
Cc: stable@vger.kernel.org	# 6.18
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;
</content>
</entry>
<entry>
<title>dm pcache: fix cache info indexing</title>
<updated>2026-01-08T09:17:02+00:00</updated>
<author>
<name>Li Chen</name>
<email>chenl311@chinatelecom.cn</email>
</author>
<published>2025-12-05T05:46:19+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=87f7a7e2ed5715a120d4c601c2b67ae84525d2a2'/>
<id>urn:sha1:87f7a7e2ed5715a120d4c601c2b67ae84525d2a2</id>
<content type='text'>
commit ee7633178321f5d983db3adfdea9322456cfdaaa upstream.

The on-media cache_info index used sizeof(struct) instead of the
4K metadata stride, so gc_percent updates from dmsetup message
were written between slots and lost after reboot. Use
PCACHE_CACHE_INFO_SIZE in get_cache_info_addr() and align
info_index with the slot returned by pcache_meta_find_latest().

Signed-off-by: Li Chen &lt;chenl311@chinatelecom.cn&gt;
Signed-off-by: Dongsheng Yang &lt;dongsheng.yang@linux.dev&gt;
Signed-off-by: Mikulas Patocka &lt;mpatocka@redhat.com&gt;
Reviewed-by: Zheng Gu &lt;cengku@gmail.com&gt;
Cc: stable@vger.kernel.org	# 6.18
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;
</content>
</entry>
<entry>
<title>dm-pcache: advance slot index before writing slot</title>
<updated>2026-01-02T11:57:19+00:00</updated>
<author>
<name>Dongsheng Yang</name>
<email>dongsheng.yang@linux.dev</email>
</author>
<published>2025-12-05T05:46:18+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=3383f16f7870e4cd81e326c9a32f3416305b24b5'/>
<id>urn:sha1:3383f16f7870e4cd81e326c9a32f3416305b24b5</id>
<content type='text'>
commit ebbb90344a7da2421e4b54668b94e81828b8b308 upstream.

In dm-pcache, in order to ensure crash-consistency, a dual-copy scheme
is used to alternately update metadata, and there is a slot index that
records the current slot. However, in the write path the current
implementation writes directly to the current slot indexed by slot
index, and then advances the slot — which ends up overwriting the
existing slot, violating the crash-consistency guarantee.

This patch fixes that behavior, preventing metadata from being
overwritten incorrectly.

In addition, this patch add a missing pmem_wmb() after memcpy_flushcache().

Signed-off-by: Dongsheng Yang &lt;dongsheng.yang@linux.dev&gt;
Signed-off-by: Mikulas Patocka &lt;mpatocka@redhat.com&gt;
Reviewed-by: Zheng Gu &lt;cengku@gmail.com&gt;
Cc: stable@vger.kernel.org	# 6.18
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;
</content>
</entry>
<entry>
<title>dm-pcache: zero cache_info before default init</title>
<updated>2025-11-18T18:02:08+00:00</updated>
<author>
<name>Li Chen</name>
<email>chenl311@chinatelecom.cn</email>
</author>
<published>2025-11-11T12:13:36+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=a6ee8422b4f2a591de010f4e60471060b13d4170'/>
<id>urn:sha1:a6ee8422b4f2a591de010f4e60471060b13d4170</id>
<content type='text'>
pcache_meta_find_latest() leaves whatever it last copied into the
caller’s buffer even when it returns NULL. For cache_info_init(),
that meant cache-&gt;cache_info could still contain CRC-bad garbage when
no valid metadata exists, leading later initialization paths to read
bogus flags.

Explicitly memset cache-&gt;cache_info in cache_info_init_default()
so new-cache paths start from a clean slate. The default sequence
number assignment becomes redundant with this reset, so it drops out.

Signed-off-by: Li Chen &lt;chenl311@chinatelecom.cn&gt;
Reviewed-by: Zheng Gu &lt;cengku@gmail.com&gt;
Signed-off-by: Mikulas Patocka &lt;mpatocka@redhat.com&gt;
</content>
</entry>
<entry>
<title>dm-pcache: reuse meta_addr in pcache_meta_find_latest</title>
<updated>2025-11-18T18:01:57+00:00</updated>
<author>
<name>Li Chen</name>
<email>chenl311@chinatelecom.cn</email>
</author>
<published>2025-11-11T12:13:35+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=840b80af74fda9672f111023ca17ad7875427f13'/>
<id>urn:sha1:840b80af74fda9672f111023ca17ad7875427f13</id>
<content type='text'>
pcache_meta_find_latest() already computes the metadata address as
meta_addr. Reuse that instead of recomputing.

Signed-off-by: Li Chen &lt;chenl311@chinatelecom.cn&gt;
Signed-off-by: Mikulas Patocka &lt;mpatocka@redhat.com&gt;
</content>
</entry>
<entry>
<title>dm-pcache: allow built-in build and rename flush helper</title>
<updated>2025-11-18T18:01:47+00:00</updated>
<author>
<name>Li Chen</name>
<email>chenl311@chinatelecom.cn</email>
</author>
<published>2025-11-11T12:13:34+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=341d14bd69d05b1c30bd83c5056730ba6d78b83d'/>
<id>urn:sha1:341d14bd69d05b1c30bd83c5056730ba6d78b83d</id>
<content type='text'>
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 &lt;chenl311@chinatelecom.cn&gt;
Signed-off-by: Mikulas Patocka &lt;mpatocka@redhat.com&gt;
</content>
</entry>
<entry>
<title>dm-pcache: use int type to store negative error codes</title>
<updated>2025-09-02T09:19:12+00:00</updated>
<author>
<name>Qianfeng Rong</name>
<email>rongqianfeng@vivo.com</email>
</author>
<published>2025-08-29T13:37:48+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=4466dd3d719cca113308e8ae539adf7b3d68c985'/>
<id>urn:sha1:4466dd3d719cca113308e8ae539adf7b3d68c985</id>
<content type='text'>
Change the 'ret' variable from u32 to int to store negative error codes or
zero returned by cache_kset_close().

Storing the negative error codes in unsigned type, doesn't cause an issue
at runtime but it's ugly. Additionally, assigning negative error codes to
unsigned type may trigger a GCC warning when the -Wsign-conversion flag
is enabled.

No effect on runtime.

Signed-off-by: Qianfeng Rong &lt;rongqianfeng@vivo.com&gt;
Signed-off-by: Mikulas Patocka &lt;mpatocka@redhat.com&gt;
</content>
</entry>
<entry>
<title>dm-pcache: cleanup: fix coding style report by checkpatch.pl</title>
<updated>2025-09-01T11:30:54+00:00</updated>
<author>
<name>Dongsheng Yang</name>
<email>dongsheng.yang@linux.dev</email>
</author>
<published>2025-09-01T05:42:18+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=24735771774954fa0ebbe0dfa285752647d327f0'/>
<id>urn:sha1:24735771774954fa0ebbe0dfa285752647d327f0</id>
<content type='text'>
A patch from a few days ago fixed the division issue on 32-bit machines,
but it introduced a coding style problem.

WARNING: Missing a blank line after declarations
+       u32 rem;
+       div_u64_rem(off &gt;&gt; PCACHE_CACHE_SUBTREE_SIZE_SHIFT,
	cache-&gt;n_ksets, &amp;rem);

total: 0 errors, 1 warnings, 634 lines checked

Signed-off-by: Dongsheng Yang &lt;dongsheng.yang@linux.dev&gt;
Signed-off-by: Mikulas Patocka &lt;mpatocka@redhat.com&gt;
</content>
</entry>
<entry>
<title>dm-pcache: remove ctrl_lock for pcache_cache_segment</title>
<updated>2025-09-01T11:30:39+00:00</updated>
<author>
<name>Dongsheng Yang</name>
<email>dongsheng.yang@linux.dev</email>
</author>
<published>2025-09-01T05:42:00+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=1f9ad14aef064ced0f60caae60c62b989de25676'/>
<id>urn:sha1:1f9ad14aef064ced0f60caae60c62b989de25676</id>
<content type='text'>
The smatch checker reports a “scheduler in atomic context” problem in
the following call chain:

miss_read_end_req()
   -&gt; cache_seg_put()
      -&gt; cache_seg_invalidate()
         -&gt; cache_seg_gen_increase()
            -&gt; mutex_lock(&amp;cache_seg-&gt;ctrl_lock);

In practice, this `mutex_lock` will not actually schedule, because it is
only called when `cache_seg_put()` drops the last reference, which is
single-threaded. That is also why the issue never shows up during real
testing.

However, the code is still buggy. The original purpose of `ctrl_lock`
was to prevent read/write conflicts on the cache segment control
information. Looking at the current usage, all control information
accesses are single-threaded: reads only occur during the init phase,
where no conflicts are possible, and writes happen once in the init
phase (also single-threaded) and once when `cache_seg_put()` drops the
last reference (again single-threaded).

Therefore, this patch removes `ctrl_lock` entirely and adds comments in
the appropriate places to document this logic.

Signed-off-by: Dongsheng Yang &lt;dongsheng.yang@linux.dev&gt;
Signed-off-by: Mikulas Patocka &lt;mpatocka@redhat.com&gt;
</content>
</entry>
<entry>
<title>dm-pcache: add persistent cache target in device-mapper</title>
<updated>2025-08-25T13:25:29+00:00</updated>
<author>
<name>Dongsheng Yang</name>
<email>dongsheng.yang@linux.dev</email>
</author>
<published>2025-08-12T08:24:52+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=1d57628ff95b32d5cfa8d8f50e07690c161e9cf0'/>
<id>urn:sha1:1d57628ff95b32d5cfa8d8f50e07690c161e9cf0</id>
<content type='text'>
This patch introduces dm-pcache, a new DM target that places a DAX-
capable persistent-memory device in front of any slower block device and
uses it as a high-throughput, low-latency  cache.

Design highlights
-----------------
- DAX data path – data is copied directly between DRAM and the pmem
  mapping, bypassing the block layer’s overhead.

- Segmented, crash-consistent layout
  - all layout metadata are dual-replicated CRC-protected.
  - atomic kset flushes; key replay on mount guarantees cache integrity
    even after power loss.

- Striped multi-tree index
  - Multi‑tree indexing for high parallelism.
  - overlap-resolution logic ensures non-intersecting cached extents.

- Background services
  - write-back worker flushes dirty keys in order, preserving backing-device
    crash consistency. This is important for checkpoint in cloud storage.
  - garbage collector reclaims clean segments when utilisation exceeds a
    tunable threshold.

- Data integrity – optional CRC32 on cached payload; metadata always protected.

Comparison with existing block-level caches
---------------------------------------------------------------------------------------------------------------------------------
| Feature                          | pcache (this patch)             | bcache                       | dm-writecache             |
|----------------------------------|---------------------------------|------------------------------|---------------------------|
| pmem access method               | DAX                             | bio (block I/O)              | DAX                       |
| Write latency (4 K rand-write)   | ~5 µs                           | ~20 µs                       | ~5 µs                     |
| Concurrency                      | multi subtree index             | global index tree            | single tree + wc_lock     |
| IOPS (4K randwrite, 32 numjobs)  | 2.1 M                           | 352 K                        | 283 K                     |
| Read-cache support               | YES                             | YES                          | NO                        |
| Deployment                       | no re-format of backend         | backend devices must be      | no re-format of backend   |
|                                  |                                 | reformatted                  |                           |
| Write-back ordering              | log-structured;                 | no ordering guarantee        | no ordering guarantee     |
|                                  | preserves app-IO-order          |                              |                           |
| Data integrity checks            | metadata + data CRC(optional)   | metadata CRC only            | none                      |
---------------------------------------------------------------------------------------------------------------------------------

Signed-off-by: Dongsheng Yang &lt;dongsheng.yang@linux.dev&gt;
Signed-off-by: Mikulas Patocka &lt;mpatocka@redhat.com&gt;
</content>
</entry>
</feed>
