From: Christoph Hellwig <hch@infradead.org>
To: Dave Chinner <david@fromorbit.com>
Cc: Christoph Hellwig <hch@infradead.org>, xfs@oss.sgi.com
Subject: Re: [PATCH 2/4] xfs: replace i_flock with a sleeping bitlock
Date: Wed, 19 Oct 2011 05:01:06 -0400 [thread overview]
Message-ID: <20111019090105.GB6708@infradead.org> (raw)
In-Reply-To: <20111019004206.GB21338@dastard>
On Wed, Oct 19, 2011 at 11:42:06AM +1100, Dave Chinner wrote:
> > +void
> > +__xfs_iflock(
> > + struct xfs_inode *ip)
> > +{
> > + wait_queue_head_t *wq = bit_waitqueue(&ip->i_flags, __XFS_IFLOCK);
> > + DEFINE_WAIT_BIT(wait, &ip->i_flags, __XFS_IFLOCK);
> > +
> > + do {
> > + prepare_to_wait_exclusive(wq, &wait.wait, TASK_UNINTERRUPTIBLE);
> > + if (xfs_isiflocked(ip))
> > + schedule();
> > + } while (!xfs_iflock_nowait(ip));
> > +
> > + finish_wait(wq, &wait.wait);
> > +}
>
> Given that the only way that the inode will become unlocked is for
> IO to complete, that makes this an IO wait, right? Perhaps this
> should call io_schedule() in that case?
It probably should, and would help a bit with our %iowait accounting.
The biggie for that is the buffer lock, though. Either we'll need
a variant of the semaphore that does io_schedule, which is probably
unlikely to get given that the grater gods want struct semaphore to die.
Or we'll need to do the same bitlock trick there, even if we're not too
worried about struct xfs_buf size - in fact that his how fs/buffer.c
gets the iowait accounting right.
> > @@ -380,6 +372,8 @@ static inline void xfs_ifunlock(xfs_inod
> > #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_IFLOCK 8 /* inode is beeing flushed right now */
> > +#define XFS_IFLOCK (1 << __XFS_IFLOCK)
>
> Any reason for leaving a gap in the flag space here?
I can't remember. But looking at it again it might be a good idea
to convert the other flags to the (1 << bit) scheme to make the
number more obvious.
_______________________________________________
xfs mailing list
xfs@oss.sgi.com
http://oss.sgi.com/mailman/listinfo/xfs
next prev parent reply other threads:[~2011-10-19 9:01 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-10-18 20:13 [PATCH 0/4] inode diet, part1 Christoph Hellwig
2011-10-18 20:13 ` [PATCH 1/4] xfs: make i_flags and unsigned long Christoph Hellwig
2011-10-19 0:30 ` Dave Chinner
2011-10-19 8:57 ` Christoph Hellwig
2011-10-18 20:13 ` [PATCH 2/4] xfs: replace i_flock with a sleeping bitlock Christoph Hellwig
2011-10-19 0:42 ` Dave Chinner
2011-10-19 9:01 ` Christoph Hellwig [this message]
2011-10-18 20:13 ` [PATCH 3/4] xfs: replace i_pin_wait with a bit waitqueue Christoph Hellwig
2011-10-19 0:50 ` Dave Chinner
2011-10-18 20:13 ` [PATCH 4/4] xfs: remove the unused dm_attrs structure Christoph Hellwig
2011-10-19 0:50 ` Dave Chinner
-- strict thread matches above, loose matches on Subject: below --
2011-10-19 18:23 [PATCH 0/4] inode diet, part1 V2 Christoph Hellwig
2011-10-19 18:23 ` [PATCH 2/4] xfs: replace i_flock with a sleeping bitlock Christoph Hellwig
2011-10-26 21:07 ` Alex Elder
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=20111019090105.GB6708@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