diff options
author | dwmalone <dwmalone@FreeBSD.org> | 2016-03-06 08:40:21 +0000 |
---|---|---|
committer | dwmalone <dwmalone@FreeBSD.org> | 2016-03-06 08:40:21 +0000 |
commit | 241b0e18f171e529b4c5596005704c3a624ed8a2 (patch) | |
tree | 9d2f3d254b89e615e0898ef9139e0860f9eb2455 /lib | |
parent | 0ea76a354b90d5bf90722372c52d1f37889dbdfe (diff) | |
download | FreeBSD-src-241b0e18f171e529b4c5596005704c3a624ed8a2.zip FreeBSD-src-241b0e18f171e529b4c5596005704c3a624ed8a2.tar.gz |
MFC:
r295924: Make sure that hash-based db files fsync befor closing/syncing.
r295925: We no longer need O_SYNC pwd_mkd
r295465: We no longer need O_SYNC on services_mkdb
r295800: We no longer need O_SYNC on cap_mkdb
This should improve the performance of building db files.
Diffstat (limited to 'lib')
-rw-r--r-- | lib/libc/db/hash/hash.c | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/lib/libc/db/hash/hash.c b/lib/libc/db/hash/hash.c index af80929..333b1a1 100644 --- a/lib/libc/db/hash/hash.c +++ b/lib/libc/db/hash/hash.c @@ -422,8 +422,10 @@ hdestroy(HTAB *hashp) if (hashp->tmp_buf) free(hashp->tmp_buf); - if (hashp->fp != -1) + if (hashp->fp != -1) { + (void)_fsync(hashp->fp); (void)_close(hashp->fp); + } free(hashp); @@ -458,6 +460,8 @@ hash_sync(const DB *dbp, u_int32_t flags) return (0); if (__buf_free(hashp, 0, 1) || flush_meta(hashp)) return (ERROR); + if (hashp->fp != -1 && _fsync(hashp->fp) != 0) + return (ERROR); hashp->new_file = 0; return (0); } |