[dm-devel] [PATCH 0/4] The dm-writecache target

Mikulas Patocka mpatocka at redhat.com
Wed Sep 27 15:43:41 UTC 2017


Hi

Here I'm sending the work-in-progress dm-writecache target. It supports 
kernels 4.13 and 4.14-rc.

It supports write caching on persistent memory or SSD. On first use, the 
first sector of the cache device must be zeroed. If the first sector 
doesn't contain valid superblock or zeroes, it is considered error.
Example use:

Persistent memory cache (/dev/sda5 is the base device, /dev/pmem0 is cache):
dmsetup create wc --table "0 24709688 writecache p /dev/sda5 /dev/pmem0 4096 0"

SSD caching:
dmsetup create wc --table "0 24709688 writecache s /dev/sda5 /dev/sdb1 4096 0"

For testing (if you don't have a system with persistent memory), it can 
also use ramdisk as persistent memory. You must enable CONFIG_BLK_DEV_RAM_DAX
dmsetup create wb --table "0 24709688 writecache p /dev/sda5 /dev/ram0 4096 0"

Note: It turned out that on a Broadwell system the clwb instruction is 
really slow (the performance of flushing contiguous range of memory is 
about 350MB/s), so it needs to be changed to use non-temporal store 
instructions that bypass the cache.

The metadata format is "struct wc_memory_superblock" and "struct 
wc_memory_entry" (if seq_count for a particular entry is smaller than 
seq_count in the superblock, the block is considered committed). In 
memory, it builds a tree of structures "struct wc_entry". The tree is 
built on each activation and it is not stored in persistent memory.

Mikulas




More information about the dm-devel mailing list