On Thu 28 May 2020 09:11:07 PM CEST, Eric Blake wrote: >> I think the problem also exists in the current code (without my >> patches). If you zeroize 10 clusters and the last one is compressed >> you have to repeat the request after having zeroized 9 clusters. > > Hmm. In the pre-patch code, qcow2_co_pwrite_zeroes() calls > qcow2_cluster_zeroize() which can fail with -ENOTSUP up front, but not > after the fact. Once it starts the while loop over clusters, its use > of zero_in_l2_slice() handles compressed clusters just fine;
You're right, complete compressed clusters can always be handled, the problem is just when there's subclusters. > But isn't this something we could solve recursively? Instead of > returning -ENOTSUP, we could have zero_in_l2_slice() call > bdrv_pwrite_zeroes() on the (sub-)clusters associated with a > compressed cluster. I suppose we could, as long as BDRV_REQ_NO_FALLBACK is not used. Berto