summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Cahill <michael.cahill@mongodb.com>2017-05-11 21:19:55 -0400
committerAlex Gorrod <alexander.gorrod@mongodb.com>2017-05-16 04:31:11 +1000
commit9b60343ed70a47233bcb90cc7ff2aa256dd272ab (patch)
treeb8eb2d0c7f9d00ad1b76637b8b619ca21e525b64
parentcb16839cfbdf338af95bed43ca40979ae6e32f54 (diff)
downloadmongo-9b60343ed70a47233bcb90cc7ff2aa256dd272ab.tar.gz
WT-3158 Fix structure layout on Windows. (#3416)
We use a pragma on Windows to force a struct to be packed, but were missing the "end" pragma that restores normal layout. The result was that most structs were being packed, leading to poor performance for workloads (particularly when accessing session structures).
-rwxr-xr-xdist/s_style10
-rw-r--r--src/include/btmem.h2
2 files changed, 7 insertions, 5 deletions
diff --git a/dist/s_style b/dist/s_style
index 388a481ef56..54a88bbeb4c 100755
--- a/dist/s_style
+++ b/dist/s_style
@@ -101,10 +101,12 @@ else
cat $t
fi
- # Alignment directive before "struct".
- egrep 'WT_COMPILER_TYPE_ALIGN.*struct' $f > $t
- test -s $t && {
- echo "$f: compiler alignment direction must precede \"struct\""
+ # If we don't have matching pack-begin and pack-end calls, we don't get
+ # an error, we just get a Windows performance regression.
+ egrep WT_PACKED_STRUCT $f > $t
+ cnt=`wc -l < $t`
+ test `expr "$cnt" % 2` -ne 0 && {
+ echo "$f: mismatched WT_PACKED_STRUCT_BEGIN/END lines"
cat $t
}
diff --git a/src/include/btmem.h b/src/include/btmem.h
index f1bb08d2699..b1d5df4e9d2 100644
--- a/src/include/btmem.h
+++ b/src/include/btmem.h
@@ -933,7 +933,7 @@ WT_PACKED_STRUCT_BEGIN(__wt_update)
#define WT_UPDATE_MEMSIZE(upd) \
WT_ALIGN(sizeof(WT_UPDATE) + \
(WT_UPDATE_DELETED_ISSET(upd) ? 0 : (upd)->size), 32)
-};
+WT_PACKED_STRUCT_END
/*
* WT_INSERT --