diff options
-rw-r--r-- | drivers/scsi/sd.c | 22 | ||||
-rw-r--r-- | include/scsi/scsi_host.h | 8 |
2 files changed, 30 insertions, 0 deletions
diff --git a/drivers/scsi/sd.c b/drivers/scsi/sd.c index 829cc37abc41..8802e48bc063 100644 --- a/drivers/scsi/sd.c +++ b/drivers/scsi/sd.c | |||
@@ -97,6 +97,7 @@ MODULE_ALIAS_SCSI_DEVICE(TYPE_RBC); | |||
97 | #endif | 97 | #endif |
98 | 98 | ||
99 | static int sd_revalidate_disk(struct gendisk *); | 99 | static int sd_revalidate_disk(struct gendisk *); |
100 | static void sd_unlock_native_capacity(struct gendisk *disk); | ||
100 | static int sd_probe(struct device *); | 101 | static int sd_probe(struct device *); |
101 | static int sd_remove(struct device *); | 102 | static int sd_remove(struct device *); |
102 | static void sd_shutdown(struct device *); | 103 | static void sd_shutdown(struct device *); |
@@ -1101,6 +1102,7 @@ static const struct block_device_operations sd_fops = { | |||
1101 | #endif | 1102 | #endif |
1102 | .media_changed = sd_media_changed, | 1103 | .media_changed = sd_media_changed, |
1103 | .revalidate_disk = sd_revalidate_disk, | 1104 | .revalidate_disk = sd_revalidate_disk, |
1105 | .unlock_native_capacity = sd_unlock_native_capacity, | ||
1104 | }; | 1106 | }; |
1105 | 1107 | ||
1106 | static unsigned int sd_completed_bytes(struct scsi_cmnd *scmd) | 1108 | static unsigned int sd_completed_bytes(struct scsi_cmnd *scmd) |
@@ -2121,6 +2123,26 @@ static int sd_revalidate_disk(struct gendisk *disk) | |||
2121 | } | 2123 | } |
2122 | 2124 | ||
2123 | /** | 2125 | /** |
2126 | * sd_unlock_native_capacity - unlock native capacity | ||
2127 | * @disk: struct gendisk to set capacity for | ||
2128 | * | ||
2129 | * Block layer calls this function if it detects that partitions | ||
2130 | * on @disk reach beyond the end of the device. If the SCSI host | ||
2131 | * implements ->unlock_native_capacity() method, it's invoked to | ||
2132 | * give it a chance to adjust the device capacity. | ||
2133 | * | ||
2134 | * CONTEXT: | ||
2135 | * Defined by block layer. Might sleep. | ||
2136 | */ | ||
2137 | static void sd_unlock_native_capacity(struct gendisk *disk) | ||
2138 | { | ||
2139 | struct scsi_device *sdev = scsi_disk(disk)->device; | ||
2140 | |||
2141 | if (sdev->host->hostt->unlock_native_capacity) | ||
2142 | sdev->host->hostt->unlock_native_capacity(sdev); | ||
2143 | } | ||
2144 | |||
2145 | /** | ||
2124 | * sd_format_disk_name - format disk name | 2146 | * sd_format_disk_name - format disk name |
2125 | * @prefix: name prefix - ie. "sd" for SCSI disks | 2147 | * @prefix: name prefix - ie. "sd" for SCSI disks |
2126 | * @index: index of the disk to format name for | 2148 | * @index: index of the disk to format name for |
diff --git a/include/scsi/scsi_host.h b/include/scsi/scsi_host.h index c50a97fc76f9..b7bdecb7b76e 100644 --- a/include/scsi/scsi_host.h +++ b/include/scsi/scsi_host.h | |||
@@ -327,6 +327,14 @@ struct scsi_host_template { | |||
327 | sector_t, int []); | 327 | sector_t, int []); |
328 | 328 | ||
329 | /* | 329 | /* |
330 | * This function is called when one or more partitions on the | ||
331 | * device reach beyond the end of the device. | ||
332 | * | ||
333 | * Status: OPTIONAL | ||
334 | */ | ||
335 | void (*unlock_native_capacity)(struct scsi_device *); | ||
336 | |||
337 | /* | ||
330 | * Can be used to export driver statistics and other infos to the | 338 | * Can be used to export driver statistics and other infos to the |
331 | * world outside the kernel ie. userspace and it also provides an | 339 | * world outside the kernel ie. userspace and it also provides an |
332 | * interface to feed the driver with information. | 340 | * interface to feed the driver with information. |