public inbox for linux-xfs@vger.kernel.org
 help / color / mirror / Atom feed
From: Brian Candler <B.Candler@pobox.com>
To: Peter Grandi <pg_xf2@xf2.for.sabi.co.UK>
Cc: Linux fs XFS <xfs@oss.sgi.com>
Subject: Re: GNU 'tar', Schilling's 'tar', write-cache/barrier
Date: Sat, 24 Mar 2012 17:11:50 +0000	[thread overview]
Message-ID: <20120324171150.GA69366@nsrc.org> (raw)
In-Reply-To: <20333.62951.784434.92213@tree.ty.sabi.co.UK>

On Sat, Mar 24, 2012 at 04:27:19PM +0000, Peter Grandi wrote:
> --------------------------------------------------------------
> #  (cd /tmp/ext4; rm -rf linux-2.6.32; sync; time star -no-fsync -x -f /tmp/linux-2.6.32.tar; egrep 'Dirty|Writeback' /proc/meminfo; time sync)
> star: 37343 blocks + 0 bytes (total of 382392320 bytes = 373430.00k).
> 
> real    0m1.204s
> user    0m0.139s
> sys     0m1.270s
> Dirty:          419456 kB
> Writeback:           0 kB
> 
> real    0m5.012s
> user    0m0.000s
> sys     0m0.458s
> --------------------------------------------------------------
> #  (cd /tmp/ext4; rm -rf linux-2.6.32; sync; time star -x -f /tmp/linux-2.6.32.tar; egrep 'Dirty|Writeback' /proc/meminfo; time sync)
> star: 37343 blocks + 0 bytes (total of 382392320 bytes = 373430.00k).
> 
> real    23m29.346s
> user    0m0.327s
> sys     0m2.280s
> Dirty:             108 kB
> Writeback:           0 kB
> 
> real    0m0.236s
> user    0m0.000s
> sys     0m0.199s

But as a user, what guarantees do I *want* from tar?

I think the only meaningful guarantee I might want is: "if the tar returns
successfully, I want to know that all the files are persisted to disk".  And
of course that's what your final "sync" does, although with the unfortunate
side-effect of syncing all other dirty blocks in the system too.

Calling fsync() after every single file is unpacked does also achieve the
desired guarantee, but at a very high cost.  This is partly because you have
to wait for each fsync() to return [although I guess you could spawn threads
to do them] but also because the disk can't aggregate lots of small writes
into one larger write, even when the filesystem has carefully allocated them
in adjacent blocks.

I think what's needed is a group fsync which says "please ensure this set of
files is all persisted to disk", which is done at the end, or after every N
files.  If such an API exists I don't know of it.

On the flip side, does fsync()ing each individual file buy you anything over
and above the desired guarantee?  Possibly - in theory you could safely
restart an aborted untar even through a system crash.  You would have to be
aware that the last file which was unpacked may only have been partially
written to disk, so you'd have to restart by overwriting the last item in
the archive which already exists on disk.  Maybe star has this feature, I
don't know.  And unlike zip, I don't think tarfiles are indexed, so you'd
still have to read it from the beginning.

If the above benchmark is typical, it suggests that fsyncing after every
file is 4 times slower than untar followed by sync.  So I reckon you would
be better off using the fast/unsafe version, and simply restarting it from
the beginning if the system crashed while you were running it.  That's
unless you expect the system to crash 4 or more times while you untar this
single file.

Just my 2¢, as a user and definitely not a filesystem expert.

Regards,

Brian.

_______________________________________________
xfs mailing list
xfs@oss.sgi.com
http://oss.sgi.com/mailman/listinfo/xfs

  reply	other threads:[~2012-03-24 17:11 UTC|newest]

Thread overview: 33+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <CAA8mOyDKrWg0QUEHxcD4ocXXD42nJu0TG+sXjC4j2RsigHTcmw@mail.gmail.com>
     [not found] ` <4F61803A.60009@hardwarefreak.com>
     [not found]   ` <CAA8mOyCzs36YD_QUMq25HQf8zuq1=tmSTPjYdoFJwy2Oq9sLmw@mail.gmail.com>
2012-03-15 14:07     ` raid10n2/xfs setup guidance on write-cache/barrier Peter Grandi
2012-03-15 15:25       ` keld
2012-03-15 16:52         ` Jessie Evangelista
2012-03-15 17:15           ` keld
2012-03-15 17:40             ` keld
2012-03-15 16:18       ` Jessie Evangelista
2012-03-15 23:00         ` Peter Grandi
2012-03-16  3:36           ` Jessie Evangelista
2012-03-16 11:06             ` Michael Monnerie
2012-03-16 12:21               ` Peter Grandi
2012-03-16 17:15             ` Brian Candler
2012-03-17 15:35             ` Peter Grandi
2012-03-17 21:39               ` raid10n2/xfs setup guidance on write-cache/barrier (GiB alignment) Zdenek Kaspar
2012-03-18  0:08                 ` Peter Grandi
2012-03-26 19:50               ` raid10n2/xfs setup guidance on write-cache/barrier Martin Steigerwald
2012-03-17  4:21       ` NOW:Peter goading Dave over delaylog - WAS: " Stan Hoeppner
2012-03-17 22:34         ` Dave Chinner
2012-03-18  2:09           ` Peter Grandi
2012-03-18 11:25             ` Peter Grandi
2012-03-18 14:00               ` Christoph Hellwig
2012-03-18 19:17                 ` Peter Grandi
2012-03-19  9:07                   ` Stan Hoeppner
2012-03-20 12:34                     ` Jessie Evangelista
2012-03-18 18:08               ` Stan Hoeppner
2012-03-22 21:26                 ` Peter Grandi
2012-03-23  5:10                   ` Stan Hoeppner
2012-03-23 22:48                   ` Martin Steigerwald
2012-03-24  1:27                     ` Peter Grandi
2012-03-24 16:27                       ` GNU 'tar', Schilling's 'tar', write-cache/barrier Peter Grandi
2012-03-24 17:11                         ` Brian Candler [this message]
2012-03-24 18:35                           ` Peter Grandi
     [not found]     ` <4F633121.10800@hardwarefreak.com>
     [not found]       ` <CAKuK5J3GHgWcnYLqwRV8s_wMjO2nBVf7h=yONtn90kPn9A_3Gg@mail.gmail.com>
     [not found]         ` <CAKuK5J11JTdwZSBWj7DH7c+hE--MVNQVVrcKXaV2AO-wEpWBog@mail.gmail.com>
2012-03-16 19:28           ` raid10n2/xfs setup guidance on write-cache/barrier Peter Grandi
2012-03-17  0:02             ` Stan Hoeppner

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=20120324171150.GA69366@nsrc.org \
    --to=b.candler@pobox.com \
    --cc=pg_xf2@xf2.for.sabi.co.UK \
    --cc=xfs@oss.sgi.com \
    /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