diff options
author | Keith Bostic <keith.bostic@mongodb.com> | 2016-08-12 03:02:58 -0400 |
---|---|---|
committer | Michael Cahill <michael.cahill@mongodb.com> | 2016-08-12 17:02:58 +1000 |
commit | 707807a81fbf06766006b8d63393414205fda181 (patch) | |
tree | 8c039560c34d282489269877ce7a45244800e0e9 /src/os_common | |
parent | f69bbc18148c6fced50b01e04d552f0053fce20c (diff) | |
download | mongo-707807a81fbf06766006b8d63393414205fda181.tar.gz |
WT-2823 support file handles without a truncate method (#2940)
* Rework the block manager to ignore whether or not truncate works at a low-level, rather than handling errors we don't care about in the callers.
Diffstat (limited to 'src/os_common')
-rw-r--r-- | src/os_common/os_fhandle.c | 5 | ||||
-rw-r--r-- | src/os_common/os_fs_inmemory.c | 36 |
2 files changed, 2 insertions, 39 deletions
diff --git a/src/os_common/os_fhandle.c b/src/os_common/os_fhandle.c index 055d784a8db..3466f0d4e9b 100644 --- a/src/os_common/os_fhandle.c +++ b/src/os_common/os_fhandle.c @@ -37,10 +37,9 @@ __fhandle_method_finalize( if (!readonly) WT_HANDLE_METHOD_REQ(fh_sync); /* not required: fh_sync_nowait */ - if (!readonly) { - WT_HANDLE_METHOD_REQ(fh_truncate); + /* not required: fh_truncate */ + if (!readonly) WT_HANDLE_METHOD_REQ(fh_write); - } return (0); } diff --git a/src/os_common/os_fs_inmemory.c b/src/os_common/os_fs_inmemory.c index 178adc1dac8..70a82007300 100644 --- a/src/os_common/os_fs_inmemory.c +++ b/src/os_common/os_fs_inmemory.c @@ -391,41 +391,6 @@ __im_file_sync(WT_FILE_HANDLE *file_handle, WT_SESSION *wt_session) } /* - * __im_file_truncate -- - * POSIX ftruncate. - */ -static int -__im_file_truncate( - WT_FILE_HANDLE *file_handle, WT_SESSION *wt_session, wt_off_t offset) -{ - WT_DECL_RET; - WT_FILE_HANDLE_INMEM *im_fh; - WT_FILE_SYSTEM_INMEM *im_fs; - WT_SESSION_IMPL *session; - size_t off; - - im_fh = (WT_FILE_HANDLE_INMEM *)file_handle; - im_fs = (WT_FILE_SYSTEM_INMEM *)file_handle->file_system; - session = (WT_SESSION_IMPL *)wt_session; - - __wt_spin_lock(session, &im_fs->lock); - - /* - * Grow the buffer as necessary, clear any new space in the file, and - * reset the file's data length. - */ - off = (size_t)offset; - WT_ERR(__wt_buf_grow(session, &im_fh->buf, off)); - if (im_fh->buf.size < off) - memset((uint8_t *)im_fh->buf.data + im_fh->buf.size, - 0, off - im_fh->buf.size); - im_fh->buf.size = off; - -err: __wt_spin_unlock(session, &im_fs->lock); - return (ret); -} - -/* * __im_file_write -- * POSIX pwrite. */ @@ -526,7 +491,6 @@ __im_file_open(WT_FILE_SYSTEM *file_system, WT_SESSION *wt_session, file_handle->fh_read = __im_file_read; file_handle->fh_size = __im_file_size; file_handle->fh_sync = __im_file_sync; - file_handle->fh_truncate = __im_file_truncate; file_handle->fh_write = __im_file_write; *file_handlep = file_handle; |