Skip to content

Conversation

fanquake
Copy link
Member

Rather than just using on Linux and NetBSD, use fdatasync() based
on whether it's available. i.e fdatasync is available in newer versions of FreeBSD.

This also aligns more closely with what is being done in leveldb.

Was pointed out by Luke in #19430.

Rather than just using it on Linux and NetBSD, use `fdatasync()` based
on whether it's available. i.e it is available in newer versions
of FreeBSD (11.1 and later).

This also aligns our code more closely with what is being done in leveldb.

Was pointed out by Luke in bitcoin#19430.
@DrahtBot
Copy link
Contributor

The following sections might be updated with supplementary metadata relevant to reviewers and maintainers.

Conflicts

Reviewers, this pull request conflicts with the following ones:

If you consider this pull request important, please also help to review the conflicting pull requests. Ideally, start with the one that should be merged first.

Copy link
Member

@hebasto hebasto left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ACK 1d8338d

HAVE_FDATASYNC is defined here:

bitcoin/configure.ac

Lines 1014 to 1020 in 2f71a1e

dnl LevelDB platform checks
AC_MSG_CHECKING(for fdatasync)
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <unistd.h>]],
[[ fdatasync(0); ]])],
[ AC_MSG_RESULT(yes); HAVE_FDATASYNC=1 ],
[ AC_MSG_RESULT(no); HAVE_FDATASYNC=0 ]
)

and dnl LevelDB platform checks comment seems outdated now.

@DrahtBot
Copy link
Contributor

Gitian builds

File commit a41ae68
(master)
commit 23a899d
(master and this pull)
*-aarch64-linux-gnu-debug.tar.gz 2c5d1671feadd5e0... 88e896065793e457...
*-aarch64-linux-gnu.tar.gz c7062ea145dcbd3b... 79eadb5a7b818f12...
*-arm-linux-gnueabihf-debug.tar.gz 7e77e81bd5ec6f8a... 9ac2355251f91774...
*-arm-linux-gnueabihf.tar.gz 84ccb33a9842229d... 9b879e43e3331f97...
*-osx-unsigned.dmg 4a9adb0aa5ec9a6f... 857f7b32c6a1634b...
*-osx64.tar.gz 545fa26bc01a9b79... d34e7ac615266fb6...
*-riscv64-linux-gnu-debug.tar.gz 2c4d543bc1b43d33... 8fa4edab26644fea...
*-riscv64-linux-gnu.tar.gz 41bca6ecee146491... fd80fcf7ad14ac5a...
*-win64-debug.zip 9f8bb80a3fd510b8... 71f082a0c710cf5b...
*-win64-setup-unsigned.exe db04c170eb0f0c75... 7f03cfbb8ef814ca...
*-win64.zip c2ffbc59409f3c00... 714f958f42159a84...
*-x86_64-linux-gnu-debug.tar.gz 15a0f0131e7daef1... fe84f19e087c2753...
*-x86_64-linux-gnu.tar.gz 22446c2d1d1d1b4d... e37d7151dfd1876d...
*.tar.gz a623828de9051d68... d9372d15e2d72920...
bitcoin-core-linux-0.21-res.yml 00484df79e5bcebf... 62cf9376723af9b6...
bitcoin-core-osx-0.21-res.yml f850bd04d4efe283... c14945487090308b...
bitcoin-core-win-0.21-res.yml 5a1e861d61d968f1... 1e08ac81f4765cbe...
linux-build.log 33a770b52a732fab... 25f673974e2f4b80...
osx-build.log fe6f0571f7541f57... 03dddb17abad5df9...
win-build.log c7cae424b8235045... ee9e48b59ef97779...
bitcoin-core-linux-0.21-res.yml.diff 8209209053652b0f...
bitcoin-core-osx-0.21-res.yml.diff ef3ec4ebdcddfb1f...
bitcoin-core-win-0.21-res.yml.diff baf7cfa6e1746c45...
linux-build.log.diff cda35ff5b2e78a2b...
osx-build.log.diff 0e0b7a60a63a5785...
win-build.log.diff 8fee1e52f55901a8...

@DrahtBot
Copy link
Contributor

Guix builds

