[parted-devel] Failure with O_DIRECT

Otavio Salvador otavio at debian.org
Thu Jul 5 17:21:35 UTC 2007


Michael Brennan <brennan.brisad at gmail.com> writes:

> Sorry I accidentally mailed you instead of the list first,
> I've CC'd this one.
>
> On Thu, Jul 05, 2007 at 01:59:28PM -0300, Otavio Salvador wrote:
>> "Michael Brennan" <brennan.brisad at gmail.com> writes:
>> 
>> >    On 7/4/07, Otavio Salvador <otavio at debian.org> wrote:
>> >      > Have you tested with lastest 2.4 series too?
>> >
>> >    Yes, I have tried the latest kernels from both 2.4 and 2.6 now and
>> >    I found that 2.4 does not work while 2.6 works fine.
>> 
>> Ok, right.
>> 
>> >      I did some research about it and looks like we're not suppose to use
>> >      O_DIRECT but madvice or posix_fadvice.
>> >
>> >    What is the main reason this non-buffering mechanism is used in parted?
>> >    Is it for performance?  Or something other, like reducing the risk of
>> >    corrupting data?
>> 
>> Probably to avoid possible corruption due a poweroff and like.
>
> I'm probably missing something, but, if a power failure happens in the
> middle of an unbuffered write, wouldn't that do more damage than if
> the write is still in the buffers and haven't been synced yet?

More or less. If we are moving data, I think is better to be unbuffered.

>> 
>> >    The other partitioning tools I've used seem to use normal write
>> >    operations and then sync the disks right afterwards, on the other
>> >    hand, they only write the partition table to disk and does not
>> >    have the advanced features parted has.
>> 
>> The only risk I can think is when a freeze or a poweroff happens but
>> we might output an warning on those cases and then move to
>> posix_fadvice.
>
> Output a warning on which cases?

If the posix_fadvice will do what we need and warn when it's disabled.

-- 
        O T A V I O    S A L V A D O R
---------------------------------------------
 E-mail: otavio at debian.org      UIN: 5906116
 GNU/Linux User: 239058     GPG ID: 49A5F855
 Home Page: http://otavio.ossystems.com.br
---------------------------------------------
"Microsoft sells you Windows ... Linux gives
 you the whole house."



More information about the parted-devel mailing list