115 lines · plain
1=================2Writecache target3=================4 5The writecache target caches writes on persistent memory or on SSD. It6doesn't cache reads because reads are supposed to be cached in page cache7in normal RAM.8 9When the device is constructed, the first sector should be zeroed or the10first sector should contain valid superblock from previous invocation.11 12Constructor parameters:13 141. type of the cache device - "p" or "s"15 - p - persistent memory16 - s - SSD172. the underlying device that will be cached183. the cache device194. block size (4096 is recommended; the maximum block size is the page20 size)215. the number of optional parameters (the parameters with an argument22 count as two)23 24 start_sector n (default: 0)25 offset from the start of cache device in 512-byte sectors26 high_watermark n (default: 50)27 start writeback when the number of used blocks reach this28 watermark29 low_watermark x (default: 45)30 stop writeback when the number of used blocks drops below31 this watermark32 writeback_jobs n (default: unlimited)33 limit the number of blocks that are in flight during34 writeback. Setting this value reduces writeback35 throughput, but it may improve latency of read requests36 autocommit_blocks n (default: 64 for pmem, 65536 for ssd)37 when the application writes this amount of blocks without38 issuing the FLUSH request, the blocks are automatically39 committed40 autocommit_time ms (default: 1000)41 autocommit time in milliseconds. The data is automatically42 committed if this time passes and no FLUSH request is43 received44 fua (by default on)45 applicable only to persistent memory - use the FUA flag46 when writing data from persistent memory back to the47 underlying device48 nofua49 applicable only to persistent memory - don't use the FUA50 flag when writing back data and send the FLUSH request51 afterwards52 53 - some underlying devices perform better with fua, some54 with nofua. The user should test it55 cleaner56 when this option is activated (either in the constructor57 arguments or by a message), the cache will not promote58 new writes (however, writes to already cached blocks are59 promoted, to avoid data corruption due to misordered60 writes) and it will gradually writeback any cached61 data. The userspace can then monitor the cleaning62 process with "dmsetup status". When the number of cached63 blocks drops to zero, userspace can unload the64 dm-writecache target and replace it with dm-linear or65 other targets.66 max_age n67 specifies the maximum age of a block in milliseconds. If68 a block is stored in the cache for too long, it will be69 written to the underlying device and cleaned up.70 metadata_only71 only metadata is promoted to the cache. This option72 improves performance for heavier REQ_META workloads.73 pause_writeback n (default: 3000)74 pause writeback if there was some write I/O redirected to75 the origin volume in the last n milliseconds76 77Status:78 791. error indicator - 0 if there was no error, otherwise error number802. the number of blocks813. the number of free blocks824. the number of blocks under writeback835. the number of read blocks846. the number of read blocks that hit the cache857. the number of write blocks868. the number of write blocks that hit uncommitted block879. the number of write blocks that hit committed block8810. the number of write blocks that bypass the cache8911. the number of write blocks that are allocated in the cache9012. the number of write requests that are blocked on the freelist9113. the number of flush requests9214. the number of discarded blocks93 94Messages:95 flush96 Flush the cache device. The message returns successfully97 if the cache device was flushed without an error98 flush_on_suspend99 Flush the cache device on next suspend. Use this message100 when you are going to remove the cache device. The proper101 sequence for removing the cache device is:102 103 1. send the "flush_on_suspend" message104 2. load an inactive table with a linear target that maps105 to the underlying device106 3. suspend the device107 4. ask for status and verify that there are no errors108 5. resume the device, so that it will use the linear109 target110 6. the cache device is now inactive and it can be deleted111 cleaner112 See above "cleaner" constructor documentation.113 clear_stats114 Clear the statistics that are reported on the status line115