writecache.rst 4.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114
  1. =================
  2. Writecache target
  3. =================
  4. The writecache target caches writes on persistent memory or on SSD. It
  5. doesn't cache reads because reads are supposed to be cached in page cache
  6. in normal RAM.
  7. When the device is constructed, the first sector should be zeroed or the
  8. first sector should contain valid superblock from previous invocation.
  9. Constructor parameters:
  10. 1. type of the cache device - "p" or "s"
  11. - p - persistent memory
  12. - s - SSD
  13. 2. the underlying device that will be cached
  14. 3. the cache device
  15. 4. block size (4096 is recommended; the maximum block size is the page
  16. size)
  17. 5. the number of optional parameters (the parameters with an argument
  18. count as two)
  19. start_sector n (default: 0)
  20. offset from the start of cache device in 512-byte sectors
  21. high_watermark n (default: 50)
  22. start writeback when the number of used blocks reach this
  23. watermark
  24. low_watermark x (default: 45)
  25. stop writeback when the number of used blocks drops below
  26. this watermark
  27. writeback_jobs n (default: unlimited)
  28. limit the number of blocks that are in flight during
  29. writeback. Setting this value reduces writeback
  30. throughput, but it may improve latency of read requests
  31. autocommit_blocks n (default: 64 for pmem, 65536 for ssd)
  32. when the application writes this amount of blocks without
  33. issuing the FLUSH request, the blocks are automatically
  34. committed
  35. autocommit_time ms (default: 1000)
  36. autocommit time in milliseconds. The data is automatically
  37. committed if this time passes and no FLUSH request is
  38. received
  39. fua (by default on)
  40. applicable only to persistent memory - use the FUA flag
  41. when writing data from persistent memory back to the
  42. underlying device
  43. nofua
  44. applicable only to persistent memory - don't use the FUA
  45. flag when writing back data and send the FLUSH request
  46. afterwards
  47. - some underlying devices perform better with fua, some
  48. with nofua. The user should test it
  49. cleaner
  50. when this option is activated (either in the constructor
  51. arguments or by a message), the cache will not promote
  52. new writes (however, writes to already cached blocks are
  53. promoted, to avoid data corruption due to misordered
  54. writes) and it will gradually writeback any cached
  55. data. The userspace can then monitor the cleaning
  56. process with "dmsetup status". When the number of cached
  57. blocks drops to zero, userspace can unload the
  58. dm-writecache target and replace it with dm-linear or
  59. other targets.
  60. max_age n
  61. specifies the maximum age of a block in milliseconds. If
  62. a block is stored in the cache for too long, it will be
  63. written to the underlying device and cleaned up.
  64. metadata_only
  65. only metadata is promoted to the cache. This option
  66. improves performance for heavier REQ_META workloads.
  67. pause_writeback n (default: 3000)
  68. pause writeback if there was some write I/O redirected to
  69. the origin volume in the last n milliseconds
  70. Status:
  71. 1. error indicator - 0 if there was no error, otherwise error number
  72. 2. the number of blocks
  73. 3. the number of free blocks
  74. 4. the number of blocks under writeback
  75. 5. the number of read blocks
  76. 6. the number of read blocks that hit the cache
  77. 7. the number of write blocks
  78. 8. the number of write blocks that hit uncommitted block
  79. 9. the number of write blocks that hit committed block
  80. 10. the number of write blocks that bypass the cache
  81. 11. the number of write blocks that are allocated in the cache
  82. 12. the number of write requests that are blocked on the freelist
  83. 13. the number of flush requests
  84. 14. the number of discarded blocks
  85. Messages:
  86. flush
  87. Flush the cache device. The message returns successfully
  88. if the cache device was flushed without an error
  89. flush_on_suspend
  90. Flush the cache device on next suspend. Use this message
  91. when you are going to remove the cache device. The proper
  92. sequence for removing the cache device is:
  93. 1. send the "flush_on_suspend" message
  94. 2. load an inactive table with a linear target that maps
  95. to the underlying device
  96. 3. suspend the device
  97. 4. ask for status and verify that there are no errors
  98. 5. resume the device, so that it will use the linear
  99. target
  100. 6. the cache device is now inactive and it can be deleted
  101. cleaner
  102. See above "cleaner" constructor documentation.
  103. clear_stats
  104. Clear the statistics that are reported on the status line