From: Christoph Hellwig <hch@infradead.org>
To: Dave Chinner <david@fromorbit.com>
Cc: xfs@oss.sgi.com
Subject: Re: [PATCH 1/6] [XFS] Split inode data writeback from inode sync.
Date: Mon, 16 Mar 2009 06:10:08 -0400 [thread overview]
Message-ID: <20090316101008.GA2874@infradead.org> (raw)
In-Reply-To: <1237117603-26071-2-git-send-email-david@fromorbit.com>
> +static int
> +xfs_sync_inode_data(
> + struct xfs_inode *ip,
> + int flags)
> +{
> + struct inode *inode = VFS_I(ip);
> + int error = 0;
> +
> + if (VN_DIRTY(inode)) {
> + int locked = 0;
> + if (flags & SYNC_TRYLOCK) {
> + if (xfs_ilock_nowait(ip, XFS_IOLOCK_SHARED))
> + locked = 1;
> + } else {
> + xfs_ilock(ip, XFS_IOLOCK_SHARED);
> + locked = 1;
> + }
> + if (locked) {
> + error = xfs_flush_pages(ip, 0, -1,
> + (flags & SYNC_WAIT) ? 0 : XFS_B_ASYNC,
> + FI_NONE);
> + xfs_iunlock(ip, XFS_IOLOCK_SHARED);
> + }
> + }
> +
> + if (flags & SYNC_IOWAIT)
> + xfs_ioend_wait(ip);
> +
> + return error;
> +}
In the end this should look more like:
static int
xfs_sync_inode_data(
struct xfs_inode *ip,
int flags)
{
struct inode *inode = VFS_I(ip);
struct address_space *mapping = inode->i_mapping;
int error = 0;
if (mapping_tagged(mapping, PAGECACHE_TAG_DIRTY)) {
if (!xfs_ilock_nowait(ip, XFS_IOLOCK_SHARED)) {
if (flags & SYNC_TRYLOCK)
goto out;
xfs_ilock(ip, XFS_IOLOCK_SHARED);
}
if (flags & SYNC_WAIT) {
error = filemap_write_and_wait(mapping);
else
error = filemap_fdatawrite(mapping);
xfs_iflags_clear(ip, XFS_ITRUNCATED);
xfs_iunlock(ip, XFS_IOLOCK_SHARED);
}
out:
if (flags & SYNC_IOWAIT)
xfs_ioend_wait(ip);
return -error;
}
_______________________________________________
xfs mailing list
xfs@oss.sgi.com
http://oss.sgi.com/mailman/listinfo/xfs
next prev parent reply other threads:[~2009-03-16 10:10 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-03-15 11:46 [PATCH 0/6] [XFS] introduce a AG inode tree walker Dave Chinner
2009-03-15 11:46 ` [PATCH 1/6] [XFS] Split inode data writeback from inode sync Dave Chinner
2009-03-16 10:10 ` Christoph Hellwig [this message]
2009-03-16 10:47 ` Dave Chinner
2009-03-15 11:46 ` [PATCH 2/6] [XFS] Use xfs_inode_flush() in xfs_sync_inodes_ag() Dave Chinner
2009-03-15 11:46 ` [PATCH 3/6] [XFS] Factor out inode validation for sync Dave Chinner
2009-03-15 11:46 ` [PATCH 4/6] [XFS] Factor out inode validation for reclaim Dave Chinner
2009-03-15 11:46 ` [PATCH 5/6] [XFS] Remove unused parameter from xfs_reclaim_inodes Dave Chinner
2009-03-15 11:46 ` [PATCH 6/6] [XFS] introduce a per-ag inode iterator Dave Chinner
2009-03-16 7:53 ` [PATCH 0/6] [XFS] introduce a AG inode tree walker Christoph Hellwig
2009-03-16 9:40 ` Dave Chinner
2009-03-16 10:01 ` Christoph Hellwig
2009-03-16 10:35 ` 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=20090316101008.GA2874@infradead.org \
--to=hch@infradead.org \
--cc=david@fromorbit.com \
--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