[ltp] Make disk-protect work on 2.6.24 (was: enabling protect file for hdaps on t61)
Elias Oltmanns
linux-thinkpad@linux-thinkpad.org
Wed, 13 Feb 2008 12:39:17 +0100
--=-=-=
[cc'ing hdaps-devel]
Vincent C Jones <v.jones@networkingunlimited.com> wrote:
> On Mon, 2008-02-11 at 07:58 +0100, Elias Oltmanns wrote:
>> Vincent C Jones <v.jones@networkingunlimited.com> wrote:
>> >
>> > SATA drive here as well (7675 X61, AHCI mode, SuSE 10.3, 2.6.24 with
>> > SuSE, acpi, protect, & tp_smapi patches applied) and I have no problem
>> > invoking a freeze. What is your magic incantation to avoid the problem?
>> > I really would like to get HDAPS back...
>>
>> The difference isn't so much SATA vs PATA but SMP system vs uniprocessor
>> / non-SMP system. Probably Rolf is running an SMP kernel on a dual core
>> machine whereas your system is lacking SMP support.
>
> Huh? SMP -> problem or SMP is OK? SMP kernel with dual core CPU = freeze
Quite right, my analysis was flawed since we seem to have a busy loop
rather than an infinite recursion. Since some of you don't have the
freeze problem, I suppose some kernel config options influence the
scheduler in such a way that I/O either gets a chance or not.
Anyway, there is a temporary solution to this problem. If you apply the
little patch attached to this email, the usual disk-protect patch will
work on 2.6.24. This change is supposed to fix a generic problem in
libata and may eventually be merged upstream, but Tejun Heo (libata
developer) said that some testing was required first.
This change is absolutely safe for everyone using a non-NCQ capable
system. In particular, ata_piix doesn't support NCQ. If you are using
ahci and /sys/class/scsi_disk/.../device/queue_depth reports a value
greater than 1, i.e. NCQ is enabled, then the patch shouldn't cause any
harm either but it may or may not affect I/O performance.
Enjoy,
Elias
--=-=-=
Content-Type: text/x-patch
Content-Disposition: attachment; filename=adjust-blocked-counters.patch
---
drivers/ata/libata-scsi.c | 4 ++--
1 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/ata/libata-scsi.c b/drivers/ata/libata-scsi.c
index 14daf48..bab372b 100644
--- a/drivers/ata/libata-scsi.c
+++ b/drivers/ata/libata-scsi.c
@@ -823,7 +823,7 @@ static void ata_scsi_sdev_config(struct
* prevent SCSI midlayer from automatically deferring
* requests.
*/
- sdev->max_device_blocked = 1;
+ sdev->max_device_blocked = 2;
}
static void ata_scsi_dev_config(struct scsi_device *sdev,
@@ -3120,7 +3120,7 @@ int ata_scsi_add_hosts(struct ata_host *
* Set host_blocked to 1 to prevent SCSI midlayer from
* automatically deferring requests.
*/
- shost->max_host_blocked = 1;
+ shost->max_host_blocked = 2;
rc = scsi_add_host(ap->scsi_host, ap->host->dev);
if (rc)
--=-=-=--