|
|
@ -207,20 +207,26 @@ void osd_messenger_t::handle_op_hdr(osd_client_t *cl) |
|
|
|
else if (cur_op->req.hdr.opcode == OSD_OP_SEC_WRITE || |
|
|
|
cur_op->req.hdr.opcode == OSD_OP_SEC_WRITE_STABLE) |
|
|
|
{ |
|
|
|
if (cur_op->req.sec_rw.attr_len > 0) |
|
|
|
if (cur_op->req.sec_rw.bitmap_len > 0) |
|
|
|
{ |
|
|
|
if (cur_op->req.sec_rw.attr_len > sizeof(unsigned)) |
|
|
|
cur_op->bitmap = cur_op->rmw_buf = malloc_or_die(cur_op->req.sec_rw.attr_len); |
|
|
|
if (cur_op->req.sec_rw.bitmap_len > sizeof(void*)) |
|
|
|
cur_op->bitmap = cur_op->rmw_buf = malloc_or_die(cur_op->req.sec_rw.bitmap_len); |
|
|
|
else |
|
|
|
cur_op->bitmap = &cur_op->bmp_data; |
|
|
|
cl->recv_list.push_back(cur_op->bitmap, cur_op->req.sec_rw.attr_len); |
|
|
|
if (cur_op->req.sec_rw.bitmap_len <= 8) |
|
|
|
memcpy(cur_op->bitmap, &cur_op->req.sec_rw.bitmap, cur_op->req.sec_rw.bitmap_len); |
|
|
|
else |
|
|
|
{ |
|
|
|
cl->recv_list.push_back(cur_op->bitmap, cur_op->req.sec_rw.bitmap_len); |
|
|
|
cl->read_remaining += cur_op->req.sec_rw.bitmap_len; |
|
|
|
} |
|
|
|
} |
|
|
|
if (cur_op->req.sec_rw.len > 0) |
|
|
|
{ |
|
|
|
cur_op->buf = memalign_or_die(MEM_ALIGNMENT, cur_op->req.sec_rw.len); |
|
|
|
cl->recv_list.push_back(cur_op->buf, cur_op->req.sec_rw.len); |
|
|
|
cl->read_remaining += cur_op->req.sec_rw.len; |
|
|
|
} |
|
|
|
cl->read_remaining = cur_op->req.sec_rw.len + cur_op->req.sec_rw.attr_len; |
|
|
|
} |
|
|
|
else if (cur_op->req.hdr.opcode == OSD_OP_SEC_STABILIZE || |
|
|
|
cur_op->req.hdr.opcode == OSD_OP_SEC_ROLLBACK) |
|
|
@ -295,7 +301,7 @@ bool osd_messenger_t::handle_reply_hdr(osd_client_t *cl) |
|
|
|
if (op->reply.hdr.opcode == OSD_OP_SEC_READ || op->reply.hdr.opcode == OSD_OP_READ) |
|
|
|
{ |
|
|
|
// Read data. In this case we assume that the buffer is preallocated by the caller (!)
|
|
|
|
unsigned bmp_len = (op->reply.hdr.opcode == OSD_OP_SEC_READ ? op->reply.sec_rw.attr_len : op->reply.rw.bitmap_len); |
|
|
|
unsigned bmp_len = (op->reply.hdr.opcode == OSD_OP_SEC_READ ? op->reply.sec_rw.bitmap_len : op->reply.rw.bitmap_len); |
|
|
|
unsigned expected_size = (op->reply.hdr.opcode == OSD_OP_SEC_READ ? op->req.sec_rw.len : op->req.rw.len); |
|
|
|
if (op->reply.hdr.retval >= 0 && (op->reply.hdr.retval != expected_size || bmp_len > op->bitmap_len)) |
|
|
|
{ |
|
|
@ -309,14 +315,24 @@ bool osd_messenger_t::handle_reply_hdr(osd_client_t *cl) |
|
|
|
if (op->reply.hdr.retval >= 0 && bmp_len > 0) |
|
|
|
{ |
|
|
|
assert(op->bitmap); |
|
|
|
cl->recv_list.push_back(op->bitmap, bmp_len); |
|
|
|
if (bmp_len <= 8) |
|
|
|
{ |
|
|
|
memcpy(op->bitmap, (op->reply.hdr.opcode == OSD_OP_SEC_READ |
|
|
|
? &op->reply.sec_rw.bitmap |
|
|
|
: &op->reply.rw.bitmap), bmp_len); |
|
|
|
} |
|
|
|
else |
|
|
|
{ |
|
|
|
cl->recv_list.push_back(op->bitmap, bmp_len); |
|
|
|
cl->read_remaining += bmp_len; |
|
|
|
} |
|
|
|
} |
|
|
|
if (op->reply.hdr.retval > 0) |
|
|
|
{ |
|
|
|
assert(op->iov.count > 0); |
|
|
|
cl->recv_list.append(op->iov); |
|
|
|
cl->read_remaining += op->reply.hdr.retval; |
|
|
|
} |
|
|
|
cl->read_remaining = op->reply.hdr.retval + bmp_len; |
|
|
|
if (cl->read_remaining == 0) |
|
|
|
{ |
|
|
|
goto reuse; |
|
|
|