^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1) =================
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 2) Writecache target
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 3) =================
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 4)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 5) The writecache target caches writes on persistent memory or on SSD. It
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 6) doesn't cache reads because reads are supposed to be cached in page cache
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 7) in normal RAM.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 8)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 9) When the device is constructed, the first sector should be zeroed or the
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 10) first sector should contain valid superblock from previous invocation.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 11)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 12) Constructor parameters:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 13)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 14) 1. type of the cache device - "p" or "s"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 15)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 16) - p - persistent memory
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 17) - s - SSD
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 18) 2. the underlying device that will be cached
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 19) 3. the cache device
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 20) 4. block size (4096 is recommended; the maximum block size is the page
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 21) size)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 22) 5. the number of optional parameters (the parameters with an argument
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 23) count as two)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 24)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 25) start_sector n (default: 0)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 26) offset from the start of cache device in 512-byte sectors
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 27) high_watermark n (default: 50)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 28) start writeback when the number of used blocks reach this
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 29) watermark
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 30) low_watermark x (default: 45)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 31) stop writeback when the number of used blocks drops below
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 32) this watermark
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 33) writeback_jobs n (default: unlimited)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 34) limit the number of blocks that are in flight during
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 35) writeback. Setting this value reduces writeback
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 36) throughput, but it may improve latency of read requests
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 37) autocommit_blocks n (default: 64 for pmem, 65536 for ssd)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 38) when the application writes this amount of blocks without
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 39) issuing the FLUSH request, the blocks are automatically
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 40) commited
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 41) autocommit_time ms (default: 1000)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 42) autocommit time in milliseconds. The data is automatically
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 43) commited if this time passes and no FLUSH request is
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 44) received
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 45) fua (by default on)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 46) applicable only to persistent memory - use the FUA flag
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 47) when writing data from persistent memory back to the
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 48) underlying device
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 49) nofua
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 50) applicable only to persistent memory - don't use the FUA
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 51) flag when writing back data and send the FLUSH request
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 52) afterwards
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 53)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 54) - some underlying devices perform better with fua, some
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 55) with nofua. The user should test it
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 56)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 57) Status:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 58) 1. error indicator - 0 if there was no error, otherwise error number
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 59) 2. the number of blocks
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 60) 3. the number of free blocks
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 61) 4. the number of blocks under writeback
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 62)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 63) Messages:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 64) flush
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 65) flush the cache device. The message returns successfully
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 66) if the cache device was flushed without an error
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 67) flush_on_suspend
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 68) flush the cache device on next suspend. Use this message
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 69) when you are going to remove the cache device. The proper
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 70) sequence for removing the cache device is:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 71)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 72) 1. send the "flush_on_suspend" message
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 73) 2. load an inactive table with a linear target that maps
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 74) to the underlying device
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 75) 3. suspend the device
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 76) 4. ask for status and verify that there are no errors
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 77) 5. resume the device, so that it will use the linear
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 78) target
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 79) 6. the cache device is now inactive and it can be deleted