Am 29.01.2021 um 17:50 hat Vladimir Sementsov-Ogievskiy geschrieben:
Hi all!
I know, I have several series waiting for a resend, but I had to switch
to another task spawned from our customer's bug.
Original problem: we use O_DIRECT for all vm images in our product, it's
the policy. The only exclusion is backup target qcow2 image for
compressed backup, because compressed backup is extremely slow with
O_DIRECT (due to unaligned writes). Customer complains that backup
produces a lot of pagecache.
So we can either implement some internal cache or use fadvise somehow.
Backup has several async workes, which writes simultaneously, so in both
ways we have to track host cluster filling (before dropping the cache
corresponding to the cluster). So, if we have to track anyway, let's
try to implement the cache.
Idea is simple: cache small unaligned write and flush the cluster when
filled.
I haven't had the time to properly look at the patches, but is there
anything in it that is actually specific to compressed writes?
I'm asking because you may remember that a few years ago I talked at KVM
Forum about how a data cache could be used for small unaligned (to
cluster sizes) writes to reduce COW cost (mostly for sequential access
where the other part of the cluster would be filled soon enough).
So if we're introducing some kind of data cache, wouldn't it be nice to
use it even in the more general case instead of just restricting it to
compression?