linux-xfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Eric Sandeen <sandeen@redhat.com>
To: Christoph Hellwig <hch@infradead.org>
Cc: xfs-oss <xfs@oss.sgi.com>
Subject: Re: [PATCH, RFC] xfs: add heuristic to flush on rename
Date: Fri, 25 Apr 2014 14:59:25 -0500	[thread overview]
Message-ID: <535ABE9D.8070404@redhat.com> (raw)
In-Reply-To: <20140425195528.GA16567@infradead.org>

On 4/25/14, 2:55 PM, Christoph Hellwig wrote:
>> +	/*
>> +	 * If we are renaming a just-written file over an existing
>> +	 * file, be pedantic and flush it out if it looks like somebody
>> +	 * is doing a tmpfile dance, and didn't fsync.  Best effort;
>> +	 * ignore errors.
>> +	 */
>> +	if (new_inode) {
>> +		xfs_inode_t *ip = XFS_I(odentry->d_inode);
>> +
>> +		if (VN_DIRTY(VFS_I(ip)) && ip->i_delayed_blks > 0)
>> +			filemap_flush(new_inode->i_mapping);
>> +	}
> 
> IFF we want a heuristic it should be a proper filemap_write_and_wait.  a
> non-blocking start of I/O without waiting for it is snake oil.

Hi Christoph -

It's the same thing we do on truncated and written files, FWIW:

                truncated = xfs_iflags_test_and_clear(ip, XFS_ITRUNCATED);
                if (truncated) {
                        xfs_iflags_clear(ip, XFS_IDIRTY_RELEASE);
                        if (VN_DIRTY(VFS_I(ip)) && ip->i_delayed_blks > 0) {
                                error = -filemap_flush(VFS_I(ip)->i_mapping);
                                if (error)
                                        return error;
                        }
                }

and that's served us pretty well in the past years.

I don't know if we're looking for rock-solid guarantees, or just do a little
to try to save the user from themselves... blocking would make this a lot more
heavyweight I suppose.  Just depends on what we are willing / trying to do.

thanks,
-Eric

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

  reply	other threads:[~2014-04-25 19:59 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-04-25 19:42 [PATCH, RFC] xfs: add heuristic to flush on rename Eric Sandeen
2014-04-25 19:55 ` Christoph Hellwig
2014-04-25 19:59   ` Eric Sandeen [this message]
2014-04-25 20:00 ` Eric Sandeen
2014-04-27 21:20 ` Dave Chinner
2014-04-27 21:56   ` Eric Sandeen
2014-04-27 23:15     ` Dave Chinner
2014-04-28  0:20       ` Eric Sandeen
2014-04-28  0:48         ` Dave Chinner

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=535ABE9D.8070404@redhat.com \
    --to=sandeen@redhat.com \
    --cc=hch@infradead.org \
    --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;
as well as URLs for NNTP newsgroup(s).