From: Bob Peterson <rpeterso@redhat.com>
To: cluster-devel.redhat.com
Subject: [Cluster-devel] [GFS2 PATCH] GFS2: don't bother to ask DLM for try locks we know will fail
Date: Wed, 17 Oct 2012 13:39:54 -0400 (EDT) [thread overview]
Message-ID: <1185915495.19794272.1350495594979.JavaMail.root@redhat.com> (raw)
Hi,
While search for a suitable resource group, this patch checks the
glock holders queue for exclusive holders. If it finds any, it
doesn't bother queueing up the TRY lock only to waste time having
DLM shoot it down in favor of the other.
Regards,
Bob Peterson
Red Hat File Systems
Signed-off-by: Bob Peterson <rpeterso@redhat.com>
---
diff --git a/fs/gfs2/rgrp.c b/fs/gfs2/rgrp.c
index 7635500..77400b0 100644
--- a/fs/gfs2/rgrp.c
+++ b/fs/gfs2/rgrp.c
@@ -1694,6 +1694,7 @@ int gfs2_inplace_reserve(struct gfs2_inode *ip, u32 requested)
struct gfs2_sbd *sdp = GFS2_SB(&ip->i_inode);
struct gfs2_rgrpd *begin = NULL;
struct gfs2_blkreserv *rs = ip->i_res;
+ struct gfs2_holder *ogh;
int error = 0, rg_locked, flags = LM_FLAG_TRY;
u64 last_unlinked = NO_BLOCK;
int loops = 0;
@@ -1718,6 +1719,22 @@ int gfs2_inplace_reserve(struct gfs2_inode *ip, u32 requested)
if (!gfs2_glock_is_locked_by_me(rs->rs_rbm.rgd->rd_gl)) {
rg_locked = 0;
+ if (flags == LM_FLAG_TRY) {
+ spin_lock(&rs->rs_rbm.rgd->rd_gl->gl_spin);
+ /* Check to see if there's another EX request
+ on the holders queue. If so, it's pointless
+ for us to try (they'll get it first). */
+ list_for_each_entry(ogh,
+ &rs->rs_rbm.rgd->rd_gl->gl_holders,
+ gh_list) {
+ if (ogh->gh_state == LM_ST_EXCLUSIVE) {
+ spin_unlock(&rs->rs_rbm.rgd->
+ rd_gl->gl_spin);
+ goto next_rgrp;
+ }
+ }
+ spin_unlock(&rs->rs_rbm.rgd->rd_gl->gl_spin);
+ }
error = gfs2_glock_nq_init(rs->rs_rbm.rgd->rd_gl,
LM_ST_EXCLUSIVE, flags,
&rs->rs_rgd_gh);
reply other threads:[~2012-10-17 17:39 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=1185915495.19794272.1350495594979.JavaMail.root@redhat.com \
--to=rpeterso@redhat.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;
as well as URLs for NNTP newsgroup(s).