writecache.txt 2.6 KB

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