Skip to content

Commit 9199c90

Browse files
stefanopanellagermanop
authored andcommitted
CA-181428: Tapdisk should remember xlvhd parameters on unpause
In case of unpause (resume) operation the -T and -q parameters are not passed and the ones from open/create should be used. This is saving in the vbd structure the xlvhd_allocation_quantum for future use during unpause. Signed-off-by: Stefano Panella <[email protected]> Reviewed-by: Germano Percossi <[email protected]>
1 parent c78798f commit 9199c90

File tree

3 files changed

+12
-4
lines changed

3 files changed

+12
-4
lines changed

drivers/tapdisk-control.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -749,8 +749,10 @@ tapdisk_control_open_image(struct tapdisk_ctl_conn *conn,
749749
goto out;
750750

751751
if (request->u.params.flags & TAPDISK_MESSAGE_FLAG_THIN) {
752+
/* Save parameters in vbd for unpause */
753+
vbd->xlvhd_alloc_quantum = request->u.params.alloc_quantum;
752754
/* Set allocation Quantum only to the leaf */
753-
tapdisk_vbd_set_quantum(vbd, request->u.params.alloc_quantum);
755+
tapdisk_vbd_set_quantum(vbd);
754756
}
755757

756758
err = tapdisk_vbd_get_disk_info(vbd, &vbd->disk_info);

drivers/tapdisk-vbd.c

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -634,9 +634,10 @@ tapdisk_vbd_open_vdi(td_vbd_t *vbd, const char *name, td_flag_t flags, int prt_d
634634
}
635635

636636
int
637-
tapdisk_vbd_set_quantum(td_vbd_t *vbd, int alloc_quantum)
637+
tapdisk_vbd_set_quantum(td_vbd_t *vbd)
638638
{
639-
return td_set_quantum(tapdisk_vbd_first_image(vbd), alloc_quantum);
639+
return td_set_quantum(tapdisk_vbd_first_image(vbd),
640+
vbd->xlvhd_alloc_quantum);
640641
}
641642

642643
void
@@ -942,6 +943,10 @@ tapdisk_vbd_resume(td_vbd_t *vbd, const char *name)
942943

943944
for (i = 0; i < TD_VBD_EIO_RETRIES; i++) {
944945
err = tapdisk_vbd_open_vdi(vbd, name, vbd->flags | TD_OPEN_STRICT, -1);
946+
if (vbd->flags & TD_OPEN_THIN) {
947+
/* Set allocation Quantum only to the leaf */
948+
tapdisk_vbd_set_quantum(vbd);
949+
}
945950
if (!err)
946951
break;
947952

drivers/tapdisk-vbd.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -147,6 +147,7 @@ struct td_vbd_handle {
147147

148148
struct td_vbd_rrd rrd;
149149
stats_t vdi_stats;
150+
int xlvhd_alloc_quantum;
150151
};
151152

152153
#define tapdisk_vbd_for_each_request(vreq, tmp, list) \
@@ -186,7 +187,7 @@ int tapdisk_vbd_close(td_vbd_t *);
186187
*/
187188
int tapdisk_vbd_open_vdi(td_vbd_t * vbd, const char *params, td_flag_t flags,
188189
int prt_devnum);
189-
int tapdisk_vbd_set_quantum(td_vbd_t *vbd, int alloc_quantum);
190+
int tapdisk_vbd_set_quantum(td_vbd_t *vbd);
190191
void tapdisk_vbd_close_vdi(td_vbd_t *);
191192

192193
int tapdisk_vbd_attach(td_vbd_t *, const char *, int);

0 commit comments

Comments
 (0)