dm writecache: implement the "cleaner" policy
authorMikulas Patocka <mpatocka@redhat.com>
Mon, 24 Feb 2020 09:20:32 +0000 (10:20 +0100)
committerMike Snitzer <snitzer@redhat.com>
Tue, 24 Mar 2020 15:50:30 +0000 (11:50 -0400)
commit93de44eb3fc8c3566f5315b0210630cc361526a7
treeee1aa981aa2ea79675d9679125ed468ebfb39f45
parentd53f1fafec9d086f1c5166436abefdaef30e0363
dm writecache: implement the "cleaner" policy

The "flush" or "flush_on_suspend" messages flush the whole cache. However,
these flushing methods can take some time and the process is left in
an interruptible state during the flush.

Implement a "cleaner" option that offers an alternate flushing method.
When this option is activated (either by a message or in the constructor
arguments), the cache will not promote new writes (however, writes to
already cached blocks are promoted, to avoid data corruption due to
misordered writes) and it will gradually writeback any cached data. The
userspace can then monitor the cleaning process with "dmsetup status".
When the number of cached bloks drops to zero, the userspace can unload
the dm-writecache target and replace it with dm-linear or other targets.

Signed-off-by: Mikulas Patocka <mpatocka@redhat.com>
Signed-off-by: Mike Snitzer <snitzer@redhat.com>
drivers/md/dm-writecache.c