qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH 0/4] qemu-img: Fix exit code for errors closing the image


From: Vladimir Sementsov-Ogievskiy
Subject: Re: [PATCH 0/4] qemu-img: Fix exit code for errors closing the image
Date: Tue, 14 Feb 2023 23:09:34 +0300
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.4.2

On 13.01.23 14:29, Kevin Wolf wrote:
Another thing that could be tried is making failure in .bdrv_close less
likely by doing things earlier. At least ENOSPC could probably be
avoided if dirty bitmaps clusters were allocated during the write
request that first sets a bit in them (I know too little about the
details how bitmaps are implemented in qcow2, though, maybe Vladimir can
help here).

That's possible but not trivial :)

Qcow2 does nothing with dirty bitmaps during normal operation. Only on close, 
it finds all persistent bitmaps and stores them somehow, mostly allocating new 
clusters on the fly.

So the simplest way look like:

- add generic handler .bitmap_changed in BlockDriver, to handle bitmap change 
in qcow2 (that's not only write, but may be bitmap_merge opertion).
- in a new handler allocate some clusters to produce a pool for dirty bitmaps 
saving (will need clusters for bitmap data and metadata (bitmap table, bitmap 
directory))
- in block/qcow2-bitmap.c switch qcow2_alloc_cluster() to a wrapper, that first 
tries to get a cluster from the pool and if it's empty fallback to 
qcow2_alloc_cluster()

Note also, that this will increase fragmentation.

Or, may be more effective would be to preallocate clusters on bitmap creation 
(and therefore on image resize).

More difficult would be rework the whole code to bind allocated clusters for 
each persistent dirty bitmap.

--
Best regards,
Vladimir




reply via email to

[Prev in Thread] Current Thread [Next in Thread]