Re: syncing the disks when entering sleep

Nigel Cunningham
2010-01-22T22:06:50Z

Hi again.

Nigel Cunningham wrote:
> Hi.
>
> Leisner, Martin wrote:
>>> -----Original Message-----
>>> From: Rafael J. Wysocki [mailto:rjw@sisk.pl]
>>> Sent: Friday, January 22, 2010 4:38 PM
>>> To: Leisner, Martin
>>> Cc: Nigel Cunningham; linux-pm@lists.linux-foundation.org
>>> Subject: Re: [linux-pm] syncing the disks when entering sleep
>>>
>>> On Friday 22 January 2010, Leisner, Martin wrote:
>>> > To clarify what I proposed:
>>> >
>>> > if(user sets knobs)
>>> > if(disk is spun up)
>>> > sync
>>> >
>>> > currently the algorithm is
>>> >
>>> > sync
>>>
>>> Yes, but Nigel said it should be
>>>
>>> if(user knob is unset)
>>> sync
>>>
>>> which I agree with.
>>>
>>> [BTW, please don't top-post in future.]
>>>
>>> Rafael
>> if(knob is set) {
>> if(disk is spun up)
>> sync
>> } else sync
>>
>> The spinup of the disk can have a very noticeable amount of time...if the user doesn't care about syncing, then the top is preferred...

Sorry to reply to myself but...

> That sounds much better; thanks.

I shouldn't have said that - as Rafael said

if (knob is unset)
sync

provides much more predictable behaviour. I know you want the code to
look at whether the disk is spun up, but that makes things more
unpredictable. Imagine a situation where you get some error in which
whether we synced or not is important - reproducing, diagnosing and
fixing the issue gets more complicated if we go your way.

The other issue would be detecting whether disks (there might be more
than one!) are spun up. That, in itself, would probably require a lot of
extra code to get the info from the drivers.

An explicit and unconditional disabling of syncing is simpler.

Regards,

Nigel