From: Ben Myers <bpm@sgi.com>
To: Christoph Hellwig <hch@infradead.org>
Cc: xfs@oss.sgi.com
Subject: Re: [PATCH 06/11] xfs: replace i_flock with a sleeping bitlock
Date: Fri, 13 Jan 2012 15:49:41 -0600 [thread overview]
Message-ID: <20120113214941.GA16386@sgi.com> (raw)
In-Reply-To: <20111218200131.745039484@bombadil.infradead.org>
On Sun, Dec 18, 2011 at 03:00:09PM -0500, Christoph Hellwig wrote:
> Index: xfs/fs/xfs/xfs_inode.c
> ===================================================================
> --- xfs.orig/fs/xfs/xfs_inode.c 2011-12-18 08:05:01.469974560 -0800
> +++ xfs/fs/xfs/xfs_inode.c 2011-12-18 08:06:23.266640737 -0800
...
> -/*
> * In-core inode flags.
> */
> -#define XFS_IRECLAIM 0x0001 /* started reclaiming this inode */
> -#define XFS_ISTALE 0x0002 /* inode has been staled */
> -#define XFS_IRECLAIMABLE 0x0004 /* inode can be reclaimed */
> -#define XFS_INEW 0x0008 /* inode has just been allocated */
> -#define XFS_IFILESTREAM 0x0010 /* inode is in a filestream directory */
> -#define XFS_ITRUNCATED 0x0020 /* truncated down so flush-on-close */
> -#define XFS_IDIRTY_RELEASE 0x0040 /* dirty release already seen */
> +#define XFS_IRECLAIM (1 << 0) /* started reclaiming this inode */
> +#define XFS_ISTALE (1 << 1) /* inode has been staled */
> +#define XFS_IRECLAIMABLE (1 << 2) /* inode can be reclaimed */
> +#define XFS_INEW (1 << 3) /* inode has just been allocated */
> +#define XFS_IFILESTREAM (1 << 4) /* inode is in a filestream dir. */
> +#define XFS_ITRUNCATED (1 << 5) /* truncated down so flush-on-close */
> +#define XFS_IDIRTY_RELEASE (1 << 6) /* dirty release already seen */
> +#define __XFS_IFLOCK_BIT 7 /* inode is being flushed right now */
> +#define XFS_IFLOCK (1 << __XFS_IFLOCK_BIT)
Nice.
> +static inline void xfs_iflock(struct xfs_inode *ip)
> +{
> + if (!xfs_iflock_nowait(ip))
> + __xfs_iflock(ip);
> +}
Going after the iflock nowait first seems a little silly, but I'm
guessing that you're trying to avoid touching the zone wait_table in
bit_waitqueue if you can avoid it, along with the rest of the overhead
related to seeting up the wait queue in __xfs_iflock.
> +
> +static inline void xfs_ifunlock(struct xfs_inode *ip)
> +{
> + xfs_iflags_clear(ip, XFS_IFLOCK);
> + wake_up_bit(&ip->i_flags, __XFS_IFLOCK_BIT);
> +}
I was going to suggest this:
spin_lock(&ip->i_flags_lock);
ip->i_flags &= ~XFS_IFLOCK;
wake_up_bit(...
spin_unlock(&ip->i_flags_lock);
After some study I believe what you have is ok:
Say this is process A. If process B got the lock after A cleared IFLOCK
and before A wake_up_bit wakes process C. C will just go back to sleep
in __xfs_iflock until B calls xfs_ifunlock to wake C again.
Looks good.
Reviewed-by: Ben Myers <bpm@sgi.com>
_______________________________________________
xfs mailing list
xfs@oss.sgi.com
http://oss.sgi.com/mailman/listinfo/xfs
next prev parent reply other threads:[~2012-01-13 21:49 UTC|newest]
Thread overview: 33+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-12-18 20:00 [PATCH 00/11] inode shrink and misc updates V2 Christoph Hellwig
2011-12-18 20:00 ` [PATCH 01/11] xfs: remove xfs_itruncate_data Christoph Hellwig
2012-01-03 21:53 ` Ben Myers
2012-01-04 9:27 ` Christoph Hellwig
2011-12-18 20:00 ` [PATCH 02/11] xfs: cleanup xfs_iomap_eof_align_last_fsb Christoph Hellwig
2012-01-04 20:32 ` Ben Myers
2011-12-18 20:00 ` [PATCH 03/11] xfs: remove the unused dm_attrs structure Christoph Hellwig
2012-01-04 21:13 ` Ben Myers
2011-12-18 20:00 ` [PATCH 04/11] xfs: remove the if_ext_max field in struct xfs_ifork Christoph Hellwig
2012-01-06 16:58 ` Ben Myers
2012-01-16 22:45 ` Ben Myers
2012-01-17 15:16 ` Ben Myers
2012-01-17 17:04 ` Mark Tinguely
2011-12-18 20:00 ` [PATCH 05/11] xfs: make i_flags an unsigned long Christoph Hellwig
2011-12-18 20:00 ` [PATCH 06/11] xfs: replace i_flock with a sleeping bitlock Christoph Hellwig
2012-01-13 21:49 ` Ben Myers [this message]
2011-12-18 20:00 ` [PATCH 07/11] xfs: replace i_pin_wait with a bit waitqueue Christoph Hellwig
2012-01-13 22:42 ` Ben Myers
2011-12-18 20:00 ` [PATCH 08/11] xfs: remove the i_size field in struct xfs_inode Christoph Hellwig
2012-01-16 18:32 ` Ben Myers
2012-01-16 19:45 ` Ben Myers
2011-12-18 20:00 ` [PATCH 09/11] xfs: remove the i_new_size " Christoph Hellwig
2011-12-18 22:13 ` Dave Chinner
2012-01-16 22:41 ` Ben Myers
2012-01-17 20:14 ` Ben Myers
2011-12-18 20:00 ` [PATCH 10/11] xfs: always return with the iolock held from xfs_file_aio_write_checks Christoph Hellwig
2012-01-17 20:18 ` Ben Myers
2012-01-20 12:51 ` Jeff Liu
2011-12-18 20:00 ` [PATCH 11/11] xfs: cleanup xfs_file_aio_write Christoph Hellwig
2012-01-17 20:42 ` Ben Myers
-- strict thread matches above, loose matches on Subject: below --
2011-12-08 15:57 [PATCH 00/11] inode shrink and misc updates Christoph Hellwig
2011-12-08 15:58 ` [PATCH 06/11] xfs: replace i_flock with a sleeping bitlock Christoph Hellwig
2011-12-13 22:19 ` Dave Chinner
2011-12-18 18:11 ` Christoph Hellwig
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=20120113214941.GA16386@sgi.com \
--to=bpm@sgi.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 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.