[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH 3/6] mirror: Skip writing zeroes when target is already zero
From: |
Eric Blake |
Subject: |
Re: [PATCH 3/6] mirror: Skip writing zeroes when target is already zero |
Date: |
Mon, 21 Apr 2025 09:41:19 -0500 |
User-agent: |
NeoMutt/20250404 |
On Mon, Apr 21, 2025 at 09:15:33AM +0300, Vladimir Sementsov-Ogievskiy wrote:
> On 17.04.25 00:51, Eric Blake wrote:
> > (a write zeroes that fails AND causes the disk to no longer read as
> > zero should not happen)
>
> I don't know, is there such a contract? write-zeroes may fallback to write(),
> which only state that:
>
> An error return value while performing write() using direct I/O
> does not mean the entire write has failed. Partial data may be
> written and the data at the file offset on which the write() was
> attempted should be considered inconsistent.
>
> So, I used to think that on failed write nothing is guaranteed.
>
> What do we lose if we just unset the bitmap before write-zeroes, and set it
> again in case of success?
>
I still don't see the point. Either the cluster was already non-zero
before the failed write-zero (so there's no bit to pre-clear); or the
cluster was already zero before the failed write-zero, and any failure
that corrupts the disk by actually turning zeroes into non-zero is not
worth worrying about, so pre-clearing the bit is not going to make
things any better.
--
Eric Blake, Principal Software Engineer
Red Hat, Inc.
Virtualization: qemu.org | libguestfs.org