mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Linus Torvalds <torvalds@linux-foundation.org>
To: Bart Trojanowski <bart@jukie.net>
Cc: linux-kernel@vger.kernel.org, Al Viro <viro@zeniv.linux.org.uk>
Subject: Re: vfat BKL/lock_super regression in v2.6.26-rc3-g8f59342
Date: Tue, 19 Aug 2008 17:43:25 -0700 (PDT)	[thread overview]
Message-ID: <alpine.LFD.1.10.0808191729330.3324@nehalem.linux-foundation.org> (raw)
In-Reply-To: <20080820001845.GC28029@jukie.net>



On Tue, 19 Aug 2008, Bart Trojanowski wrote:
> 
> So, maybe it would be a good idea to have a 'delaysync=60' to force a
> sync after 60 seconds of inactivity.  Unless, there is something else
> that would do that for me already.

Oh, it could be even shorter.

The problem with using 'sync' is that it easily ends up overwriting things 
like the sector that contains a particular inode thousands of times for 
even trivial operations. Or things like the file allocation table etc.

For example, something as trivial as copying a single big file, if the 
copy program just copies it a few kB at a time, then a file that is a few 
megabytes in size will actually end up rewriting the inode block (just 
because the size grows) thousands of time. 

With any kind of half-way decent wear leveling, this isn't a problem at 
all, and most flash drives have that. But if they don't, then that means 
that the file allocation table sectors and the inode sectors get rewritten 
over and over and over again thousands of times.

Just making it do the sync once per _second_ or something like that would 
already make the "thousands of times" go away. The sectors would probably 
be rewritten a few times per big file, and just once per couple of tens of 
files for small files being written.

So we don't even need anything like 60 seconds, we literally would just 
need some trivial delays.

But no, we don't have that kind of "half-sync" behavior. Right now, it's 
pretty much all or nothing.  Either we're fully synchronous (and that 
really is bad for crappy flash), or we end up depending on bdflush writing 
things back in the background.

Of course, pdflush already syncs within 60s (in fact, 30s by default, 
iirc), but then things like "laptop_mode" will actually make that 
potentially much less frequent (I think the default value for that is 5 
minutes).

I do think this is something we could do better, no question about it.

But I don't know exactly what the timeout should be, though (although I 
suspect that it should involve _ignoring_ non-data writes like the atime 
updates, and trigger a timeout on data writes so that when you actually 
write a file, you'll know that the sync will happen within five seconds of 
you having finished the write or whatever).

And no, no such mount option currently exists. And the pdflush things are 
all global, not per-device, iirc.

		Linus

  reply	other threads:[~2008-08-20  0:44 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-08-19 22:03 Bart Trojanowski
2008-08-19 22:06 ` [PATCH] make lock_super recursive to simulate BKL Bart Trojanowski
2008-08-19 22:21   ` Linus Torvalds
2008-08-20  1:14     ` Bart Trojanowski
2008-08-19 22:17 ` vfat BKL/lock_super regression in v2.6.26-rc3-g8f59342 Linus Torvalds
2008-08-20  0:03   ` Bart Trojanowski
2008-08-20  0:11     ` Linus Torvalds
2008-08-20  0:24       ` Bart Trojanowski
2008-08-20  0:18   ` Bart Trojanowski
2008-08-20  0:43     ` Linus Torvalds [this message]
2008-08-20  0:56       ` Linus Torvalds
2008-08-20  2:27         ` Bart Trojanowski
2008-08-20 21:23           ` Diego Calleja
2008-08-23  0:54           ` [PATCH] document additional vfat mount options Bart Trojanowski
2008-08-23  2:33             ` Grant Coady
2008-08-23  3:12               ` Bart Trojanowski
2008-08-23  3:14                 ` Bart Trojanowski
2008-08-23  3:27                   ` OGAWA Hirofumi
2008-08-23 13:11                     ` Bart Trojanowski
2008-08-23 14:47                       ` OGAWA Hirofumi
2008-08-23  3:10             ` OGAWA Hirofumi

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=alpine.LFD.1.10.0808191729330.3324@nehalem.linux-foundation.org \
    --to=torvalds@linux-foundation.org \
    --cc=bart@jukie.net \
    --cc=linux-kernel@vger.kernel.org \
    --cc=viro@zeniv.linux.org.uk \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®