[PATCH] fsync applet

Cathey, Jim jcathey at ciena.com
Wed Jun 17 21:45:42 UTC 2009


That particular system wasn't using fsync() (or
any equivalent) if the -f was given, it sync'd
the _filesystem_ upon which the given file lay.
(That would, of course, catch the file as well.)

The point was to avoid getting stuck syncing one
of the floppy, tape, or network devices when you
wanted to flush a particular volume only.  sync()
was too big of a hammer, and fsync() was too small.
(Essentially it did all of the preparatory work
for a umount(), but didn't actually do it.)  fsync(2)
is great for any given application, don't leave home
without it, but an fsync(1) is much harder to apply
as intended at the system level of abstraction,
whereas sync(1) -f can fit beautifully.

I only mentioned it as a data point, since there
was life before GNU or POSIX.  And systems in that
day weren't as fast as now, and things like rfs
existed where a full-blown sync could indeed be
very expensive.  (I seem to recall that the database
volume had a sync -f hooked to the powerfail interrupt,
followed by a full sync that it would finish if it
had time before power fully failed.)

-- Jim



-----Original Message-----
From: busybox-bounces at busybox.net [mailto:busybox-bounces at busybox.net]
On Behalf Of Rob Landley
Sent: Wednesday, June 17, 2009 2:03 PM
To: busybox at busybox.net
Subject: Re: [PATCH] fsync applet

On Thursday 11 June 2009 12:54:47 Cathey, Jim wrote:
> For what it's worth, once upon a time I used a system
> where sync(1) had a -f <file> option whereupon it
> would only sync the volume upon which the file lay.
> I don't know if this system was alone in having such
> an option, certainly back in the day there was a lot
> of cross-pollination.  That's not fsync, anyway, so
> perhaps a separate applet is more appropriate.
>
> -- Jim

Why do you need a -f option?  The normal sync takes no arguments (and
ignores 
any it gets, the gnu version actually explicitly _says_ "sync: ignoring
all 
arguments").  So just add the ability to list files on the command line,

iterate through and do an fsync() on those or do a sync() if there
aren't any.  
And then if you like, add fsync as a synonym. :)

Rob
-- 
Latency is more important than throughput. It's that simple. - Linus
Torvalds
_______________________________________________
busybox mailing list
busybox at busybox.net
http://lists.busybox.net/mailman/listinfo/busybox



More information about the busybox mailing list