summaryrefslogtreecommitdiff
path: root/src/third_party/wiredtiger/src/block/block_ext.c
diff options
context:
space:
mode:
authorAlex Gorrod <alexg@wiredtiger.com>2016-04-05 14:43:57 +1000
committerAlex Gorrod <alexg@wiredtiger.com>2016-04-05 14:44:50 +1000
commitde6f136d83b20f8a58ba6fe4ba02be229b6c9159 (patch)
tree3221d66b54cbf6208fc3c995fdbb36d347ae85ff /src/third_party/wiredtiger/src/block/block_ext.c
parent5d1262cc394d685b59ae3185d7315227085e897d (diff)
downloadmongo-de6f136d83b20f8a58ba6fe4ba02be229b6c9159.tar.gz
Import wiredtiger-wiredtiger-2.8.0-134-g5047aab.tar.gz from wiredtiger branch mongodb-3.4
ref: 9cf8eb2..5047aab SERVER-23504 Coverity analysis defect 98177: Resource leak WT-2330 in-memory configurations should not create on-disk collection files WT-2513 conversion from 'int64_t' to 'uint32_t' WT-2522 Incorrect format code in message WT-2525 in-memory configurations: miscellaneous cleanups WT-2527 OS X compile error, missing POSIX_FADV_WILLNEED #define WT-2528 style error in WiredTiger build WT-2529 The readonly test case is crashing with a stack overflow WT-2531 in-memory tables are allocating unnecessary memory WT-2532 WT_STREAM_APPEND and WT_STREAM_LINE_BUFFER flag overlap WT-2533 Ensure that in-memory tables don't report a zero size SERVER-23517 WiredTiger changes for MongoDB 3.3.5
Diffstat (limited to 'src/third_party/wiredtiger/src/block/block_ext.c')
-rw-r--r--src/third_party/wiredtiger/src/block/block_ext.c25
1 files changed, 9 insertions, 16 deletions
diff --git a/src/third_party/wiredtiger/src/block/block_ext.c b/src/third_party/wiredtiger/src/block/block_ext.c
index ab5d5604087..caafcc77c48 100644
--- a/src/third_party/wiredtiger/src/block/block_ext.c
+++ b/src/third_party/wiredtiger/src/block/block_ext.c
@@ -462,17 +462,13 @@ static inline int
__block_extend(
WT_SESSION_IMPL *session, WT_BLOCK *block, wt_off_t *offp, wt_off_t size)
{
- WT_FH *fh;
-
- fh = block->fh;
-
/*
* Callers of this function are expected to have already acquired any
* locks required to extend the file.
*
* We should never be allocating from an empty file.
*/
- if (fh->size < block->allocsize)
+ if (block->size < block->allocsize)
WT_RET_MSG(session, EINVAL,
"file has no description information");
@@ -482,12 +478,12 @@ __block_extend(
* 8B bits (we currently check an wt_off_t is 8B in verify_build.h). I
* don't think we're likely to see anything bigger for awhile.
*/
- if (fh->size > (wt_off_t)INT64_MAX - size)
+ if (block->size > (wt_off_t)INT64_MAX - size)
WT_RET_MSG(session, WT_ERROR,
"block allocation failed, file cannot grow further");
- *offp = fh->size;
- fh->size += size;
+ *offp = block->size;
+ block->size += size;
WT_STAT_FAST_DATA_INCR(session, block_extension);
WT_RET(__wt_verbose(session, WT_VERB_BLOCK,
@@ -1343,19 +1339,16 @@ __wt_block_extlist_truncate(
WT_SESSION_IMPL *session, WT_BLOCK *block, WT_EXTLIST *el)
{
WT_EXT *ext, **astack[WT_SKIP_MAXDEPTH];
- WT_FH *fh;
wt_off_t orig, size;
- fh = block->fh;
-
/*
* Check if the last available extent is at the end of the file, and if
* so, truncate the file and discard the extent.
*/
if ((ext = __block_off_srch_last(el->off, astack)) == NULL)
return (0);
- WT_ASSERT(session, ext->off + ext->size <= fh->size);
- if (ext->off + ext->size < fh->size)
+ WT_ASSERT(session, ext->off + ext->size <= block->size);
+ if (ext->off + ext->size < block->size)
return (0);
/*
@@ -1363,10 +1356,10 @@ __wt_block_extlist_truncate(
* the cached file size, and that can't happen until after the extent
* list removal succeeds.)
*/
- orig = fh->size;
+ orig = block->size;
size = ext->off;
WT_RET(__block_off_remove(session, block, el, size, NULL));
- fh->size = size;
+ block->size = size;
/*
* Truncate the file. The truncate might fail if there's a file mapping
@@ -1376,7 +1369,7 @@ __wt_block_extlist_truncate(
WT_RET(__wt_verbose(session, WT_VERB_BLOCK,
"truncate file from %" PRIdMAX " to %" PRIdMAX,
(intmax_t)orig, (intmax_t)size));
- WT_RET_BUSY_OK(__wt_block_truncate(session, block->fh, size));
+ WT_RET_BUSY_OK(__wt_block_truncate(session, block, size));
return (0);
}