Revision 72e0996c block/sheepdog.c
b/block/sheepdog.c | ||
---|---|---|
227 | 227 |
return oid & (MAX_DATA_OBJS - 1); |
228 | 228 |
} |
229 | 229 |
|
230 |
static inline uint32_t oid_to_vid(uint64_t oid) |
|
231 |
{ |
|
232 |
return (oid & ~VDI_BIT) >> VDI_SPACE_SHIFT; |
|
233 |
} |
|
234 |
|
|
230 | 235 |
static inline uint64_t vid_to_vdi_oid(uint32_t vid) |
231 | 236 |
{ |
232 | 237 |
return VDI_BIT | ((uint64_t)vid << VDI_SPACE_SHIFT); |
... | ... | |
605 | 610 |
struct iovec *iov, int niov, bool create, |
606 | 611 |
enum AIOCBState aiocb_type); |
607 | 612 |
static int coroutine_fn resend_aioreq(BDRVSheepdogState *s, AIOReq *aio_req); |
608 |
|
|
613 |
static int reload_inode(BDRVSheepdogState *s, uint32_t snapid, const char *tag); |
|
609 | 614 |
|
610 | 615 |
static AIOReq *find_pending_req(BDRVSheepdogState *s, uint64_t oid) |
611 | 616 |
{ |
... | ... | |
753 | 758 |
case SD_RES_SUCCESS: |
754 | 759 |
break; |
755 | 760 |
case SD_RES_READONLY: |
761 |
if (s->inode.vdi_id == oid_to_vid(aio_req->oid)) { |
|
762 |
ret = reload_inode(s, 0, ""); |
|
763 |
if (ret < 0) { |
|
764 |
goto out; |
|
765 |
} |
|
766 |
} |
|
767 |
|
|
768 |
if (is_data_obj(aio_req->oid)) { |
|
769 |
aio_req->oid = vid_to_data_oid(s->inode.vdi_id, |
|
770 |
data_oid_to_idx(aio_req->oid)); |
|
771 |
} else { |
|
772 |
aio_req->oid = vid_to_vdi_oid(s->inode.vdi_id); |
|
773 |
} |
|
756 | 774 |
ret = resend_aioreq(s, aio_req); |
757 | 775 |
if (ret == SD_RES_SUCCESS) { |
758 | 776 |
goto out; |
... | ... | |
1190 | 1208 |
{ |
1191 | 1209 |
SheepdogAIOCB *acb = aio_req->aiocb; |
1192 | 1210 |
bool create = false; |
1193 |
int ret; |
|
1194 |
|
|
1195 |
ret = reload_inode(s, 0, ""); |
|
1196 |
if (ret < 0) { |
|
1197 |
return ret; |
|
1198 |
} |
|
1199 |
|
|
1200 |
if (is_data_obj(aio_req->oid)) { |
|
1201 |
aio_req->oid = vid_to_data_oid(s->inode.vdi_id, |
|
1202 |
data_oid_to_idx(aio_req->oid)); |
|
1203 |
} else { |
|
1204 |
aio_req->oid = vid_to_vdi_oid(s->inode.vdi_id); |
|
1205 |
} |
|
1206 | 1211 |
|
1207 | 1212 |
/* check whether this request becomes a CoW one */ |
1208 | 1213 |
if (acb->aiocb_type == AIOCB_WRITE_UDATA && is_data_obj(aio_req->oid)) { |
Also available in: Unified diff