public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Dave Chinner <david@fromorbit.com>
To: "Pádraig Brady" <P@draigBrady.com>
Cc: "Frank A. Kingswood" <frank@kingswood-consulting.co.uk>,
	linux-kernel@vger.kernel.org
Subject: Re: atomically swap two files
Date: Sat, 27 Nov 2010 01:19:11 +1100	[thread overview]
Message-ID: <20101126141911.GJ12187@dastard> (raw)
In-Reply-To: <4CEF9E68.9080200@draigBrady.com>

On Fri, Nov 26, 2010 at 11:47:52AM +0000, Pádraig Brady wrote:
> On 25/11/10 20:11, Frank A. Kingswood wrote:
> > Hi!
> > 
> > Is it possible to swap two files in an atomic way, so that after the
> > syscall either the two files have exchanged names or neither has been
> > modified?
> > 
> > I suspect that btrfs could do it, but I'm wondering about ext3/4.
> 
> I don't think there is anything equivalent to exchangedata() on Linux
> http://developer.apple.com/library/mac/#DOCUMENTATION/Darwin/Reference/ManPages/man2/exchangedata.2.html

XFS can do that, though the interface is an ioctl (XFS_IOC_SWAPEXT)
whose parameters are closely tied to the functionality of the only
user: the online defragmenter (xfs_fsr). It would be pretty easy to
wire it up to such a syscall if one existed, though....

Cheers,

Dave.
-- 
Dave Chinner
david@fromorbit.com

      reply	other threads:[~2010-11-26 14:19 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-11-25 20:11 atomically swap two files Frank A. Kingswood
2010-11-26 11:47 ` Pádraig Brady
2010-11-26 14:19   ` Dave Chinner [this message]

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=20101126141911.GJ12187@dastard \
    --to=david@fromorbit.com \
    --cc=P@draigBrady.com \
    --cc=frank@kingswood-consulting.co.uk \
    --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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox