Re: [PATCH v2 08/11] reftable/writer: unify releasing memory

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

 



On Thu, Apr 4, 2024 at 7:48 AM Patrick Steinhardt <ps@xxxxxx> wrote:
> There are two code paths which release memory of the reftable writer:
>
>   - `reftable_writer_close()` releases internal state after it has
>     written data.
>
>   - `reftable_writer_free()` releases the block that was written to and
>     the writer itself.

The bifurcation is there so you can read the stats after closing the
writer. The new method makes it harder to misuse, but now you have two
ways to end a writer. Suggestion: drop reftable_writer_{free,close}
from reftable-writer.h (rename to remove the reftable_ prefix because
they are no longer considered public) and find another way to read out
the stats. Either pass an optional reftable_writer_stats into the
construction of the writer, return the stats from the close function,
or drop stats altogether.  IIRC They are only used in the unit tests.

-- 
Han-Wen Nienhuys - hanwenn@xxxxxxxxx - http://www.xs4all.nl/~hanwen





[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux