block_t pblock = diskstart;
// verify csum
+ csum_t want = sp->second.csum;
csum_t actual = calc_csum(bl.c_str(), bl.length());
- if (actual != sp->second.csum || rand() % 5 == 0) {
+ if (actual != want || rand() % 5 == 0) {
dout(0) << "rx_finish bad csum on partial block " << pblock << dendl;
derr(0) << "rx_finish bad csum on partial block " << pblock << " ****************" << dendl;
poison_commit = true;
*sp->second.on->get_extent_csum_ptr(sp->second.oblock, 1) = actual;
sp->second.on->data_csum += actual - want;
-
interval_set<off_t> bad;
bad.insert(sp->second.oblock*EBOFS_BLOCK_SIZE, EBOFS_BLOCK_SIZE);
sp->second.on->bad_byte_extents.union_of(bad);
block_t bstart = off / EBOFS_BLOCK_SIZE;
+ // partial?
+ off_t last_block_byte = on->last_block * EBOFS_BLOCK_SIZE;
+ bool partial_head = (off & EBOFS_BLOCK_MASK) && off < last_block_byte;
+ bool partial_tail = ((off+len) & EBOFS_BLOCK_MASK) && (off+len) < on->object_size;
+
+ partial_head
+ if ((bh->start() == bstart &&
+ opos % EBOFS_BLOCK_SIZE != 0) ||
+ (bh->last() == blast &&
+ ((off_t)len+off) % EBOFS_BLOCK_SIZE != 0 &&
+ ((off_t)len+off) < on->object_size)) {
+
+
+
+ // extending object?
if (off+(off_t)len > on->object_size) {
dout(10) << "apply_write extending size on " << *on << ": " << on->object_size
<< " -> " << off+len << dendl;
block_t blen = blast-bstart+1;
block_t oldlastblock = on->last_block;
-
// map b range onto buffer_heads
map<block_t, BufferHead*> hits;
oc->map_write(bstart, blen, hits, super_epoch);