Update HPA workarounds to upstream (soon?) version
svn path=/dists/trunk/linux-2.6/; revision=15736
This commit is contained in:
parent
740f50083f
commit
215b9f81bd
|
@ -1,95 +0,0 @@
|
|||
From: Tejun Heo <tj@kernel.org>
|
||||
To: jeff@garzik.org, linux-ide@vger.kernel.org, jens.axboe@oracle.com, linux-scsi@vger.kernel.org, James.Bottomley@suse.de, linux-kernel@vger.kernel.org
|
||||
Cc: ben@decadent.org.uk, Tejun Heo <tj@kernel.org>
|
||||
Date: Thu, 13 May 2010 17:56:44 +0200
|
||||
Subject: [PATCH 2/4] SCSI: implement sd_set_capacity()
|
||||
|
||||
Implement sd_set_capacity() method which calls into
|
||||
hostt->set_capacity() if implemented. This will be invoked by block
|
||||
layer if partitions extend beyond the end of the device and can be
|
||||
used to implement, for example, on-demand ATA host protected area
|
||||
unlocking.
|
||||
|
||||
Signed-off-by: Tejun Heo <tj@kernel.org>
|
||||
Cc: Ben Hutchings <ben@decadent.org.uk>
|
||||
---
|
||||
drivers/scsi/sd.c | 26 ++++++++++++++++++++++++++
|
||||
include/scsi/scsi_host.h | 11 +++++++++++
|
||||
2 files changed, 37 insertions(+), 0 deletions(-)
|
||||
|
||||
diff --git a/drivers/scsi/sd.c b/drivers/scsi/sd.c
|
||||
index 8b827f3..59d5e8f 100644
|
||||
--- a/drivers/scsi/sd.c
|
||||
+++ b/drivers/scsi/sd.c
|
||||
@@ -97,6 +97,8 @@ MODULE_ALIAS_SCSI_DEVICE(TYPE_RBC);
|
||||
#endif
|
||||
|
||||
static int sd_revalidate_disk(struct gendisk *);
|
||||
+static unsigned long long sd_set_capacity(struct gendisk *disk,
|
||||
+ unsigned long long new_capacity);
|
||||
static int sd_probe(struct device *);
|
||||
static int sd_remove(struct device *);
|
||||
static void sd_shutdown(struct device *);
|
||||
@@ -1100,6 +1102,7 @@ static const struct block_device_operations sd_fops = {
|
||||
#endif
|
||||
.media_changed = sd_media_changed,
|
||||
.revalidate_disk = sd_revalidate_disk,
|
||||
+ .set_capacity = sd_set_capacity,
|
||||
};
|
||||
|
||||
static unsigned int sd_completed_bytes(struct scsi_cmnd *scmd)
|
||||
@@ -2101,6 +2104,29 @@ static int sd_revalidate_disk(struct gendisk *disk)
|
||||
}
|
||||
|
||||
/**
|
||||
+ * sd_set_capacity - set disk capacity
|
||||
+ * @disk: struct gendisk to set capacity for
|
||||
+ * @new_capacity: new target capacity
|
||||
+ *
|
||||
+ * Block layer calls this function if it detects that partitions
|
||||
+ * on @disk reach beyond the end of the device. If the SCSI host
|
||||
+ * implements set_capacity method, it's invoked to give it a
|
||||
+ * chance to adjust the device capacity.
|
||||
+ *
|
||||
+ * CONTEXT:
|
||||
+ * Defined by block layer. Might sleep.
|
||||
+ */
|
||||
+static unsigned long long sd_set_capacity(struct gendisk *disk,
|
||||
+ unsigned long long new_capacity)
|
||||
+{
|
||||
+ struct scsi_device *sdev = scsi_disk(disk)->device;
|
||||
+
|
||||
+ if (sdev->host->hostt->set_capacity)
|
||||
+ return sdev->host->hostt->set_capacity(sdev, new_capacity);
|
||||
+ return 0;
|
||||
+}
|
||||
+
|
||||
+/**
|
||||
* sd_format_disk_name - format disk name
|
||||
* @prefix: name prefix - ie. "sd" for SCSI disks
|
||||
* @index: index of the disk to format name for
|
||||
diff --git a/include/scsi/scsi_host.h b/include/scsi/scsi_host.h
|
||||
index c50a97f..31dba89 100644
|
||||
--- a/include/scsi/scsi_host.h
|
||||
+++ b/include/scsi/scsi_host.h
|
||||
@@ -327,6 +327,17 @@ struct scsi_host_template {
|
||||
sector_t, int []);
|
||||
|
||||
/*
|
||||
+ * This function is called when one or more partitions on the
|
||||
+ * device reach beyond the end of the device. This function
|
||||
+ * should return the new capacity if disk was successfully
|
||||
+ * enlarged. Return values smaller than the current capacity
|
||||
+ * are ignored.
|
||||
+ *
|
||||
+ * Status: OPTIONAL
|
||||
+ */
|
||||
+ sector_t (*set_capacity)(struct scsi_device *, sector_t);
|
||||
+
|
||||
+ /*
|
||||
* Can be used to export driver statistics and other infos to the
|
||||
* world outside the kernel ie. userspace and it also provides an
|
||||
* interface to feed the driver with information.
|
||||
--
|
||||
1.6.4.2
|
||||
|
|
@ -0,0 +1,87 @@
|
|||
From 91b792b2fc34cc29fc9f0ba2fd5d7251ff04a8df Mon Sep 17 00:00:00 2001
|
||||
From: Tejun Heo <tj@kernel.org>
|
||||
Date: Sat, 15 May 2010 19:55:32 +0200
|
||||
Subject: [PATCH 6/8] SCSI: implement sd_unlock_native_capacity()
|
||||
|
||||
Implement sd_unlock_native_capacity() method which calls into
|
||||
hostt->unlock_native_capacity() if implemented. This will be invoked
|
||||
by block layer if partitions extend beyond the end of the device and
|
||||
can be used to implement, for example, on-demand ATA host protected
|
||||
area unlocking.
|
||||
|
||||
Signed-off-by: Tejun Heo <tj@kernel.org>
|
||||
Cc: Ben Hutchings <ben@decadent.org.uk>
|
||||
---
|
||||
drivers/scsi/sd.c | 22 ++++++++++++++++++++++
|
||||
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 8b827f3..b85906e 100644
|
||||
--- a/drivers/scsi/sd.c
|
||||
+++ b/drivers/scsi/sd.c
|
||||
@@ -97,6 +97,7 @@ MODULE_ALIAS_SCSI_DEVICE(TYPE_RBC);
|
||||
#endif
|
||||
|
||||
static int sd_revalidate_disk(struct gendisk *);
|
||||
+static void sd_unlock_native_capacity(struct gendisk *disk);
|
||||
static int sd_probe(struct device *);
|
||||
static int sd_remove(struct device *);
|
||||
static void sd_shutdown(struct device *);
|
||||
@@ -1100,6 +1101,7 @@ static const struct block_device_operations sd_fops = {
|
||||
#endif
|
||||
.media_changed = sd_media_changed,
|
||||
.revalidate_disk = sd_revalidate_disk,
|
||||
+ .unlock_native_capacity = sd_unlock_native_capacity,
|
||||
};
|
||||
|
||||
static unsigned int sd_completed_bytes(struct scsi_cmnd *scmd)
|
||||
@@ -2101,6 +2103,26 @@ static int sd_revalidate_disk(struct gendisk *disk)
|
||||
}
|
||||
|
||||
/**
|
||||
+ * sd_unlock_native_capacity - unlock native capacity
|
||||
+ * @disk: struct gendisk to set capacity for
|
||||
+ *
|
||||
+ * Block layer calls this function if it detects that partitions
|
||||
+ * on @disk reach beyond the end of the device. If the SCSI host
|
||||
+ * implements ->unlock_native_capacity() method, it's invoked to
|
||||
+ * give it a chance to adjust the device capacity.
|
||||
+ *
|
||||
+ * CONTEXT:
|
||||
+ * Defined by block layer. Might sleep.
|
||||
+ */
|
||||
+static void sd_unlock_native_capacity(struct gendisk *disk)
|
||||
+{
|
||||
+ struct scsi_device *sdev = scsi_disk(disk)->device;
|
||||
+
|
||||
+ if (sdev->host->hostt->unlock_native_capacity)
|
||||
+ sdev->host->hostt->unlock_native_capacity(sdev);
|
||||
+}
|
||||
+
|
||||
+/**
|
||||
* sd_format_disk_name - format disk name
|
||||
* @prefix: name prefix - ie. "sd" for SCSI disks
|
||||
* @index: index of the disk to format name for
|
||||
diff --git a/include/scsi/scsi_host.h b/include/scsi/scsi_host.h
|
||||
index c50a97f..b7bdecb 100644
|
||||
--- a/include/scsi/scsi_host.h
|
||||
+++ b/include/scsi/scsi_host.h
|
||||
@@ -327,6 +327,14 @@ struct scsi_host_template {
|
||||
sector_t, int []);
|
||||
|
||||
/*
|
||||
+ * This function is called when one or more partitions on the
|
||||
+ * device reach beyond the end of the device.
|
||||
+ *
|
||||
+ * Status: OPTIONAL
|
||||
+ */
|
||||
+ void (*unlock_native_capacity)(struct scsi_device *);
|
||||
+
|
||||
+ /*
|
||||
* Can be used to export driver statistics and other infos to the
|
||||
* world outside the kernel ie. userspace and it also provides an
|
||||
* interface to feed the driver with information.
|
||||
--
|
||||
1.7.1
|
||||
|
178
debian/patches/bugfix/all/block-ide-simplify-bdops-set_capacity-to-unlock_native_capacity.patch
vendored
Normal file
178
debian/patches/bugfix/all/block-ide-simplify-bdops-set_capacity-to-unlock_native_capacity.patch
vendored
Normal file
|
@ -0,0 +1,178 @@
|
|||
From 1eebd584b590399138f9b0d99d0a8a8537cf9715 Mon Sep 17 00:00:00 2001
|
||||
From: Tejun Heo <tj@kernel.org>
|
||||
Date: Sat, 15 May 2010 19:55:31 +0200
|
||||
Subject: [PATCH 3/8] block,ide: simplify bdops->set_capacity() to ->unlock_native_capacity()
|
||||
|
||||
bdops->set_capacity() is unnecessarily generic. All that's required
|
||||
is a simple one way notification to lower level driver telling it to
|
||||
try to unlock native capacity. There's no reason to pass in target
|
||||
capacity or return the new capacity. The former is always the
|
||||
inherent native capacity and the latter can be handled via the usual
|
||||
device resize / revalidation path. In fact, the current API is always
|
||||
used that way.
|
||||
|
||||
Replace ->set_capacity() with ->unlock_native_capacity() which take
|
||||
only @disk and doesn't return anything. IDE which is the only current
|
||||
user of the API is converted accordingly.
|
||||
|
||||
Signed-off-by: Tejun Heo <tj@kernel.org>
|
||||
Cc: Ben Hutchings <ben@decadent.org.uk>
|
||||
Cc: Jens Axboe <jens.axboe@oracle.com>
|
||||
Cc: David Miller <davem@davemloft.net>
|
||||
Cc: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
|
||||
---
|
||||
drivers/ide/ide-disk.c | 40 ++++++++++++++++------------------------
|
||||
drivers/ide/ide-gd.c | 11 ++++-------
|
||||
fs/partitions/check.c | 4 ++--
|
||||
include/linux/blkdev.h | 3 +--
|
||||
include/linux/ide.h | 2 +-
|
||||
5 files changed, 24 insertions(+), 36 deletions(-)
|
||||
|
||||
diff --git a/drivers/ide/ide-disk.c b/drivers/ide/ide-disk.c
|
||||
index 3b128dc..33d6503 100644
|
||||
--- a/drivers/ide/ide-disk.c
|
||||
+++ b/drivers/ide/ide-disk.c
|
||||
@@ -407,32 +407,24 @@ static int ide_disk_get_capacity(ide_drive_t *drive)
|
||||
return 0;
|
||||
}
|
||||
|
||||
-static u64 ide_disk_set_capacity(ide_drive_t *drive, u64 capacity)
|
||||
+static void ide_disk_unlock_native_capacity(ide_drive_t *drive)
|
||||
{
|
||||
- u64 set = min(capacity, drive->probed_capacity);
|
||||
u16 *id = drive->id;
|
||||
int lba48 = ata_id_lba48_enabled(id);
|
||||
|
||||
if ((drive->dev_flags & IDE_DFLAG_LBA) == 0 ||
|
||||
ata_id_hpa_enabled(id) == 0)
|
||||
- goto out;
|
||||
+ return;
|
||||
|
||||
/*
|
||||
* according to the spec the SET MAX ADDRESS command shall be
|
||||
* immediately preceded by a READ NATIVE MAX ADDRESS command
|
||||
*/
|
||||
- capacity = ide_disk_hpa_get_native_capacity(drive, lba48);
|
||||
- if (capacity == 0)
|
||||
- goto out;
|
||||
-
|
||||
- set = ide_disk_hpa_set_capacity(drive, set, lba48);
|
||||
- if (set) {
|
||||
- /* needed for ->resume to disable HPA */
|
||||
- drive->dev_flags |= IDE_DFLAG_NOHPA;
|
||||
- return set;
|
||||
- }
|
||||
-out:
|
||||
- return drive->capacity64;
|
||||
+ if (!ide_disk_hpa_get_native_capacity(drive, lba48))
|
||||
+ return;
|
||||
+
|
||||
+ if (ide_disk_hpa_set_capacity(drive, drive->probed_capacity, lba48))
|
||||
+ drive->dev_flags |= IDE_DFLAG_NOHPA; /* disable HPA on resume */
|
||||
}
|
||||
|
||||
static void idedisk_prepare_flush(struct request_queue *q, struct request *rq)
|
||||
@@ -783,13 +775,13 @@ static int ide_disk_set_doorlock(ide_drive_t *drive, struct gendisk *disk,
|
||||
}
|
||||
|
||||
const struct ide_disk_ops ide_ata_disk_ops = {
|
||||
- .check = ide_disk_check,
|
||||
- .set_capacity = ide_disk_set_capacity,
|
||||
- .get_capacity = ide_disk_get_capacity,
|
||||
- .setup = ide_disk_setup,
|
||||
- .flush = ide_disk_flush,
|
||||
- .init_media = ide_disk_init_media,
|
||||
- .set_doorlock = ide_disk_set_doorlock,
|
||||
- .do_request = ide_do_rw_disk,
|
||||
- .ioctl = ide_disk_ioctl,
|
||||
+ .check = ide_disk_check,
|
||||
+ .unlock_native_capacity = ide_disk_unlock_native_capacity,
|
||||
+ .get_capacity = ide_disk_get_capacity,
|
||||
+ .setup = ide_disk_setup,
|
||||
+ .flush = ide_disk_flush,
|
||||
+ .init_media = ide_disk_init_media,
|
||||
+ .set_doorlock = ide_disk_set_doorlock,
|
||||
+ .do_request = ide_do_rw_disk,
|
||||
+ .ioctl = ide_disk_ioctl,
|
||||
};
|
||||
diff --git a/drivers/ide/ide-gd.c b/drivers/ide/ide-gd.c
|
||||
index c32d839..c102d23 100644
|
||||
--- a/drivers/ide/ide-gd.c
|
||||
+++ b/drivers/ide/ide-gd.c
|
||||
@@ -288,17 +288,14 @@ static int ide_gd_media_changed(struct gendisk *disk)
|
||||
return ret;
|
||||
}
|
||||
|
||||
-static unsigned long long ide_gd_set_capacity(struct gendisk *disk,
|
||||
- unsigned long long capacity)
|
||||
+static void ide_gd_unlock_native_capacity(struct gendisk *disk)
|
||||
{
|
||||
struct ide_disk_obj *idkp = ide_drv_g(disk, ide_disk_obj);
|
||||
ide_drive_t *drive = idkp->drive;
|
||||
const struct ide_disk_ops *disk_ops = drive->disk_ops;
|
||||
|
||||
- if (disk_ops->set_capacity)
|
||||
- return disk_ops->set_capacity(drive, capacity);
|
||||
-
|
||||
- return drive->capacity64;
|
||||
+ if (disk_ops->unlock_native_capacity)
|
||||
+ disk_ops->unlock_native_capacity(drive);
|
||||
}
|
||||
|
||||
static int ide_gd_revalidate_disk(struct gendisk *disk)
|
||||
@@ -329,7 +326,7 @@ static const struct block_device_operations ide_gd_ops = {
|
||||
.locked_ioctl = ide_gd_ioctl,
|
||||
.getgeo = ide_gd_getgeo,
|
||||
.media_changed = ide_gd_media_changed,
|
||||
- .set_capacity = ide_gd_set_capacity,
|
||||
+ .unlock_native_capacity = ide_gd_unlock_native_capacity,
|
||||
.revalidate_disk = ide_gd_revalidate_disk
|
||||
};
|
||||
|
||||
diff --git a/fs/partitions/check.c b/fs/partitions/check.c
|
||||
index 8f01df3..4f1fee0 100644
|
||||
--- a/fs/partitions/check.c
|
||||
+++ b/fs/partitions/check.c
|
||||
@@ -601,10 +601,10 @@ rescan:
|
||||
"%s: p%d size %llu exceeds device capacity, ",
|
||||
disk->disk_name, p, (unsigned long long) size);
|
||||
|
||||
- if (bdops->set_capacity &&
|
||||
+ if (bdops->unlock_native_capacity &&
|
||||
(disk->flags & GENHD_FL_NATIVE_CAPACITY) == 0) {
|
||||
printk(KERN_CONT "enabling native capacity\n");
|
||||
- bdops->set_capacity(disk, ~0ULL);
|
||||
+ bdops->unlock_native_capacity(disk);
|
||||
disk->flags |= GENHD_FL_NATIVE_CAPACITY;
|
||||
/* free state and restart */
|
||||
kfree(state);
|
||||
diff --git a/include/linux/blkdev.h b/include/linux/blkdev.h
|
||||
index 6690e8b..f2a0c33 100644
|
||||
--- a/include/linux/blkdev.h
|
||||
+++ b/include/linux/blkdev.h
|
||||
@@ -1283,8 +1283,7 @@ struct block_device_operations {
|
||||
int (*direct_access) (struct block_device *, sector_t,
|
||||
void **, unsigned long *);
|
||||
int (*media_changed) (struct gendisk *);
|
||||
- unsigned long long (*set_capacity) (struct gendisk *,
|
||||
- unsigned long long);
|
||||
+ void (*unlock_native_capacity) (struct gendisk *);
|
||||
int (*revalidate_disk) (struct gendisk *);
|
||||
int (*getgeo)(struct block_device *, struct hd_geometry *);
|
||||
struct module *owner;
|
||||
diff --git a/include/linux/ide.h b/include/linux/ide.h
|
||||
index 3239d1c..b6d4480 100644
|
||||
--- a/include/linux/ide.h
|
||||
+++ b/include/linux/ide.h
|
||||
@@ -362,7 +362,7 @@ struct ide_drive_s;
|
||||
struct ide_disk_ops {
|
||||
int (*check)(struct ide_drive_s *, const char *);
|
||||
int (*get_capacity)(struct ide_drive_s *);
|
||||
- u64 (*set_capacity)(struct ide_drive_s *, u64);
|
||||
+ void (*unlock_native_capacity)(struct ide_drive_s *);
|
||||
void (*setup)(struct ide_drive_s *);
|
||||
void (*flush)(struct ide_drive_s *);
|
||||
int (*init_media)(struct ide_drive_s *, struct gendisk *);
|
||||
--
|
||||
1.7.1
|
||||
|
|
@ -1,7 +1,6 @@
|
|||
From 866c02ef409514de12a6e136614e9c8db5d36c06 Mon Sep 17 00:00:00 2001
|
||||
From: Tejun Heo <tj@kernel.org>
|
||||
To: jeff@garzik.org, linux-ide@vger.kernel.org, jens.axboe@oracle.com, linux-scsi@vger.kernel.org, James.Bottomley@suse.de, linux-kernel@vger.kernel.org, ben@decadent.org.uk, davem@davemloft.net, bzolnier@gmail.com
|
||||
Cc: Tejun Heo <tj@kernel.org>
|
||||
Date: Sat, 15 May 2010 20:09:28 +0200
|
||||
Date: Sat, 15 May 2010 19:55:31 +0200
|
||||
Subject: [PATCH 2/8] block: restart partition scan after resizing a device
|
||||
|
||||
Device resize via ->set_capacity() can reveal new partitions (e.g. in
|
||||
|
@ -67,5 +66,5 @@ index e238ab2..8f01df3 100644
|
|||
/*
|
||||
* we can not ignore partitions of broken tables
|
||||
--
|
||||
1.6.4.2
|
||||
1.7.1
|
||||
|
||||
|
|
|
@ -1,9 +1,7 @@
|
|||
From 36051e2a8f14a1d44ae0801100448013ae8d9fc1 Mon Sep 17 00:00:00 2001
|
||||
From: Tejun Heo <tj@kernel.org>
|
||||
To: jeff@garzik.org, linux-ide@vger.kernel.org, jens.axboe@oracle.com, linux-scsi@vger.kernel.org, James.Bottomley@suse.de, linux-kernel@vger.kernel.org, ben@decadent.org.uk, davem@davemloft.net, bzolnier@gmail.com
|
||||
Cc: Tejun Heo <tj@kernel.org>
|
||||
Date: Sat, 15 May 2010 20:09:27 +0200
|
||||
Subject: [PATCH 1/8] buffer: make invalidate_bdev() drain all percpu LRU
|
||||
add caches
|
||||
Date: Sat, 15 May 2010 19:55:31 +0200
|
||||
Subject: [PATCH 1/8] buffer: make invalidate_bdev() drain all percpu LRU add caches
|
||||
|
||||
invalidate_bdev() should release all page cache pages which are clean
|
||||
and not being used; however, if some pages are still in the percpu LRU
|
||||
|
@ -34,5 +32,5 @@ index c9c266d..08e422d 100644
|
|||
}
|
||||
EXPORT_SYMBOL(invalidate_bdev);
|
||||
--
|
||||
1.6.4.2
|
||||
1.7.1
|
||||
|
||||
|
|
|
@ -1,14 +1,12 @@
|
|||
From 79db09cf5ab4099062f2ed19a863db487ef4bf9c Mon Sep 17 00:00:00 2001
|
||||
From: Tejun Heo <tj@kernel.org>
|
||||
To: jeff@garzik.org, linux-ide@vger.kernel.org, jens.axboe@oracle.com, linux-scsi@vger.kernel.org, James.Bottomley@suse.de, linux-kernel@vger.kernel.org
|
||||
Cc: ben@decadent.org.uk, Tejun Heo <tj@kernel.org>
|
||||
Date: Thu, 13 May 2010 17:56:46 +0200
|
||||
Subject: [PATCH 4/4] libata: implement on-demand HPA unlocking
|
||||
Date: Sat, 15 May 2010 19:55:32 +0200
|
||||
Subject: [PATCH 8/8] libata: implement on-demand HPA unlocking
|
||||
|
||||
Implement ata_scsi_set_capacity() which will be called through SCSI
|
||||
layer when block layer notices that partitions on a device extend
|
||||
beyond the end of the device. ata_scsi_set_capacity() requests EH to
|
||||
unlock HPA, waits for completion and returns the current device
|
||||
capacity.
|
||||
Implement ata_scsi_unlock_native_capacity() which will be called
|
||||
through SCSI layer when block layer notices that partitions on a
|
||||
device extend beyond the end of the device. It requests EH to unlock
|
||||
HPA, waits for completion and returns the current device capacity.
|
||||
|
||||
This allows libata to unlock HPA on demand instead of having to decide
|
||||
whether to unlock upfront. Unlocking on demand is safer than
|
||||
|
@ -19,69 +17,56 @@ Signed-off-by: Tejun Heo <tj@kernel.org>
|
|||
Suggested-by: Ben Hutchings <ben@decadent.org.uk>
|
||||
---
|
||||
drivers/ata/libata-core.c | 1 +
|
||||
drivers/ata/libata-scsi.c | 42 ++++++++++++++++++++++++++++++++++++++++++
|
||||
include/linux/libata.h | 3 +++
|
||||
3 files changed, 46 insertions(+), 0 deletions(-)
|
||||
drivers/ata/libata-scsi.c | 29 +++++++++++++++++++++++++++++
|
||||
include/linux/libata.h | 2 ++
|
||||
3 files changed, 32 insertions(+), 0 deletions(-)
|
||||
|
||||
diff --git a/drivers/ata/libata-core.c b/drivers/ata/libata-core.c
|
||||
index 9d6e92d..56badb4 100644
|
||||
index 9d6e92d..b0e379d 100644
|
||||
--- a/drivers/ata/libata-core.c
|
||||
+++ b/drivers/ata/libata-core.c
|
||||
@@ -6797,6 +6797,7 @@ EXPORT_SYMBOL_GPL(ata_dummy_port_info);
|
||||
EXPORT_SYMBOL_GPL(ata_link_next);
|
||||
EXPORT_SYMBOL_GPL(ata_dev_next);
|
||||
EXPORT_SYMBOL_GPL(ata_std_bios_param);
|
||||
+EXPORT_SYMBOL_GPL(ata_scsi_set_capacity);
|
||||
+EXPORT_SYMBOL_GPL(ata_scsi_unlock_native_capacity);
|
||||
EXPORT_SYMBOL_GPL(ata_host_init);
|
||||
EXPORT_SYMBOL_GPL(ata_host_alloc);
|
||||
EXPORT_SYMBOL_GPL(ata_host_alloc_pinfo);
|
||||
diff --git a/drivers/ata/libata-scsi.c b/drivers/ata/libata-scsi.c
|
||||
index 0088cde..2523943 100644
|
||||
index 0088cde..fc51531 100644
|
||||
--- a/drivers/ata/libata-scsi.c
|
||||
+++ b/drivers/ata/libata-scsi.c
|
||||
@@ -415,6 +415,48 @@ int ata_std_bios_param(struct scsi_device *sdev, struct block_device *bdev,
|
||||
@@ -415,6 +415,35 @@ int ata_std_bios_param(struct scsi_device *sdev, struct block_device *bdev,
|
||||
}
|
||||
|
||||
/**
|
||||
+ * ata_scsi_set_capacity - adjust device capacity
|
||||
+ * ata_scsi_unlock_native_capacity - unlock native capacity
|
||||
+ * @sdev: SCSI device to adjust device capacity for
|
||||
+ * @new_capacity: new target capacity
|
||||
+ *
|
||||
+ * This function is called if a partition on @sdev extends beyond
|
||||
+ * the end of the device. It requests EH to unlock HPA and
|
||||
+ * returns the possibly adjusted capacity.
|
||||
+ * the end of the device. It requests EH to unlock HPA.
|
||||
+ *
|
||||
+ * LOCKING:
|
||||
+ * Defined by the SCSI layer. Might sleep.
|
||||
+ *
|
||||
+ * RETURNS:
|
||||
+ * New capacity if adjusted successfully. 0 if device is not
|
||||
+ * found.
|
||||
+ */
|
||||
+sector_t ata_scsi_set_capacity(struct scsi_device *sdev, sector_t new_capacity)
|
||||
+void ata_scsi_unlock_native_capacity(struct scsi_device *sdev)
|
||||
+{
|
||||
+ struct ata_port *ap = ata_shost_to_port(sdev->host);
|
||||
+ sector_t capacity = 0;
|
||||
+ struct ata_device *dev;
|
||||
+ unsigned long flags;
|
||||
+
|
||||
+ spin_lock_irqsave(ap->lock, flags);
|
||||
+
|
||||
+ dev = ata_scsi_find_dev(ap, sdev);
|
||||
+ if (dev && dev->n_sectors < new_capacity &&
|
||||
+ dev->n_sectors < dev->n_native_sectors) {
|
||||
+ struct ata_eh_info *ehi = &dev->link->eh_info;
|
||||
+
|
||||
+ if (dev && dev->n_sectors < dev->n_native_sectors) {
|
||||
+ dev->flags |= ATA_DFLAG_UNLOCK_HPA;
|
||||
+ ehi->action |= ATA_EH_RESET;
|
||||
+ dev->link->eh_info.action |= ATA_EH_RESET;
|
||||
+ ata_port_schedule_eh(ap);
|
||||
+ spin_unlock_irqrestore(ap->lock, flags);
|
||||
+ ata_port_wait_eh(ap);
|
||||
+ capacity = dev->n_sectors;
|
||||
+ } else
|
||||
+ spin_unlock_irqrestore(ap->lock, flags);
|
||||
+ }
|
||||
+
|
||||
+ return capacity;
|
||||
+ spin_unlock_irqrestore(ap->lock, flags);
|
||||
+ ata_port_wait_eh(ap);
|
||||
+}
|
||||
+
|
||||
+/**
|
||||
|
@ -89,26 +74,25 @@ index 0088cde..2523943 100644
|
|||
* @ap: target port
|
||||
* @sdev: SCSI device to get identify data for
|
||||
diff --git a/include/linux/libata.h b/include/linux/libata.h
|
||||
index 242eb26..1082956 100644
|
||||
index 242eb26..ab7d6de 100644
|
||||
--- a/include/linux/libata.h
|
||||
+++ b/include/linux/libata.h
|
||||
@@ -1027,6 +1027,8 @@ extern void ata_scsi_simulate(struct ata_device *dev, struct scsi_cmnd *cmd,
|
||||
@@ -1027,6 +1027,7 @@ extern void ata_scsi_simulate(struct ata_device *dev, struct scsi_cmnd *cmd,
|
||||
extern int ata_std_bios_param(struct scsi_device *sdev,
|
||||
struct block_device *bdev,
|
||||
sector_t capacity, int geom[]);
|
||||
+extern sector_t ata_scsi_set_capacity(struct scsi_device *sdev,
|
||||
+ sector_t new_capacity);
|
||||
+extern void ata_scsi_unlock_native_capacity(struct scsi_device *sdev);
|
||||
extern int ata_scsi_slave_config(struct scsi_device *sdev);
|
||||
extern void ata_scsi_slave_destroy(struct scsi_device *sdev);
|
||||
extern int ata_scsi_change_queue_depth(struct scsi_device *sdev,
|
||||
@@ -1181,6 +1183,7 @@ extern struct device_attribute *ata_common_sdev_attrs[];
|
||||
@@ -1181,6 +1182,7 @@ extern struct device_attribute *ata_common_sdev_attrs[];
|
||||
.slave_configure = ata_scsi_slave_config, \
|
||||
.slave_destroy = ata_scsi_slave_destroy, \
|
||||
.bios_param = ata_std_bios_param, \
|
||||
+ .set_capacity = ata_scsi_set_capacity, \
|
||||
+ .unlock_native_capacity = ata_scsi_unlock_native_capacity, \
|
||||
.sdev_attrs = ata_common_sdev_attrs
|
||||
|
||||
#define ATA_NCQ_SHT(drv_name) \
|
||||
--
|
||||
1.6.4.2
|
||||
1.7.1
|
||||
|
||||
|
|
|
@ -1,8 +1,7 @@
|
|||
From e13b2d1562dcb843852e677a1cb599b94f023604 Mon Sep 17 00:00:00 2001
|
||||
From: Tejun Heo <tj@kernel.org>
|
||||
To: jeff@garzik.org, linux-ide@vger.kernel.org, jens.axboe@oracle.com, linux-scsi@vger.kernel.org, James.Bottomley@suse.de, linux-kernel@vger.kernel.org
|
||||
Cc: ben@decadent.org.uk, Tejun Heo <tj@kernel.org>
|
||||
Date: Thu, 13 May 2010 17:56:45 +0200
|
||||
Subject: [PATCH 3/4] libata: use the enlarged capacity after late HPA unlock
|
||||
Date: Sat, 15 May 2010 19:55:32 +0200
|
||||
Subject: [PATCH 7/8] libata: use the enlarged capacity after late HPA unlock
|
||||
|
||||
After late HPA unlock, libata kept using the original capacity
|
||||
ignoring the new larger native capacity. Enlarging device on the fly
|
||||
|
@ -32,5 +31,5 @@ index 86f405b..9d6e92d 100644
|
|||
}
|
||||
|
||||
--
|
||||
1.6.4.2
|
||||
1.7.1
|
||||
|
||||
|
|
|
@ -61,7 +61,8 @@
|
|||
+ features/arm/guruplug.patch
|
||||
+ bugfix/all/buffer-make-invalidate_bdev-drain-all-add-caches.patch
|
||||
+ bugfix/all/block-restart-partition-scan-after-resizing.patch
|
||||
+ bugfix/all/SCSI-implement-sd_set_capacity.patch
|
||||
+ bugfix/all/block-ide-simplify-bdops-set_capacity-to-unlock_native_capacity.patch
|
||||
+ bugfix/all/SCSI-implement-sd_unlock_native_capacity.patch
|
||||
+ bugfix/all/libata-use-enlarged-capacity-after-late-HPA-unlock.patch
|
||||
+ bugfix/all/libata-implement-on-demand-HPA-unlocking.patch
|
||||
+ bugfix/all/V4L-DVB-budget-Select-correct-frontends.patch
|
||||
|
|
Loading…
Reference in New Issue