From: Eric Sunshine <sunshine@sunshineco.com>
To: Eric Wong <e@80x24.org>
Cc: Git List <git@vger.kernel.org>
Subject: Re: [PATCH] allow disabling fsync everywhere
Date: Wed, 27 Oct 2021 21:21:25 -0400 [thread overview]
Message-ID: <CAPig+cSTL-Rr+-aHqm3rsM=PLrz+BaDj7+nXGYKnKcEHgEiGOQ@mail.gmail.com> (raw)
In-Reply-To: <20211028002102.19384-1-e@80x24.org>
On Wed, Oct 27, 2021 at 8:21 PM Eric Wong <e@80x24.org> wrote:
> "core.fsync" and the "GIT_FSYNC" environment variable now exist
> for disabling fsync() even on packfiles and other critical data.
> [...]
> Signed-off-by: Eric Wong <e@80x24.org>
> ---
> diff --git a/write-or-die.c b/write-or-die.c
> @@ -57,7 +58,9 @@ void fprintf_or_die(FILE *f, const char *fmt, ...)
> void fsync_or_die(int fd, const char *msg)
> {
> - while (fsync(fd) < 0) {
> + if (use_fsync < 0)
> + use_fsync = git_env_bool("GIT_FSYNC", 1);
> + while (use_fsync && fsync(fd) < 0) {
> if (errno != EINTR)
> die_errno("fsync error on '%s'", msg);
> }
This is minor, but placing `use_fsync` in the `while` condition makes
the logic harder to digest. The intent would be clearer at-a-glance if
structured like this:
if (use_fsync < 0)
use_fsync = git_env_bool("GIT_FSYNC", 1);
if (!use_fsync)
return;
while (fsync(fd) < 0) {
if (errno != EINTR)
die_errno("fsync error on '%s'", msg);
}
next prev parent reply other threads:[~2021-10-28 1:21 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-10-28 0:21 [PATCH] allow disabling fsync everywhere Eric Wong
2021-10-28 1:21 ` Eric Sunshine [this message]
2021-10-28 14:36 ` Jeff King
2021-10-28 18:28 ` Eric Wong
2021-10-28 19:29 ` Junio C Hamano
2021-10-29 0:15 ` [PATCH] tests: disable " Eric Wong
2021-10-29 5:18 ` Junio C Hamano
2021-10-29 7:56 ` Eric Wong
2021-10-29 18:12 ` Junio C Hamano
2021-10-29 7:33 ` Junio C Hamano
2021-10-29 7:48 ` Eric Wong
2021-10-29 17:22 ` Junio C Hamano
2021-10-29 20:34 ` Jeff King
2021-10-29 20:42 ` Junio C Hamano
2021-10-28 21:40 ` [PATCH] allow disabling " brian m. carlson
2021-10-29 11:20 ` Ævar Arnfjörð Bjarmason
2021-10-30 10:39 ` Eric Wong
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='CAPig+cSTL-Rr+-aHqm3rsM=PLrz+BaDj7+nXGYKnKcEHgEiGOQ@mail.gmail.com' \
--to=sunshine@sunshineco.com \
--cc=e@80x24.org \
--cc=git@vger.kernel.org \
/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).