Skip to content

Commit 2a5ad7d

Browse files
author
Edward Thomson
committed
fsync: call it "synchronous" object writing
Rename `GIT_OPT_ENABLE_SYNCHRONIZED_OBJECT_CREATION` -> `GIT_OPT_ENABLE_SYNCHRONOUS_OBJECT_CREATION`.
1 parent 1229e1c commit 2a5ad7d

File tree

10 files changed

+19
-19
lines changed

10 files changed

+19
-19
lines changed

include/git2/common.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -179,7 +179,7 @@ typedef enum {
179179
GIT_OPT_SET_SSL_CIPHERS,
180180
GIT_OPT_GET_USER_AGENT,
181181
GIT_OPT_ENABLE_OFS_DELTA,
182-
GIT_OPT_ENABLE_SYNCHRONIZED_OBJECT_CREATION,
182+
GIT_OPT_ENABLE_SYNCHRONOUS_OBJECT_CREATION,
183183
} git_libgit2_opt_t;
184184

185185
/**
@@ -317,7 +317,7 @@ typedef enum {
317317
* > Packfiles containing offset deltas can still be read.
318318
* > This defaults to enabled.
319319
*
320-
* * opts(GIT_OPT_ENABLE_SYNCHRONIZED_OBJECT_CREATION, int enabled)
320+
* * opts(GIT_OPT_ENABLE_SYNCHRONOUS_OBJECT_CREATION, int enabled)
321321
*
322322
* > Enable synchronized writes of new objects using `fsync`
323323
* > (or the platform equivalent) to ensure that new object data

src/indexer.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -991,7 +991,7 @@ int git_indexer_commit(git_indexer *idx, git_transfer_progress *stats)
991991

992992
if (git_filebuf_open(&index_file, filename.ptr,
993993
GIT_FILEBUF_HASH_CONTENTS |
994-
(git_object__synchronized_writing ? GIT_FILEBUF_FSYNC : 0),
994+
(git_object__synchronous_writing ? GIT_FILEBUF_FSYNC : 0),
995995
idx->mode) < 0)
996996
goto on_error;
997997

@@ -1069,7 +1069,7 @@ int git_indexer_commit(git_indexer *idx, git_transfer_progress *stats)
10691069
return -1;
10701070
}
10711071

1072-
if (git_object__synchronized_writing && p_fsync(idx->pack->mwf.fd) < 0) {
1072+
if (git_object__synchronous_writing && p_fsync(idx->pack->mwf.fd) < 0) {
10731073
giterr_set(GITERR_OS, "failed to fsync packfile");
10741074
goto on_error;
10751075
}
@@ -1090,7 +1090,7 @@ int git_indexer_commit(git_indexer *idx, git_transfer_progress *stats)
10901090
goto on_error;
10911091

10921092
/* And fsync the parent directory if we're asked to. */
1093-
if (git_object__synchronized_writing &&
1093+
if (git_object__synchronous_writing &&
10941094
git_futils_fsync_parent(git_buf_cstr(&filename)) < 0)
10951095
goto on_error;
10961096

src/object.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
#include "tag.h"
1717

1818
bool git_object__strict_input_validation = true;
19-
bool git_object__synchronized_writing = false;
19+
bool git_object__synchronous_writing = false;
2020

2121
typedef struct {
2222
const char *str; /* type name string */

src/object.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
#include "repository.h"
1111

1212
extern bool git_object__strict_input_validation;
13-
extern bool git_object__synchronized_writing;
13+
extern bool git_object__synchronous_writing;
1414

1515
/** Base git object for inheritance */
1616
struct git_object {

src/odb_loose.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -844,7 +844,7 @@ static int filebuf_flags(loose_backend *backend)
844844
int flags = GIT_FILEBUF_TEMPORARY |
845845
(backend->object_zlib_level << GIT_FILEBUF_DEFLATE_SHIFT);
846846

847-
if (backend->fsync_object_files || git_object__synchronized_writing)
847+
if (backend->fsync_object_files || git_object__synchronous_writing)
848848
flags |= GIT_FILEBUF_FSYNC;
849849

850850
return flags;

src/refdb_fs.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -756,7 +756,7 @@ static int loose_lock(git_filebuf *file, refdb_fs_backend *backend, const char *
756756
return -1;
757757

758758
filebuf_flags = GIT_FILEBUF_FORCE;
759-
if (git_object__synchronized_writing)
759+
if (git_object__synchronous_writing)
760760
filebuf_flags |= GIT_FILEBUF_FSYNC;
761761

762762
error = git_filebuf_open(file, ref_path.ptr, filebuf_flags, GIT_REFS_FILE_MODE);
@@ -1001,7 +1001,7 @@ static int packed_write(refdb_fs_backend *backend)
10011001
if ((error = git_sortedcache_wlock(refcache)) < 0)
10021002
return error;
10031003

1004-
if (git_object__synchronized_writing)
1004+
if (git_object__synchronous_writing)
10051005
open_flags = GIT_FILEBUF_FSYNC;
10061006

10071007
/* Open the file! */
@@ -1861,7 +1861,7 @@ static int reflog_append(refdb_fs_backend *backend, const git_reference *ref, co
18611861

18621862
open_flags = O_WRONLY | O_CREAT | O_APPEND;
18631863

1864-
if (git_object__synchronized_writing)
1864+
if (git_object__synchronous_writing)
18651865
open_flags |= O_FSYNC;
18661866

18671867
error = git_futils_writebuffer(&buf, git_buf_cstr(&path), open_flags, GIT_REFLOG_FILE_MODE);

src/settings.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -227,8 +227,8 @@ int git_libgit2_opts(int key, ...)
227227
git_smart__ofs_delta_enabled = (va_arg(ap, int) != 0);
228228
break;
229229

230-
case GIT_OPT_ENABLE_SYNCHRONIZED_OBJECT_CREATION:
231-
git_object__synchronized_writing = (va_arg(ap, int) != 0);
230+
case GIT_OPT_ENABLE_SYNCHRONOUS_OBJECT_CREATION:
231+
git_object__synchronous_writing = (va_arg(ap, int) != 0);
232232
break;
233233

234234
default:

tests/odb/loose.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ void test_odb_loose__initialize(void)
6262

6363
void test_odb_loose__cleanup(void)
6464
{
65-
cl_git_pass(git_libgit2_opts(GIT_OPT_ENABLE_SYNCHRONIZED_OBJECT_CREATION, 0));
65+
cl_git_pass(git_libgit2_opts(GIT_OPT_ENABLE_SYNCHRONOUS_OBJECT_CREATION, 0));
6666
cl_fixture_cleanup("test-objects");
6767
}
6868

@@ -180,7 +180,7 @@ void test_odb_loose__fsync_obeys_odb_option(void)
180180

181181
void test_odb_loose__fsync_obeys_global_setting(void)
182182
{
183-
cl_git_pass(git_libgit2_opts(GIT_OPT_ENABLE_SYNCHRONIZED_OBJECT_CREATION, 1));
183+
cl_git_pass(git_libgit2_opts(GIT_OPT_ENABLE_SYNCHRONOUS_OBJECT_CREATION, 1));
184184
write_object_to_loose_odb(0);
185185
cl_assert(p_fsync__cnt > 0);
186186
}

tests/pack/packbuilder.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ void test_pack_packbuilder__cleanup(void)
3131
git_oid *o;
3232
unsigned int i;
3333

34-
cl_git_pass(git_libgit2_opts(GIT_OPT_ENABLE_SYNCHRONIZED_OBJECT_CREATION, 0));
34+
cl_git_pass(git_libgit2_opts(GIT_OPT_ENABLE_SYNCHRONOUS_OBJECT_CREATION, 0));
3535

3636
if (_commits_is_initialized) {
3737
_commits_is_initialized = 0;
@@ -200,7 +200,7 @@ void test_pack_packbuilder__does_not_fsync_by_default(void)
200200

201201
void test_pack_packbuilder__fsync_when_asked(void)
202202
{
203-
cl_git_pass(git_libgit2_opts(GIT_OPT_ENABLE_SYNCHRONIZED_OBJECT_CREATION, 1));
203+
cl_git_pass(git_libgit2_opts(GIT_OPT_ENABLE_SYNCHRONOUS_OBJECT_CREATION, 1));
204204
p_fsync__cnt = 0;
205205
seed_packbuilder();
206206
git_packbuilder_write(_packbuilder, ".", 0666, NULL, NULL);

tests/refs/create.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ void test_refs_create__cleanup(void)
2222

2323
cl_git_pass(git_libgit2_opts(GIT_OPT_ENABLE_STRICT_OBJECT_CREATION, 1));
2424
cl_git_pass(git_libgit2_opts(GIT_OPT_ENABLE_STRICT_SYMBOLIC_REF_CREATION, 1));
25-
cl_git_pass(git_libgit2_opts(GIT_OPT_ENABLE_SYNCHRONIZED_OBJECT_CREATION, 0));
25+
cl_git_pass(git_libgit2_opts(GIT_OPT_ENABLE_SYNCHRONOUS_OBJECT_CREATION, 0));
2626
}
2727

2828
void test_refs_create__symbolic(void)
@@ -323,7 +323,7 @@ void test_refs_create__fsyncs_when_requested(void)
323323
git_refdb *refdb;
324324
git_oid id;
325325

326-
cl_git_pass(git_libgit2_opts(GIT_OPT_ENABLE_SYNCHRONIZED_OBJECT_CREATION, 1));
326+
cl_git_pass(git_libgit2_opts(GIT_OPT_ENABLE_SYNCHRONOUS_OBJECT_CREATION, 1));
327327
p_fsync__cnt = 0;
328328

329329
git_oid_fromstr(&id, current_master_tip);

0 commit comments

Comments
 (0)