All of lore.kernel.org
 help / color / mirror / Atom feed
From: col-pepper@piments.com
To: "Andrew Morton" <akpm@osdl.org>
Cc: "linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Subject: Re: o_sync in vfat driver
Date: Mon, 27 Feb 2006 23:19:17 +0100	[thread overview]
Message-ID: <op.s5nkafhpj68xd1@mail.piments.com> (raw)
In-Reply-To: <20060226165114.e87fe056.akpm@osdl.org>

Thanks for the reply.


On Mon, 27 Feb 2006 01:51:14 +0100, Andrew Morton <akpm@osdl.org> wrote:

> col-pepper@piments.com wrote:
>>
>> There is nothing in the spec of vfat that suggests the FAT will be  
>> written
>> 10.000 during the writing of one large file. Indeed it is hard to  
>> imagine
>> that any other implementation on any other OS or any previous linux  
>> kernel
>> behaves like that.
>
> We sync the file metadata once per write() syscall.  If your app writes a
> large file in lots of little bits, it'll do a lot of syncs.  Other
> implementations of fatfs will (must) do the same thing.

That would not seem to be the case at least on MS systems. I had a freind  
do some timings copying a large group of files to a 128M usb flash device.
There was an arbitary mix of files including many small files and some  
larger files, one in excess of 50MB.

suse10 default 4m10
win2k 2m30
suse w/o sync 30s

The suse test was drag and drop in konqueror , the other dnd in windows  
explorer.

>
>> It would seem that the first step could be to revert to the 2.6.11
>> behaviour which was more appropriate and probably safer even from the  
>> data
>> point of view.
>
> fatfs used to be buggy - it didn't implement `-o sync'.  Now it does, and
> what we're seeing is the fallout from the late fixing of that bug.
>

I just tested on my 2.6.11 kernel which would predate the change and there  
is a clear difference between mounting my usb device with and without sync  
option.

ls -ail /tmpd/mail*
239151 -rw-r--r-- 1 root root 8169540 2006-02-27 19:04  
/tmpd/mail-bak.2006-02-28.bz2
bash-3.1#time cp !$ /mnt/usb
time cp /tmpd/mail* /mnt/usb

real    0m0.227s
user    0m0.001s
sys     0m0.070s

It returns immediately with no disk activity. About 30s later there was  
disk activity. Presumably some periodic flushing of IO buffers.

bash-3.1#umount /mnt/usb
bash-3.1#mount -o sync !$

bash-3.1#time cp /tmpd/mail* /mnt/usb

real    0m5.440s
user    0m0.000s
sys     0m0.143s

So the older model did seem to have some sync functionality , tho'  
presumably not the agressive one-for-one sync that is now being used.

Please correct me if my interpretation is flawed here:

flash has to be cleared before being written. If metadata is written with  
every block output with write(), the risk of erasing the FAT is now many  
times higher than with the old sync policy.

So the newer sync policy drastically _reduces_ the data security in the  
case of untimely disconnection despite the speed penalty and possible  
hardware damage it incurs.

A less rigourous sync policy may in fact be more appropriate than the  
current model.

Thanks again.


[Note: I am not subscribed to LKML, if you wish me to recieve any follow
ups please BCC: col-pepper at piments point com . thx]

  reply	other threads:[~2006-02-27 22:19 UTC|newest]

Thread overview: 42+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-02-26 23:08 o_sync in vfat driver col-pepper
2006-02-27  0:51 ` Andrew Morton
2006-02-27 22:19   ` col-pepper [this message]
2006-02-27 23:12     ` Andrew Morton
2006-02-28 18:47       ` Chris Mason
2006-02-28 19:10         ` Andrew Morton
2006-02-28 19:48           ` Chris Mason
     [not found]         ` <87u0aiw6pi.fsf@duaron.myhome.or.jp>
2006-03-01 15:23           ` Chris Mason
     [not found]             ` <87mzg9wst0.fsf@duaron.myhome.or.jp>
2006-03-02 13:45               ` Chris Mason
2006-03-02 14:07                 ` OGAWA Hirofumi
2006-03-02 17:01                   ` Chris Mason
2006-03-02 18:14                     ` OGAWA Hirofumi
2006-03-29  2:13         ` Mathis Ahrens
2006-03-30 17:35           ` col-pepper
2006-02-28  0:52     ` Machida, Hiroyuki
  -- strict thread matches above, loose matches on Subject: below --
2006-02-26 22:55 col-pepper
     [not found] <op.s5cj47sxj68xd1@mail.piments.com>
     [not found] ` <op.s5jpqvwhui3qek@mail.piments.com>
     [not found]   ` <op.s5kxhyzgfx0war@mail.piments.com>
     [not found]     ` <op.s5kx7xhfj68xd1@mail.piments.com>
     [not found]       ` <op.s5kya3t0j68xd1@mail.piments.com>
     [not found]         ` <op.s5ky2dbcj68xd1@mail.piments.com>
     [not found]           ` <op.s5ky71nwj68xd1@mail.piments.com>
     [not found]             ` <op.s5kzao2jj68xd1@mail.piments.com>
2006-02-26 22:50               ` col-pepper
2006-02-27 13:28                 ` Lennart Sorensen
2006-02-27 13:50                   ` Arjan van de Ven
2006-02-27 14:06                     ` Anton Altaparmakov
2006-02-27 14:27                       ` Arjan van de Ven
2006-02-27 14:41                         ` Anton Altaparmakov
2006-02-27 21:04                           ` col-pepper
2006-02-27 21:17                             ` Arjan van de Ven
2006-02-27 23:21                               ` col-pepper
2006-02-27 21:32                             ` linux-os (Dick Johnson)
2006-02-27 23:21                               ` col-pepper
2006-02-28 13:10                                 ` linux-os (Dick Johnson)
2006-02-28 13:52                                   ` Sergei Organov
2006-02-28 15:18                                   ` Lennart Sorensen
2006-02-28 16:16                                     ` linux-os (Dick Johnson)
2006-02-28 17:23                                       ` Sergei Organov
2006-02-28 18:09                                       ` Krzysztof Halasa
2006-02-28 17:16                                   ` col-pepper
2006-02-28 22:38                                 ` Pavel Machek
2006-03-01  4:28                                   ` Kyle Moffett
2006-03-02  8:23                                   ` col-pepper
2006-03-02  8:32                                     ` Pavel Machek
2006-02-28 16:11                             ` Helge Hafting
2006-02-28 22:37                             ` Pavel Machek
2006-02-27 14:26                   ` linux-os (Dick Johnson)
2006-02-27 18:53                     ` Jan Engelhardt

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=op.s5nkafhpj68xd1@mail.piments.com \
    --to=col-pepper@piments.com \
    --cc=akpm@osdl.org \
    --cc=linux-kernel@vger.kernel.org \
    /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
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.