writecache.rst 2.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879
  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. commited
  35. autocommit_time ms (default: 1000)
  36. autocommit time in milliseconds. The data is automatically
  37. commited 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. Status:
  50. 1. error indicator - 0 if there was no error, otherwise error number
  51. 2. the number of blocks
  52. 3. the number of free blocks
  53. 4. the number of blocks under writeback
  54. Messages:
  55. flush
  56. flush the cache device. The message returns successfully
  57. if the cache device was flushed without an error
  58. flush_on_suspend
  59. flush the cache device on next suspend. Use this message
  60. when you are going to remove the cache device. The proper
  61. sequence for removing the cache device is:
  62. 1. send the "flush_on_suspend" message
  63. 2. load an inactive table with a linear target that maps
  64. to the underlying device
  65. 3. suspend the device
  66. 4. ask for status and verify that there are no errors
  67. 5. resume the device, so that it will use the linear
  68. target
  69. 6. the cache device is now inactive and it can be deleted