[SCSI] fix our current target reap infrastructure
[cascardo/linux.git] / include / scsi / scsi_device.h
index d65fbec..ccabdc1 100644 (file)
@@ -235,12 +235,24 @@ struct scsi_dh_data {
 #define sdev_printk(prefix, sdev, fmt, a...)   \
        dev_printk(prefix, &(sdev)->sdev_gendev, fmt, ##a)
 
+#define sdev_dbg(sdev, fmt, a...) \
+       dev_dbg(&(sdev)->sdev_gendev, fmt, ##a)
+
 #define scmd_printk(prefix, scmd, fmt, a...)                           \
         (scmd)->request->rq_disk ?                                     \
        sdev_printk(prefix, (scmd)->device, "[%s] " fmt,                \
                    (scmd)->request->rq_disk->disk_name, ##a) :         \
        sdev_printk(prefix, (scmd)->device, fmt, ##a)
 
+#define scmd_dbg(scmd, fmt, a...)                                         \
+       do {                                                               \
+               if ((scmd)->request->rq_disk)                              \
+                       sdev_dbg((scmd)->device, "[%s] " fmt,              \
+                                (scmd)->request->rq_disk->disk_name, ##a);\
+               else                                                       \
+                       sdev_dbg((scmd)->device, fmt, ##a);                \
+       } while (0)
+
 enum scsi_target_state {
        STARGET_CREATED = 1,
        STARGET_RUNNING,
@@ -257,7 +269,7 @@ struct scsi_target {
        struct list_head        siblings;
        struct list_head        devices;
        struct device           dev;
-       unsigned int            reap_ref; /* protected by the host lock */
+       struct kref             reap_ref; /* last put renders target invisible */
        unsigned int            channel;
        unsigned int            id; /* target id ... replace
                                     * scsi_device.id eventually */
@@ -284,7 +296,6 @@ struct scsi_target {
 #define SCSI_DEFAULT_TARGET_BLOCKED    3
 
        char                    scsi_level;
-       struct execute_work     ew;
        enum scsi_target_state  state;
        void                    *hostdata; /* available to low-level driver */
        unsigned long           starget_data[0]; /* for the transport */