File commit 8db2334
(master)
commit 939b8d1
(master and this pull)
*-aarch64-linux-gnu-debug.tar.gz d6b57beb5563ca6f... 28ff9966094d1c09...
*-aarch64-linux-gnu.tar.gz 1d94eea3e5cbf71a... ae01d9d16f33cd0d...
*-arm-linux-gnueabihf-debug.tar.gz 39cf2efb57a15779... 8b9cbb90545a08df...
*-arm-linux-gnueabihf.tar.gz ea581c23aaa89ef5... 91bce2fbc5ab2586...
*-riscv64-linux-gnu-debug.tar.gz 4dce94f7be912c67... ef8f261fc3bf9300...
*-riscv64-linux-gnu.tar.gz 0f33b0d1cae94bac... 592b5a44acf1e093...
*-win-unsigned.tar.gz 61595ca3b7550e2d... 4ff6494b0b1929f9...
*-win64-debug.zip 722570586f961976... baa17049d282f781...
*-win64-setup-unsigned.exe 7fee753a79251a55... e8481a5aa7d49084...
*-win64.zip 90fb39f80493b473... 277603577b7b707a...
*-x86_64-linux-gnu-debug.tar.gz ee1e44745f2c540a... 0a68735a091a7de0...
*-x86_64-linux-gnu.tar.gz 00a382982c4a3791... 3e4d515d97fe3e8a...
*.tar.gz f7c2ffa73666984d... 4b968d73507f71cf...
guix_build.log 4c2f5c058987faa9... 834aab9d9c57dc2e...
guix_build.log.diff b363a29b903fda95...

@practicalswift
Copy link
Contributor

ACK 1d8338d -- patch looks correct

@laanwj
Copy link
Member

laanwj commented Aug 5, 2020

Wait, we already probe for HAVE_FDATASYNC in the build system but don't use it? Weird.
ACK 1d8338d

@laanwj laanwj merged commit e3272ff into bitcoin:master Aug 5, 2020
sidhujag pushed a commit to syscoin/syscoin that referenced this pull request Aug 5, 2020
…) use

1d8338d util: use HAVE_FDATASYNC to determine fdatasync() use (fanquake)

Pull request description:

  Rather than just using on Linux and NetBSD, use `fdatasync()` based
  on whether it's available. i.e `fdatasync` is available in newer versions of FreeBSD.

  This also aligns more closely with what is being done in leveldb.

  Was pointed out by Luke in bitcoin#19430.

ACKs for top commit:
  practicalswift:
    ACK 1d8338d -- patch looks correct
  laanwj:
    ACK 1d8338d
  hebasto:
    ACK 1d8338d

Tree-SHA512: 7dd6d87f5dc0c0ba21ae42f96b63fc12b34806cd536457fc4284f14bb8c235765344be228b000c6adf4cd1e8c4e6a03a18ca18ab22599c42cc3b706e0bcd1a17
@fanquake fanquake deleted the use_have_fdatasync branch August 6, 2020 00:39
@luke-jr
Copy link
Member

luke-jr commented Aug 20, 2020

HAVE_FDATASYNC was only being defined for LevelDB. Added a fix for this to #14501

fanquake added a commit that referenced this pull request Aug 31, 2020
… LevelDB

c4b85ba Bugfix: Define and use HAVE_FDATASYNC correctly outside LevelDB (Luke Dashjr)

Pull request description:

  Fixes a bug introduced in #19614

  The LevelDB-specific fdatasync check was only using `AC_SUBST`, which works for Makefiles, but doesn't define anything for C++. Furthermore, the #define is typically 0 or 1, never undefined.

  This fixes both issues by defining it and checking its value instead of whether it is merely defined.

  Pulled out of #14501 by fanquake's request

ACKs for top commit:
  fanquake:
    ACK c4b85ba - thanks for catching and fixing my mistake.
  laanwj:
     Code review ACK c4b85ba

Tree-SHA512: 91d5d426ba000b4f3ee7e2315635e24bbb23ceff16269ddf4f65a63d25fc9e9cf94a3b236eed2f8031cc36ddcf78aeb5916efcb244f415943a8a12f907ede8f9
sidhujag pushed a commit to syscoin/syscoin that referenced this pull request Aug 31, 2020
…outside LevelDB

c4b85ba Bugfix: Define and use HAVE_FDATASYNC correctly outside LevelDB (Luke Dashjr)

