diff options
author | Keith Bostic <keith.bostic@mongodb.com> | 2016-04-28 18:49:21 -0400 |
---|---|---|
committer | Alex Gorrod <alexander.gorrod@mongodb.com> | 2016-04-29 08:49:21 +1000 |
commit | 2c7411c77d3a95353c11b18777990ea9b9a68547 (patch) | |
tree | f61f7745d5eb31eff98c0b4c5be145b118071ad3 /src/os_posix | |
parent | dbaaa69606853f3555db68721a17d66ff68558ec (diff) | |
download | mongo-2c7411c77d3a95353c11b18777990ea9b9a68547.tar.gz |
WT-2552 Minor cleanup of new pluggable file system API
* WT-2552 Add public API for pluggable filesystems
When swapping handling functions in the POSIX WT_FILE_HANDLE.fallocate
function, add a write-barrier so we never see an inconsistent set of
functions. It probably wouldn't matter, but let's not find out.
* WT-2552 Add public API for pluggable filesystems
Fix a couple of places in the in-memory code where we were redirecting
through the iface structure unnecessarily.
* WT-2552 Add public API for pluggable filesystems
Consistently do diagnostic asserts on read-only in the WiredTiger stub
functions, not in the underlying file-system/file-handle layer.
Diffstat (limited to 'src/os_posix')
-rw-r--r-- | src/os_posix/os_fallocate.c | 17 | ||||
-rw-r--r-- | src/os_posix/os_fs.c | 2 |
2 files changed, 12 insertions, 7 deletions
diff --git a/src/os_posix/os_fallocate.c b/src/os_posix/os_fallocate.c index 92569d84c99..a162dbe01a1 100644 --- a/src/os_posix/os_fallocate.c +++ b/src/os_posix/os_fallocate.c @@ -109,8 +109,13 @@ __wt_posix_file_fallocate(WT_FILE_HANDLE *file_handle, WT_SESSION *wt_session, wt_off_t offset, wt_off_t len) { /* - * The first fallocate call: figure out what allocation call this - * system/filesystem supports, if any. + * The first fallocate call: figure out what fallocate call this system + * supports, if any. + * + * The function is configured as a locking fallocate call, so we know + * we're single-threaded through here. Set the nolock function first, + * then publish the NULL replacement to ensure the handle functions are + * always correct. * * We've seen Linux systems where posix_fallocate has corrupted * existing file data (even though that is explicitly disallowed @@ -120,26 +125,28 @@ __wt_posix_file_fallocate(WT_FILE_HANDLE *file_handle, * avoid locking on Linux if at all possible. */ if (__posix_std_fallocate(file_handle, wt_session, offset, len) == 0) { - file_handle->fallocate = NULL; file_handle->fallocate_nolock = __posix_std_fallocate; + WT_PUBLISH(file_handle->fallocate, NULL); return (0); } if (__posix_sys_fallocate(file_handle, wt_session, offset, len) == 0) { - file_handle->fallocate = NULL; file_handle->fallocate_nolock = __posix_sys_fallocate; + WT_PUBLISH(file_handle->fallocate, NULL); return (0); } if (__posix_posix_fallocate( file_handle, wt_session, offset, len) == 0) { #if defined(__linux__) file_handle->fallocate = __posix_posix_fallocate; + WT_WRITE_BARRIER(); #else - file_handle->fallocate = NULL; file_handle->fallocate_nolock = __posix_posix_fallocate; + WT_PUBLISH(file_handle->fallocate, NULL); #endif return (0); } file_handle->fallocate = NULL; + WT_WRITE_BARRIER(); return (ENOTSUP); } diff --git a/src/os_posix/os_fs.c b/src/os_posix/os_fs.c index 9645652d3e9..b173eaf79c0 100644 --- a/src/os_posix/os_fs.c +++ b/src/os_posix/os_fs.c @@ -18,8 +18,6 @@ __posix_sync( { WT_DECL_RET; - WT_ASSERT(session, !F_ISSET(S2C(session), WT_CONN_READONLY)); - #if defined(F_FULLFSYNC) /* * OS X fsync documentation: |