From: Christoph Hellwig <hch@infradead.org>
To: Dave Chinner <david@fromorbit.com>
Cc: xfs@oss.sgi.com
Subject: [PATCH 5/3] xfs: return unlocked dquots from xfs_qm_dqqet
Date: Fri, 13 Dec 2013 08:30:09 -0800 [thread overview]
Message-ID: <20131213163009.GA20803@infradead.org> (raw)
In-Reply-To: <1386841258-22183-1-git-send-email-david@fromorbit.com>
We generally don't need the dquot structure locked for the fast path
operations, and we don't need the lock during lookup either.
Signed-off-by: Christoph Hellwig <hch@lst.de>
diff --git a/fs/xfs/xfs_dquot.c b/fs/xfs/xfs_dquot.c
index f17350d..7da4097 100644
--- a/fs/xfs/xfs_dquot.c
+++ b/fs/xfs/xfs_dquot.c
@@ -689,8 +689,9 @@ error0:
}
/*
- * Given the file system, inode OR id, and type (UDQUOT/GDQUOT), return a
- * a locked dquot, doing an allocation (if requested) as needed.
+ * Given the file system, id, type and optionally inode, return a an unlocked
+ * dquot, doing an allocation if requested and needed.
+ *
* When both an inode and an id are given, the inode's id takes precedence.
* That is, if the id changes while we don't hold the ilock inside this
* function, the new dquot is returned, not necessarily the one requested
@@ -739,9 +740,7 @@ restart:
mutex_lock(&qi->qi_tree_lock);
dqp = radix_tree_lookup(tree, id);
if (dqp) {
- xfs_dqlock(dqp);
if (dqp->dq_flags & XFS_DQ_FREEING) {
- xfs_dqunlock(dqp);
mutex_unlock(&qi->qi_tree_lock);
trace_xfs_dqget_freeing(dqp);
delay(1);
@@ -824,7 +823,6 @@ restart:
/*
* We return a locked, referenced dquot to the caller.
*/
- xfs_dqlock(dqp);
qi->qi_dquots++;
mutex_unlock(&qi->qi_tree_lock);
diff --git a/fs/xfs/xfs_qm.c b/fs/xfs/xfs_qm.c
index 843ab07..985b583 100644
--- a/fs/xfs/xfs_qm.c
+++ b/fs/xfs/xfs_qm.c
@@ -395,7 +395,6 @@ xfs_qm_dqattach_one(
* that the dquot returned is the one that should go in the inode.
*/
*IO_idqpp = dqp;
- xfs_dqunlock(dqp);
return 0;
}
@@ -1142,6 +1141,8 @@ xfs_qm_quotacheck_dqadjust(
trace_xfs_dqadjust(dqp);
+ xfs_dqlock(dqp);
+
/*
* Adjust the inode count and the block count to reflect this inode's
* resource usage.
@@ -1679,10 +1680,6 @@ xfs_qm_vop_dqalloc(
ASSERT(error != ENOENT);
return error;
}
- /*
- * Get the ilock in the right order.
- */
- xfs_dqunlock(uq);
lockflags = XFS_ILOCK_SHARED;
xfs_ilock(ip, lockflags);
} else {
@@ -1706,7 +1703,6 @@ xfs_qm_vop_dqalloc(
ASSERT(error != ENOENT);
goto error_rele;
}
- xfs_dqunlock(gq);
lockflags = XFS_ILOCK_SHARED;
xfs_ilock(ip, lockflags);
} else {
@@ -1726,7 +1722,6 @@ xfs_qm_vop_dqalloc(
ASSERT(error != ENOENT);
goto error_rele;
}
- xfs_dqunlock(pq);
lockflags = XFS_ILOCK_SHARED;
xfs_ilock(ip, lockflags);
} else {
diff --git a/fs/xfs/xfs_qm_bhv.c b/fs/xfs/xfs_qm_bhv.c
index e9be63a..c8fda48 100644
--- a/fs/xfs/xfs_qm_bhv.c
+++ b/fs/xfs/xfs_qm_bhv.c
@@ -75,6 +75,7 @@ xfs_qm_statvfs(
xfs_dquot_t *dqp;
if (!xfs_qm_dqget(mp, NULL, xfs_get_projid(ip), XFS_DQ_PROJ, 0, &dqp)) {
+ xfs_dqlock(dqp);
xfs_fill_statvfs_from_dquot(statp, dqp);
xfs_qm_dqput(dqp);
}
diff --git a/fs/xfs/xfs_qm_syscalls.c b/fs/xfs/xfs_qm_syscalls.c
index 1e61cd4..94dadbe 100644
--- a/fs/xfs/xfs_qm_syscalls.c
+++ b/fs/xfs/xfs_qm_syscalls.c
@@ -617,7 +617,6 @@ xfs_qm_scall_setqlim(
ASSERT(error != ENOENT);
goto out_unlock;
}
- xfs_dqunlock(dqp);
tp = xfs_trans_alloc(mp, XFS_TRANS_QM_SETQLIM);
error = xfs_trans_reserve(tp, &M_RES(mp)->tr_qm_setqlim, 0, 0);
@@ -844,6 +843,8 @@ xfs_qm_scall_getquota(
if (error)
return error;
+ xfs_dqlock(dqp);
+
/*
* If everything's NULL, this dquot doesn't quite exist as far as
* our utility programs are concerned.
_______________________________________________
xfs mailing list
xfs@oss.sgi.com
http://oss.sgi.com/mailman/listinfo/xfs
prev parent reply other threads:[~2013-12-13 16:30 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-12-12 9:40 [PATCH 0/3] xfs: dquot modification scalability Dave Chinner
2013-12-12 9:40 ` [PATCH 1/3] xfs: remote dquot hints Dave Chinner
2013-12-12 18:33 ` Christoph Hellwig
2013-12-12 9:40 ` [PATCH 2/3] xfs: dquot refcounting by atomics Dave Chinner
2013-12-13 13:23 ` Christoph Hellwig
2013-12-12 9:40 ` [PATCH 3/3] xfs: xfs_trans_dqresv() can be made lockless Dave Chinner
2013-12-13 13:37 ` Christoph Hellwig
2013-12-16 0:11 ` Dave Chinner
2013-12-12 10:25 ` [PATCH 4/3] xfs: xfs_qm_dqrele mostly doesn't need locking Dave Chinner
2013-12-13 13:28 ` Christoph Hellwig
2013-12-13 21:30 ` Dave Chinner
2013-12-16 18:21 ` Christoph Hellwig
2013-12-13 16:30 ` Christoph Hellwig [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=20131213163009.GA20803@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