From: Dave Chinner <david@fromorbit.com>
To: Ben Myers <bpm@sgi.com>
Cc: Christoph Hellwig <hch@infradead.org>, xfs@oss.sgi.com
Subject: Re: [PATCH 3/5] xfs: reduce ilock hold times in xfs_setattr_size
Date: Fri, 20 Apr 2012 08:43:57 +1000 [thread overview]
Message-ID: <20120419224357.GW6734@dastard> (raw)
In-Reply-To: <20120419210044.GF16881@sgi.com>
On Thu, Apr 19, 2012 at 04:00:44PM -0500, Ben Myers wrote:
> On Tue, Mar 27, 2012 at 10:34:48AM -0400, Christoph Hellwig wrote:
> > We do not need the ilock for most checks done in the beginning of
> > xfs_setattr_size. Replace the long critical section before starting the
> > transaction with a smaller one around xfs_zero_eof and an optional one
> > inside xfs_qm_dqattach that isn't entered unless using quotas. While
> > this isn't a big optimization for xfs_setattr_size itself it will allow
> > pushing the ilock into xfs_zero_eof itself later.
> >
> > Signed-off-by: Christoph Hellwig <hch@lst.de>
> >
> > ---
> > fs/xfs/xfs_iops.c | 14 +++++++-------
> > 1 file changed, 7 insertions(+), 7 deletions(-)
> >
> > Index: xfs/fs/xfs/xfs_iops.c
> > ===================================================================
> > --- xfs.orig/fs/xfs/xfs_iops.c 2012-03-26 15:17:47.088854526 +0200
> > +++ xfs/fs/xfs/xfs_iops.c 2012-03-26 15:17:57.265521382 +0200
> > @@ -700,7 +700,7 @@ xfs_setattr_size(
> > xfs_off_t oldsize, newsize;
> > struct xfs_trans *tp;
> > int error;
> > - uint lock_flags;
> > + uint lock_flags = 0;
> > uint commit_flags = 0;
> >
> > trace_xfs_setattr(ip);
> > @@ -720,10 +720,10 @@ xfs_setattr_size(
> > ATTR_MTIME_SET|ATTR_KILL_SUID|ATTR_KILL_SGID|
> > ATTR_KILL_PRIV|ATTR_TIMES_SET)) == 0);
> >
> > - lock_flags = XFS_ILOCK_EXCL;
> > - if (!(flags & XFS_ATTR_NOLOCK))
> > + if (!(flags & XFS_ATTR_NOLOCK)) {
> > lock_flags |= XFS_IOLOCK_EXCL;
> > - xfs_ilock(ip, lock_flags);
> > + xfs_ilock(ip, lock_flags);
> > + }
> >
> > oldsize = inode->i_size;
> > newsize = iattr->ia_size;
>
> Usually the ilock is taken to protect i_d.di_nextents.
I don't think it matters here - we hold the IO lock exclusive and
the inode size is 0 so there can be no writes in progress nor dirty
data to write back. Hence no allocation can occur, so the extent
count cannot change, either.
Cheers,
Dave.
--
Dave Chinner
david@fromorbit.com
_______________________________________________
xfs mailing list
xfs@oss.sgi.com
http://oss.sgi.com/mailman/listinfo/xfs
next prev parent reply other threads:[~2012-04-19 22:44 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-03-27 14:34 [PATCH 0/5] reduce exclusive ilock hold times V2 Christoph Hellwig
2012-03-27 14:34 ` [PATCH 1/5] xfs: avoid taking the ilock unnessecarily in xfs_qm_dqattach Christoph Hellwig
2012-04-02 19:24 ` Mark Tinguely
2012-03-27 14:34 ` [PATCH 2/5] xfs: reduce ilock hold times in xfs_file_aio_write_checks Christoph Hellwig
2012-04-02 19:26 ` Mark Tinguely
2012-04-19 20:30 ` Ben Myers
2012-03-27 14:34 ` [PATCH 3/5] xfs: reduce ilock hold times in xfs_setattr_size Christoph Hellwig
2012-04-02 19:26 ` Mark Tinguely
2012-04-19 21:00 ` Ben Myers
2012-04-19 22:43 ` Dave Chinner [this message]
2012-03-27 14:34 ` [PATCH 4/5] xfs: push the ilock into xfs_zero_eof Christoph Hellwig
2012-04-02 20:39 ` Mark Tinguely
2012-03-27 14:34 ` [PATCH 5/5] xfs: use shared ilock mode for direct IO writes by default Christoph Hellwig
2012-04-03 17:01 ` Mark Tinguely
2012-03-27 20:52 ` [PATCH 0/5] reduce exclusive ilock hold times V2 Dave Chinner
-- strict thread matches above, loose matches on Subject: below --
2012-03-26 21:14 [PATCH 0/5] reduce exclusive ilock hold times Christoph Hellwig
2012-03-26 21:14 ` [PATCH 3/5] xfs: reduce ilock hold times in xfs_setattr_size Christoph Hellwig
2012-03-26 22:17 ` 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=20120419224357.GW6734@dastard \
--to=david@fromorbit.com \
--cc=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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox