From: Dave Chinner <david@fromorbit.com>
To: Christoph Hellwig <hch@infradead.org>
Cc: xfs@oss.sgi.com
Subject: Re: [PATCH 4/5] xfs: push the ilock into xfs_zero_eof
Date: Tue, 27 Mar 2012 12:15:40 +1100 [thread overview]
Message-ID: <20120327011540.GS5091@dastard> (raw)
In-Reply-To: <20120326211603.654869525@bombadil.infradead.org>
On Mon, Mar 26, 2012 at 05:14:25PM -0400, Christoph Hellwig wrote:
> Instead of calling xfs_zero_eof with the ilock held only take it internally
> for the minimall required critical section around xfs_bmapi_read. This
> also requires changing the calling convention for xfs_zero_last_block
> slightly. The actual zeroing operation is still serialized by the iolock,
> which must be taken exclusively over the call to xfs_zero_eof.
>
> Signed-off-by: Christoph Hellwig <hch@lst.de>
.....
> + struct xfs_mount *mp = ip->i_mount;
> + xfs_fileoff_t last_fsb = XFS_B_TO_FSBT(mp, isize);
> + int zero_offset = XFS_B_FSB_OFFSET(mp, isize);
> + int zero_len;
> + int nimaps = 1;
> + int error = 0;
> + struct xfs_bmbt_irec imap;
>
> - last_fsb = XFS_B_TO_FSBT(mp, isize);
> - nimaps = 1;
> + xfs_ilock(ip, XFS_ILOCK_EXCL);
> error = xfs_bmapi_read(ip, last_fsb, 1, &imap, &nimaps, 0);
> + xfs_iunlock(ip, XFS_ILOCK_EXCL);
Does that even need to be an exclusive lock? a shared lock is all
that is needed to do a lookup, and this is just a lookup...
....
> @@ -521,23 +503,18 @@ xfs_zero_eof(
> while (start_zero_fsb <= end_zero_fsb) {
> nimaps = 1;
> zero_count_fsb = end_zero_fsb - start_zero_fsb + 1;
> +
> + xfs_ilock(ip, XFS_ILOCK_EXCL);
> error = xfs_bmapi_read(ip, start_zero_fsb, zero_count_fsb,
> &imap, &nimaps, 0);
> - if (error) {
> - ASSERT(xfs_isilocked(ip, XFS_ILOCK_EXCL|XFS_IOLOCK_EXCL));
> + xfs_iunlock(ip, XFS_ILOCK_EXCL);
Same question - it is a read lookup so why do we need exclusive
locking here?
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-03-27 1:15 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-03-26 21:14 [PATCH 0/5] reduce exclusive ilock hold times Christoph Hellwig
2012-03-26 21:14 ` [PATCH 1/5] xfs: avoid taking the ilock unnessecarily in xfs_qm_dqattach Christoph Hellwig
2012-03-26 22:13 ` Dave Chinner
2012-03-26 21:14 ` [PATCH 2/5] xfs: reduce ilock hold times in xfs_file_aio_write_checks Christoph Hellwig
2012-03-26 22:15 ` Dave Chinner
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
2012-03-26 21:14 ` [PATCH 4/5] xfs: push the ilock into xfs_zero_eof Christoph Hellwig
2012-03-27 1:15 ` Dave Chinner [this message]
2012-03-27 5:48 ` Christoph Hellwig
2012-03-27 6:11 ` Dave Chinner
2012-03-26 21:14 ` [PATCH 5/5] xfs: use shared ilock mode for direct IO writes by default Christoph Hellwig
2012-03-27 1:39 ` Dave Chinner
2012-03-27 6:08 ` [PATCH 0/5] reduce exclusive ilock hold times Dave Chinner
-- strict thread matches above, loose matches on Subject: below --
2012-03-27 14:34 [PATCH 0/5] reduce exclusive ilock hold times V2 Christoph Hellwig
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
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=20120327011540.GS5091@dastard \
--to=david@fromorbit.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