Re: [PATCH 1/2] dm pcache: fix cache info indexing
From: Dongsheng Yang
Date: Wed Dec 03 2025 - 18:39:04 EST
在 12/3/2025 1:56 PM, Dongsheng Yang 写道:
在 12/2/2025 8:11 PM, Li Chen 写道:
From: Li Chen <chenl311@xxxxxxxxxxxxxxx>
+ int index = ((char *)cache_info_addr - (char *)cache->cache_info_addr) /
+ PCACHE_CACHE_INFO_SIZE;
+
+ cache->info_index = (index + 1) % PCACHE_META_INDEX_MAX;
Don't advance info_index at init stage, cache->info_index means the current index, not the next index.
It will be advanced in cache_info_write() after write cache_info into next slot.
My bad, ->info_index means next slot, so advance it is correct.
In addition, cache->info_index initialization should be after the data_crc checking.
Thanx
+
if (opts->data_crc !=
(cache->cache_info.flags & PCACHE_CACHE_FLAGS_DATA_CRC)) {
pcache_dev_err(pcache, "invalid option for data_crc: %s, expected: %s",