This was causing a problem in the Striper, but fixing it here will avoid
corner cases all over the tree. Note that we have to bail out before
the end-of-buffer check to avoid hitting that check when the bufferlist is
also empty.
Signed-off-by: Sage Weil <sage@inktank.com>
Reviewed-by: Greg Farnum <greg@inktank.com>
(cherry picked from commit
ff5abfbdae07ae8a56fa83ebaa92000896f793c2)
// funky modifer
void buffer::list::splice(unsigned off, unsigned len, list *claim_by /*, bufferlist& replace_with */)
{ // fixme?
+ if (len == 0)
+ return;
+
if (off >= length())
throw end_of_buffer();
bl.push_back(ptr);
}
EXPECT_EQ((unsigned)4, bl.buffers().size());
- EXPECT_THROW(bl.splice(0, 0), FailedAssertion);
+ bl.splice(0, 0);
bufferlist other;
other.append('X');