LKML Archive on lore.kernel.org
help / color / mirror / Atom feed
From: Elias Oltmanns <eo@nebensachen.de>
To: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
Cc: linux-ide@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH 3/4 v2] ide: Implement disk shock protection support
Date: Sat, 04 Oct 2008 11:44:35 +0200 [thread overview]
Message-ID: <87fxnczocc.fsf@denkblock.local> (raw)
In-Reply-To: <200809181624.54248.bzolnier@gmail.com>
Bartlomiej Zolnierkiewicz <bzolnier@gmail.com> wrote:
> On Wednesday 17 September 2008 09:38:37 Elias Oltmanns wrote:
>> On user request (through sysfs), the IDLE IMMEDIATE command with UNLOAD
>
>> FEATURE as specified in ATA-7 is issued to the device and processing of
>> the request queue is stopped thereafter until the specified timeout
>> expires or user space asks to resume normal operation. This is supposed
>> to prevent the heads of a hard drive from accidentally crashing onto the
>> platter when a heavy shock is anticipated (like a falling laptop expected
>> to hit the floor). Port resets are deferred whenever a device on that
>> port is in the parked state.
>>
>> Signed-off-by: Elias Oltmanns <eo@nebensachen.de>
>
> applied
Hi Bart,
may I ask you to apply yet another inter-diff? This is in order to
address three issues:
1. Make sure that no negative value is being passed to
jiffies_to_msecs() in ide_park_show().
2. Drop the superfluous variable hwif in ide_special_rq().
3. Skip initialisation of task and tf in ide_special_rq() if we are not
handling a (un)park request.
#1 and #3 have been suggested to me by Peter Moulder off-list.
Regards,
Elias
Signed-off-by: Elias Oltmanns <eo@nebensachen.de>
---
diff --git a/drivers/ide/ide-io.c b/drivers/ide/ide-io.c
index 09d10a5..1f5948e 100644
--- a/drivers/ide/ide-io.c
+++ b/drivers/ide/ide-io.c
@@ -672,12 +672,16 @@ EXPORT_SYMBOL_GPL(ide_devset_execute);
static ide_startstop_t ide_special_rq(ide_drive_t *drive, struct request *rq)
{
- ide_hwif_t *hwif = drive->hwif;
ide_task_t task;
- struct ide_taskfile *tf = &task.tf;
+ struct ide_taskfile *tf;
+ u8 cmd = rq->cmd[0];
- memset(&task, 0, sizeof(task));
- switch (rq->cmd[0]) {
+ if (cmd == REQ_PARK_HEADS || cmd == REQ_UNPARK_HEADS) {
+ memset(&task, 0, sizeof(task));
+ tf = &task.tf;
+ }
+
+ switch (cmd) {
case REQ_PARK_HEADS:
drive->sleep = *(unsigned long *)rq->special;
drive->dev_flags |= IDE_DFLAG_SLEEPING;
@@ -710,9 +714,10 @@ static ide_startstop_t ide_special_rq(ide_drive_t *drive, struct request *rq)
ide_end_request(drive, 0, 0);
return ide_stopped;
}
+
task.tf_flags |= IDE_TFLAG_TF | IDE_TFLAG_DEVICE;
task.rq = rq;
- hwif->data_phase = task.data_phase = TASKFILE_NO_DATA;
+ drive->hwif->data_phase = task.data_phase = TASKFILE_NO_DATA;
return do_rw_taskfile(drive, &task);
}
diff --git a/drivers/ide/ide-park.c b/drivers/ide/ide-park.c
index 35fc3ee..02d7e35 100644
--- a/drivers/ide/ide-park.c
+++ b/drivers/ide/ide-park.c
@@ -61,15 +61,17 @@ ssize_t ide_park_show(struct device *dev, struct device_attribute *attr,
char *buf)
{
ide_drive_t *drive = to_ide_device(dev);
+ unsigned long now;
unsigned int msecs;
if (drive->dev_flags & IDE_DFLAG_NO_UNLOAD)
return -EOPNOTSUPP;
spin_lock_irq(&ide_lock);
+ now = jiffies;
if (drive->dev_flags & IDE_DFLAG_PARKED &&
- time_after(drive->sleep, jiffies))
- msecs = jiffies_to_msecs(drive->sleep - jiffies);
+ time_after(drive->sleep, now))
+ msecs = jiffies_to_msecs(drive->sleep - now);
else
msecs = 0;
spin_unlock_irq(&ide_lock);
next prev parent reply other threads:[~2008-10-04 9:44 UTC|newest]
Thread overview: 28+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-09-17 16:28 Disk shock protection in GNU/Linux Elias Oltmanns
2008-09-17 16:34 ` [PATCH 1/4 v2] Introduce ata_id_has_unload() Elias Oltmanns
2008-09-17 16:57 ` Tejun Heo
2008-09-18 23:24 ` Bartlomiej Zolnierkiewicz
2008-09-17 16:37 ` [PATCH 2/4 v2] libata: Implement disk shock protection support Elias Oltmanns
2008-09-17 18:03 ` Tejun Heo
2008-09-17 18:08 ` Tejun Heo
2008-09-17 18:09 ` Tejun Heo
2008-09-19 9:49 ` Elias Oltmanns
2008-09-19 12:14 ` Tejun Heo
2008-09-19 14:06 ` Elias Oltmanns
2008-09-19 14:15 ` Tejun Heo
2008-09-19 15:00 ` Elias Oltmanns
2008-09-20 4:48 ` Tejun Heo
2008-09-17 16:38 ` [PATCH 3/4 v2] ide: " Elias Oltmanns
2008-09-18 23:24 ` Bartlomiej Zolnierkiewicz
2008-09-19 0:28 ` Elias Oltmanns
2008-09-19 0:47 ` Bartlomiej Zolnierkiewicz
2008-10-04 9:44 ` Elias Oltmanns [this message]
2008-10-04 13:49 ` Elias Oltmanns
2008-10-04 23:16 ` Elias Oltmanns
2008-10-08 18:56 ` Bartlomiej Zolnierkiewicz
2008-09-17 16:40 ` [PATCH 4/4 v2] Add documentation for hard disk shock protection interface Elias Oltmanns
2008-09-18 23:28 ` Bartlomiej Zolnierkiewicz
2008-10-04 9:55 ` Elias Oltmanns
2008-10-08 18:56 ` Bartlomiej Zolnierkiewicz
2008-09-19 4:21 ` Grant Grundler
2008-09-19 12:08 ` Elias Oltmanns
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87fxnczocc.fsf@denkblock.local \
--to=eo@nebensachen.de \
--cc=bzolnier@gmail.com \
--cc=linux-ide@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--subject='Re: [PATCH 3/4 v2] ide: Implement disk shock protection support' \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).