Re: [Qemu-devel] [PATCH 2/3] scsi: Introduce scsi_req_cancel_async

2014-09-18 Thread Paolo Bonzini
Il 18/09/2014 04:36, Fam Zheng ha scritto: > @@ -552,7 +552,7 @@ SCSIRequest *scsi_req_alloc(const SCSIReqOps *reqops, > SCSIDevice *d, > SCSIBus *bus = scsi_bus_from_device(d); > BusState *qbus = BUS(bus); > > -req = g_malloc0(reqops->size); > +req = g_malloc0(reqops ? reqops-

Re: [Qemu-devel] [PATCH 2/3] scsi: Introduce scsi_req_cancel_async

2014-09-18 Thread Paolo Bonzini
Il 18/09/2014 04:36, Fam Zheng ha scritto: > +QTAILQ_FOREACH_SAFE(ref, &req->cancel_deps, next, next) { > +SCSIRequest *r = ref->req; > +assert(r->cancel_dep_count); > +r->cancel_dep_count--; > +if (!r->cancel_dep_count && req->bus->info->cancel_dep_complete) { >

[Qemu-devel] [PATCH 2/3] scsi: Introduce scsi_req_cancel_async

2014-09-17 Thread Fam Zheng
Devices can call this function to start an asynchronous cancellation. The bus->info->cancel will be called later. Two fields are added to SCSIRequest to respectively keep track of: 1) The list of (TMF) requests that are waiting for this request to be canceled. 2) The number of (IO) request