From: Han-Wen Nienhuys <hanwen@google.com>
To: "Ævar Arnfjörð Bjarmason" <avarab@gmail.com>
Cc: git@vger.kernel.org, "Junio C Hamano" <gitster@pobox.com>,
"Carlo Marcelo Arenas Belón" <carenas@gmail.com>
Subject: Re: [RFC PATCH 1/2] reftable: remove the "return_block" abstraction
Date: Mon, 25 Apr 2022 11:57:38 +0200 [thread overview]
Message-ID: <CAFQ2z_O7ytx=AsXuJbYnOdMwT0u03sMP-ZjRRjt4HFn48HT-2g@mail.gmail.com> (raw)
In-Reply-To: <RFC-patch-1.2-76ed86bf88c-20220415T101740Z-avarab@gmail.com>
On Fri, Apr 15, 2022 at 12:21 PM Ævar Arnfjörð Bjarmason
<avarab@gmail.com> wrote:
>
> This abstraction added in 1214aa841bc (reftable: add blocksource, an
> abstraction for random access reads, 2021-10-07) has the caller
> provide a "blockp->data", so there's not point in having the vtable
> have a custom free() function.
>
> In addition this had what looked like a poor man's SANITIZE=address
> doing a memset() to 0xff just before the data was free'd.
> void reftable_block_done(struct reftable_block *blockp)
> {
> - struct reftable_block_source source = blockp->source;
> - if (blockp && source.ops)
> - source.ops->return_block(source.arg, blockp);
> + FREE_AND_NULL(blockp->data);
My thinking here is that we could mmap the reftable file to do reads.
In that case, discarding the block would imply decreasing a refcount
somewhere, rather than deallocating memory.
--
Han-Wen Nienhuys - Google Munich
I work 80%. Don't expect answers from me on Fridays.
next prev parent reply other threads:[~2022-04-25 9:58 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-04-15 7:02 [PATCH] reftable: avoid undefined behaviour breaking t0032 Carlo Marcelo Arenas Belón
2022-04-15 7:10 ` Junio C Hamano
2022-04-15 8:30 ` [PATCH v2] " Carlo Marcelo Arenas Belón
2022-04-15 10:21 ` [RFC PATCH 0/2] reftable: remove poor man's SANITIZE=address, fix a memset() bug Ævar Arnfjörð Bjarmason
2022-04-15 10:21 ` [RFC PATCH 1/2] reftable: remove the "return_block" abstraction Ævar Arnfjörð Bjarmason
2022-04-15 13:37 ` René Scharfe
2022-04-25 9:57 ` Han-Wen Nienhuys [this message]
2022-04-25 17:30 ` Junio C Hamano
2022-04-15 10:21 ` [RFC PATCH 2/2] reftable: don't memset() a NULL from failed malloc() Ævar Arnfjörð Bjarmason
2022-04-15 13:37 ` René Scharfe
2022-04-15 13:53 ` Ævar Arnfjörð Bjarmason
2022-04-15 14:30 ` Phillip Wood
2022-04-15 15:20 ` Ævar Arnfjörð Bjarmason
2022-04-15 16:23 ` Junio C Hamano
2022-04-25 10:30 ` Han-Wen Nienhuys
2022-04-25 10:18 ` [PATCH v2] reftable: avoid undefined behaviour breaking t0032 Han-Wen Nienhuys
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: http://vger.kernel.org/majordomo-info.html
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to='CAFQ2z_O7ytx=AsXuJbYnOdMwT0u03sMP-ZjRRjt4HFn48HT-2g@mail.gmail.com' \
--to=hanwen@google.com \
--cc=avarab@gmail.com \
--cc=carenas@gmail.com \
--cc=git@vger.kernel.org \
--cc=gitster@pobox.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://80x24.org/mirrors/git.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).