virtio-scsi: redo allocation of target data
authorWanlong Gao <gaowanlong@cn.fujitsu.com>
Mon, 8 Apr 2013 13:31:16 +0000 (23:01 +0930)
committerRusty Russell <rusty@rustcorp.com.au>
Mon, 8 Apr 2013 13:36:47 +0000 (23:06 +0930)
commit5c370194df9a97248ca69e05bfbd2d21b4886fe5
tree068f626733a03d5100f6c32a7a8bf44bd23b109a
parent3826835ab8bb7eac47f14f279df2bd58ec2bb279
virtio-scsi: redo allocation of target data

virtio_scsi_target_state is now empty.  We will find new uses for it in
the next few patches, so this patch does not drop it completely.

And as James suggested, we use entries target_alloc and target_destroy
in the host template to allocate and destroy the virtio_scsi_target_state
of each target, attach this struct to scsi_target->hostdata. Now
we can get at it from the sdev with scsi_target(sdev)->hostdata.
No messing around with fixed size arrays and bulk memory allocation
and no need to pass in the maximum target size as a parameter because
everything should now happen dynamically.

Cc: James Bottomley <James.Bottomley@HansenPartnership.com>
Cc: linux-scsi@vger.kernel.org
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Wanlong Gao <gaowanlong@cn.fujitsu.com>
Reviewed-by: Asias He <asias@redhat.com>
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
drivers/scsi/virtio_scsi.c