All of lore.kernel.org
 help / color / mirror / Atom feed
From: David Chinner <dgc@sgi.com>
To: Christoph Hellwig <hch@lst.de>
Cc: xfs@oss.sgi.com
Subject: Re: [PATCH 4/17] kill the v_flag member in struct bhv_vnode
Date: Fri, 24 Aug 2007 09:12:40 +1000	[thread overview]
Message-ID: <20070823231237.GY72985246@sgi.com> (raw)
In-Reply-To: <20070823193807.GE8050@lst.de>

On Thu, Aug 23, 2007 at 09:38:07PM +0200, Christoph Hellwig wrote:
> 
> All flags previous handled at the vnode level are not in the xfs_inode
> where we already have a flags mechanisms and free bits for flags
> previously in the vnode.
> 
> 
> Signed-off-by: Christoph Hellwig <hch@lst.de>
....
> Index: linux-2.6-xfs/fs/xfs/xfs_vnodeops.c
> ===================================================================
> --- linux-2.6-xfs.orig/fs/xfs/xfs_vnodeops.c	2007-08-13 18:00:49.000000000 +0200
> +++ linux-2.6-xfs/fs/xfs/xfs_vnodeops.c	2007-08-13 18:00:51.000000000 +0200
....
> @@ -1536,7 +1538,13 @@ xfs_release(
>  		 * significantly reducing the time window where we'd otherwise
>  		 * be exposed to that problem.
>  		 */
> -		if (VUNTRUNCATE(vp) && VN_DIRTY(vp) && ip->i_delayed_blks > 0)
> +		spin_lock(&ip->i_flags_lock);
> +		truncated = __xfs_iflags_test(ip, XFS_ITRUNCATED);
> +		if (truncated)
> +			ip->i_flags &= ~XFS_ITRUNCATED;
> +		spin_unlock(&ip->i_flags_lock);
> +
> +		if (truncated && VN_DIRTY(vp) && ip->i_delayed_blks > 0)
>  			xfs_flush_pages(ip, 0, -1, XFS_B_ASYNC, FI_NONE);
>  	}

This is kind of icky - doing an open coded flag clear instead of wrapping
it in a xfs_iflags_test_and_clear() type operation. Something like:

static inline int
xfs_iflags_test_and_clear(xfs_inode_t *ip, unsigned short flags)
{
	int	ret;

	spin_lock(&ip->i_flags_lock);
	ret = ip->i_flags & flags;
	if (ret)
		ip->i_flags &= ~flags;
	spin_unlock(&ip->i_flags_lock);
	return ret;
}

And then the code can become:

	if (xfs_iflags_test_and_clear(ip, XFS_ITRUNCATED) &&
	    VN_DIRTY(vp) && ip->i_delayed_blks > 0))
		xfs_flush_pages(ip, 0, -1, XFS_B_ASYNC, FI_NONE);

FWIW, for changes to this series I think incremental patches would
probably be the easiest way to handle it.

Cheers,

Dave.

-- 
Dave Chinner
Principal Engineer
SGI Australian Software Group

      parent reply	other threads:[~2007-08-23 23:12 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-08-23 19:38 [PATCH 4/17] kill the v_flag member in struct bhv_vnode Christoph Hellwig
2007-08-23 19:45 ` Josef Sipek
2007-08-23 23:12 ` David 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=20070823231237.GY72985246@sgi.com \
    --to=dgc@sgi.com \
    --cc=hch@lst.de \
    --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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.