Re: [PATCH 2/4] libata: Implement disk shock protection support

Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
From: Tejun Heo
Date: Sunday, August 31, 2008 - 2:25 am

Hello,

Elias Oltmanns wrote:

Ah.. you need to part ATAPI too?  If so, just test for
ata_dev_enabled().  One way or the other, there's no need to care
about SCSI or block layer when you're in EH.


While the EH is running, nothing gets through other than commands
issued by EH itself, so no need to worry about how upper layers would
behave.


Yes, when modifying the flags.  You don't need to when testing a
feature.


Ah.. Okay.  I somehow thought the command would spin down the disk.
It's just unloading the head.  Please cross this one.


Can you please elaborate a bit?  The reloading is done by the kernel
after a timeout, right?  What kind of precarious situation can the
kernel get into regarding suspend?


You can just do

    spin_lock_irq(ap->lock);
    ap->deadline = jiffies + timeout;
    ap->link.eh_info.action |= ATA_EH_PARK;
    ata_port_schedule_eh(ap);
    spin_unlock_irq(ap->lock);


Yeah, this looks about right, but you can make it a bit simpler...

    while (time_before((now = jiffies), ap->deadline))
	schedule_timeout_uninterruptible(ap->deadline - now);

As locking on reader side doesn't mean much in cases like this.  The
deadline update which triggered EH is guaranteed to be visible and the
the window between waking up from schedule_timeout and ap->deadline
dereference is way too small to be any meaningful.


Is the above code more complex?  I think it's simpler, no?


Oh.. what I meant was whether we need a separate sysfs node to
indicate whether unload feature is enabled or not but now I come to
think about it, that is per-device and the timer is per-port.  :-)

Thanks.

-- 
tejun
--
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
Re: [PATCH 2/4] libata: Implement disk shock protection su ..., Tejun Heo, (Sun Aug 31, 2:25 am)
Re: [PATCH 2/4] libata: Implement disk shock protection su ..., Bartlomiej Zolnierki ..., (Sun Aug 31, 7:32 am)