Pull request description:

  Fixes a bug introduced in bitcoin#19614

  The LevelDB-specific fdatasync check was only using `AC_SUBST`, which works for Makefiles, but doesn't define anything for C++. Furthermore, the #define is typically 0 or 1, never undefined.

  This fixes both issues by defining it and checking its value instead of whether it is merely defined.

  Pulled out of bitcoin#14501 by fanquake's request

ACKs for top commit:
  fanquake:
    ACK c4b85ba - thanks for catching and fixing my mistake.
  laanwj:
     Code review ACK c4b85ba

Tree-SHA512: 91d5d426ba000b4f3ee7e2315635e24bbb23ceff16269ddf4f65a63d25fc9e9cf94a3b236eed2f8031cc36ddcf78aeb5916efcb244f415943a8a12f907ede8f9
Fabcien pushed a commit to Bitcoin-ABC/bitcoin-abc that referenced this pull request Sep 7, 2021
Summary:
> Rather than just using it on Linux and NetBSD, use `fdatasync()` based
>  on whether it's available. i.e it is available in newer versions
> of FreeBSD (11.1 and later).
>
> This also aligns our code more closely with what is being done in leveldb.
>
> Was pointed out by Luke in #19430.

This is a backport of [[bitcoin/bitcoin#19614 | core#19614]]

Test Plan: `ninja all check-all`

Reviewers: #bitcoin_abc, majcosta

Reviewed By: #bitcoin_abc, majcosta

Differential Revision: https://reviews.bitcoinabc.org/D10060
PastaPastaPasta pushed a commit to PastaPastaPasta/dash that referenced this pull request Sep 17, 2021
…) use

1d8338d util: use HAVE_FDATASYNC to determine fdatasync() use (fanquake)

Pull request description:

  Rather than just using on Linux and NetBSD, use `fdatasync()` based
  on whether it's available. i.e `fdatasync` is available in newer versions of FreeBSD.

  This also aligns more closely with what is being done in leveldb.

  Was pointed out by Luke in bitcoin#19430.

ACKs for top commit:
  practicalswift:
    ACK 1d8338d -- patch looks correct
  laanwj:
    ACK 1d8338d
  hebasto:
    ACK 1d8338d

Tree-SHA512: 7dd6d87f5dc0c0ba21ae42f96b63fc12b34806cd536457fc4284f14bb8c235765344be228b000c6adf4cd1e8c4e6a03a18ca18ab22599c42cc3b706e0bcd1a17
PastaPastaPasta pushed a commit to PastaPastaPasta/dash that referenced this pull request Sep 19, 2021
…) use

1d8338d util: use HAVE_FDATASYNC to determine fdatasync() use (fanquake)

Pull request description:

  Rather than just using on Linux and NetBSD, use `fdatasync()` based
  on whether it's available. i.e `fdatasync` is available in newer versions of FreeBSD.

  This also aligns more closely with what is being done in leveldb.

  Was pointed out by Luke in bitcoin#19430.

ACKs for top commit:
  practicalswift:
    ACK 1d8338d -- patch looks correct
  laanwj:
    ACK 1d8338d
  hebasto:
    ACK 1d8338d

Tree-SHA512: 7dd6d87f5dc0c0ba21ae42f96b63fc12b34806cd536457fc4284f14bb8c235765344be228b000c6adf4cd1e8c4e6a03a18ca18ab22599c42cc3b706e0bcd1a17
thelazier pushed a commit to thelazier/dash that referenced this pull request Sep 25, 2021
…) use

1d8338d util: use HAVE_FDATASYNC to determine fdatasync() use (fanquake)

Pull request description:

  Rather than just using on Linux and NetBSD, use `fdatasync()` based
  on whether it's available. i.e `fdatasync` is available in newer versions of FreeBSD.

  This also aligns more closely with what is being done in leveldb.

  Was pointed out by Luke in bitcoin#19430.

ACKs for top commit:
  practicalswift:
    ACK 1d8338d -- patch looks correct
  laanwj:
    ACK 1d8338d
  hebasto:
    ACK 1d8338d

Tree-SHA512: 7dd6d87f5dc0c0ba21ae42f96b63fc12b34806cd536457fc4284f14bb8c235765344be228b000c6adf4cd1e8c4e6a03a18ca18ab22599c42cc3b706e0bcd1a17
@bitcoin bitcoin locked as resolved and limited conversation to collaborators Feb 15, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants