Re: [PATCH v2 4/7] reftable/stack: stop using `fsync_component()` directly
- From
Patrick Steinhardt <ps@pks.im>
- Date
- Nov 18, 2024, 15:26 UTC
- Message-ID
- <Zztcmgta-DnHFpjj@pks.im>
- In-Reply-To
- <CAOLa=ZQEmzZpH2SLXNgcPLD=CThQgwW4THUiDuPMaOkZWfp_LA@mail.gmail.com>
On Mon, Nov 18, 2024 at 02:02:54PM +0000, karthik nayak wrote:
Show 31 quoted lines
> Patrick Steinhardt <ps@pks.im> writes:
> > @@ -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(const struct reftable_write_options *opts, int fd)
> > {
> > - int *fdp = (int *)arg;
> > - return write_in_full(*fdp, data, sz);
> > + if (opts->fsync)
> > + return opts->fsync(fd);
> > + return fsync(fd);
> > }
> >
> > -static int reftable_fd_flush(void *arg)
> > +struct fd_writer {
> > + const struct reftable_write_options *opts;
> > + int fd;
> > +};
> > +
> > +static ssize_t fd_writer_write(void *arg, const void *data, size_t sz)
> > {
> > - int *fdp = (int *)arg;
> > + struct fd_writer *writer = arg;
> > + return write_in_full(writer->fd, data, sz);
>
> Tangent: eventually we'd also want to get rid of `write_in_full` no?
> Since it is also an internal Git implementation.
>
> The patch itself looks good to me.Yup. This is part of the next and final patch series that I'll send once this series here has landed.
Patrick