summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSage Weil <sage@inktank.com>2013-09-27 21:07:17 -0700
committerSage Weil <sage@inktank.com>2013-10-16 09:28:14 -0700
commitd9e30775c08ecef79ff692fff39ada5bc98bfe90 (patch)
tree4a7a13266fdcc1c8073d11784395aa94e8c87b63
parent9626aaf43b78c9efd8c32c34fd8c42555be82632 (diff)
downloadceph-d9e30775c08ecef79ff692fff39ada5bc98bfe90.tar.gz
common/buffer: pass NULL buffer instead of a zero-filled one
This is about 2x faster on my box using the sctp code. Signed-off-by: Sage Weil <sage@inktank.com>
-rw-r--r--src/common/buffer.cc21
1 files changed, 1 insertions, 20 deletions
diff --git a/src/common/buffer.cc b/src/common/buffer.cc
index 064775d2993..4aa03ae4131 100644
--- a/src/common/buffer.cc
+++ b/src/common/buffer.cc
@@ -31,18 +31,6 @@
namespace ceph {
- // some zeros; used when concatenating buffers with cached crc
- static unsigned char zbuf[128] = {
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
- };
-
#ifdef BUFFER_DEBUG
static uint32_t simple_spinlock_t buffer_debug_lock = SIMPLE_SPINLOCK_INITIALIZER;
# define bdout { simple_spin_lock(&buffer_debug_lock); std::cout
@@ -1346,14 +1334,7 @@ __u32 buffer::list::crc32c(__u32 crc) const
* http://crcutil.googlecode.com/files/crc-doc.1.0.pdf
* note, u for our crc32c implementation is 0
*/
- int64_t adjustment = ccrc.first ^ crc;
- size_t remaining = it->length();
- for (; remaining > sizeof(zbuf); remaining -= sizeof(zbuf)) {
- adjustment = ceph_crc32c(adjustment, zbuf, sizeof(zbuf));
- }
- if (remaining)
- adjustment = ceph_crc32c(adjustment, zbuf, remaining);
- crc = ccrc.second ^ adjustment;
+ crc = ccrc.second ^ ceph_crc32c(ccrc.first ^ crc, NULL, it->length());
if (buffer_track_crc)
buffer_cached_crc_adjusted.inc();
}