Re: [PATCH 07/14] sd: make use of ->free_disk to simplify refcounting

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 3/4/22 08:03, Christoph Hellwig wrote:
  error_out:
-	scsi_disk_put(sdkp);
+	scsi_device_put(sdkp->device);
  	return retval;	
  }

Hmm ... why is the above scsi_device_put() call passed sdkp->device? Wouldn't it be more symmetric to pass 'sdev' to that function?

@@ -1502,7 +1468,7 @@ static void sd_release(struct gendisk *disk, fmode_t mode)
  			scsi_set_medium_removal(sdev, SCSI_REMOVAL_ALLOW);
  	}
- scsi_disk_put(sdkp);
+	scsi_device_put(sdkp->device);
  }

Same question here - why to pass sdkp->device instead of sdev?

+static void scsi_disk_free_disk(struct gendisk *disk)
+{
+	struct scsi_disk *sdkp = disk->private_data;
+
+	put_device(&sdkp->disk_dev);
+}

Can the body of the above function be written as put_device(&scsi_disk(disk)->disk_dev) ? I'm asking this because other parts of this patch use scsi_disk() instead of using disk->private_data directly.

Thanks,

Bart.



[Index of Archives]     [Linux RAID]     [Linux SCSI]     [Linux ATA RAID]     [IDE]     [Linux Wireless]     [Linux Kernel]     [ATH6KL]     [Linux Bluetooth]     [Linux Netdev]     [Kernel Newbies]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Device Mapper]

  Powered by Linux