From: Patrick Steinhardt <ps@pks.im>
To: Justin Tobler <jltobler@gmail.com>
Cc: git@vger.kernel.org, Edward Thomson <ethomson@edwardthomson.com>
Subject: Re: [PATCH 4/7] reftable/stack: stop using `fsync_component()` directly
Date: Fri, 8 Nov 2024 07:17:07 +0100 [thread overview]
Message-ID: <Zy2s41sv4IlMoISl@pks.im> (raw)
In-Reply-To: <6ghxx5fmuzujegducuva77vpybihz6b5cnk75wdgv4pv2knac5@m3trfmg2dk5s>
On Thu, Nov 07, 2024 at 08:09:21PM -0600, Justin Tobler wrote:
> On 24/10/23 11:56AM, Patrick Steinhardt wrote:
> [snip]
> > diff --git a/reftable/stack.c b/reftable/stack.c
> > index 9ae716ff375..df4f3237007 100644
> > --- a/reftable/stack.c
> > +++ b/reftable/stack.c
> > @@ -43,17 +42,28 @@ static int stack_filename(struct reftable_buf *dest, struct reftable_stack *st,
> > return 0;
> > }
> >
> > -static ssize_t reftable_fd_write(void *arg, const void *data, size_t sz)
> > +static int stack_fsync(struct reftable_stack *st, int fd)
> > {
> > - int *fdp = (int *)arg;
> > - return write_in_full(*fdp, data, sz);
> > + if (st->opts.fsync)
> > + return st->opts.fsync(fd);
> > + return fsync(fd);
> > }
> >
> > -static int reftable_fd_flush(void *arg)
> > +struct fd_writer {
> > + struct reftable_stack *stack;
>
> Out of curiousity, from the stack I think we only need the callback in
> the options. Any reason we provide the whole stack here?
I just think that passing around function pointers doesn't make for a
good calling convention here, as it hides the fact that it is possible
to call this without a callback. But there isn't a reason to pass in the
whole stack, it would also be fine to instead pass in e.g. the write
options.
I think I'll do that instead.
Patrick
next prev parent reply other threads:[~2024-11-08 6:17 UTC|newest]
Thread overview: 43+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-10-23 9:55 [PATCH 0/7] reftable: stop using Git subsystems Patrick Steinhardt
2024-10-23 9:55 ` [PATCH 1/7] reftable/system: move "dir.h" to its only user Patrick Steinhardt
2024-10-24 4:18 ` Eric Sunshine
2024-10-23 9:55 ` [PATCH 2/7] reftable: explicitly handle hash format IDs Patrick Steinhardt
2024-11-07 23:11 ` Justin Tobler
2024-10-23 9:56 ` [PATCH 3/7] reftable/system: stop depending on "hash.h" Patrick Steinhardt
2024-11-08 1:10 ` Justin Tobler
2024-11-08 6:17 ` Patrick Steinhardt
2024-10-23 9:56 ` [PATCH 4/7] reftable/stack: stop using `fsync_component()` directly Patrick Steinhardt
2024-11-08 2:09 ` Justin Tobler
2024-11-08 6:17 ` Patrick Steinhardt [this message]
2024-10-23 9:56 ` [PATCH 5/7] reftable/system: provide thin wrapper for tempfile subsystem Patrick Steinhardt
2024-10-23 9:56 ` [PATCH 6/7] reftable/stack: drop only use of `get_locked_file_path()` Patrick Steinhardt
2024-10-23 9:56 ` [PATCH 7/7] reftable/system: provide thin wrapper for lockfile subsystem Patrick Steinhardt
2024-11-08 8:17 ` [PATCH v2 0/7] reftable: stop using Git subsystems Patrick Steinhardt
2024-11-08 8:17 ` [PATCH v2 1/7] reftable/system: move "dir.h" to its only user Patrick Steinhardt
2024-11-08 8:17 ` [PATCH v2 2/7] reftable: explicitly handle hash format IDs Patrick Steinhardt
2024-11-18 13:47 ` karthik nayak
2024-11-08 8:17 ` [PATCH v2 3/7] reftable/system: stop depending on "hash.h" Patrick Steinhardt
2024-11-12 5:53 ` Junio C Hamano
2024-11-18 13:54 ` karthik nayak
2024-11-08 8:17 ` [PATCH v2 4/7] reftable/stack: stop using `fsync_component()` directly Patrick Steinhardt
2024-11-18 14:02 ` karthik nayak
2024-11-18 15:26 ` Patrick Steinhardt
2024-11-08 8:17 ` [PATCH v2 5/7] reftable/system: provide thin wrapper for tempfile subsystem Patrick Steinhardt
2024-11-18 14:18 ` karthik nayak
2024-11-18 14:29 ` karthik nayak
2024-11-08 8:17 ` [PATCH v2 6/7] reftable/stack: drop only use of `get_locked_file_path()` Patrick Steinhardt
2024-11-08 8:17 ` [PATCH v2 7/7] reftable/system: provide thin wrapper for lockfile subsystem Patrick Steinhardt
2024-11-08 17:39 ` [PATCH v2 0/7] reftable: stop using Git subsystems Justin Tobler
2024-11-11 0:37 ` Junio C Hamano
2024-11-18 14:30 ` karthik nayak
2024-11-18 15:26 ` Patrick Steinhardt
2024-11-18 15:33 ` [PATCH v3 " Patrick Steinhardt
2024-11-18 15:33 ` [PATCH v3 1/7] reftable/system: move "dir.h" to its only user Patrick Steinhardt
2024-11-18 15:33 ` [PATCH v3 2/7] reftable: explicitly handle hash format IDs Patrick Steinhardt
2024-11-18 15:33 ` [PATCH v3 3/7] reftable/system: stop depending on "hash.h" Patrick Steinhardt
2024-11-18 15:34 ` [PATCH v3 4/7] reftable/stack: stop using `fsync_component()` directly Patrick Steinhardt
2024-11-18 15:34 ` [PATCH v3 5/7] reftable/system: provide thin wrapper for tempfile subsystem Patrick Steinhardt
2024-11-18 15:34 ` [PATCH v3 6/7] reftable/stack: drop only use of `get_locked_file_path()` Patrick Steinhardt
2024-11-18 15:34 ` [PATCH v3 7/7] reftable/system: provide thin wrapper for lockfile subsystem Patrick Steinhardt
2024-11-19 14:23 ` [PATCH v3 0/7] reftable: stop using Git subsystems karthik nayak
2024-11-20 1:09 ` Junio C Hamano
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
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=Zy2s41sv4IlMoISl@pks.im \
--to=ps@pks.im \
--cc=ethomson@edwardthomson.com \
--cc=git@vger.kernel.org \
--cc=jltobler@gmail.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.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.