Skip to content

Commit 6b46a06

Browse files
author
Andreas Gruenbacher
committed
gfs2: Remove support for glock holder auto-demotion (2)
As a follow-up to the previous commit, move the recovery related code in __gfs2_glock_dq() to gfs2_glock_dq() where it better fits. No functional change. Signed-off-by: Andreas Gruenbacher <[email protected]>
1 parent ba3e77a commit 6b46a06

File tree

1 file changed

+20
-19
lines changed

1 file changed

+20
-19
lines changed

fs/gfs2/glock.c

Lines changed: 20 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1590,28 +1590,9 @@ static inline bool needs_demote(struct gfs2_glock *gl)
15901590
static void __gfs2_glock_dq(struct gfs2_holder *gh)
15911591
{
15921592
struct gfs2_glock *gl = gh->gh_gl;
1593-
struct gfs2_sbd *sdp = gl->gl_name.ln_sbd;
15941593
unsigned delay = 0;
15951594
int fast_path = 0;
15961595

1597-
/*
1598-
* If we're in the process of file system withdraw, we cannot just
1599-
* dequeue any glocks until our journal is recovered, lest we introduce
1600-
* file system corruption. We need two exceptions to this rule: We need
1601-
* to allow unlocking of nondisk glocks and the glock for our own
1602-
* journal that needs recovery.
1603-
*/
1604-
if (test_bit(SDF_WITHDRAW_RECOVERY, &sdp->sd_flags) &&
1605-
glock_blocked_by_withdraw(gl) &&
1606-
gh->gh_gl != sdp->sd_jinode_gl) {
1607-
sdp->sd_glock_dqs_held++;
1608-
spin_unlock(&gl->gl_lockref.lock);
1609-
might_sleep();
1610-
wait_on_bit(&sdp->sd_flags, SDF_WITHDRAW_RECOVERY,
1611-
TASK_UNINTERRUPTIBLE);
1612-
spin_lock(&gl->gl_lockref.lock);
1613-
}
1614-
16151596
/*
16161597
* This holder should not be cached, so mark it for demote.
16171598
* Note: this should be done before the check for needs_demote
@@ -1654,6 +1635,7 @@ static void __gfs2_glock_dq(struct gfs2_holder *gh)
16541635
void gfs2_glock_dq(struct gfs2_holder *gh)
16551636
{
16561637
struct gfs2_glock *gl = gh->gh_gl;
1638+
struct gfs2_sbd *sdp = gl->gl_name.ln_sbd;
16571639

16581640
spin_lock(&gl->gl_lockref.lock);
16591641
if (!gfs2_holder_queued(gh)) {
@@ -1663,6 +1645,7 @@ void gfs2_glock_dq(struct gfs2_holder *gh)
16631645
*/
16641646
goto out;
16651647
}
1648+
16661649
if (list_is_first(&gh->gh_list, &gl->gl_holders) &&
16671650
!test_bit(HIF_HOLDER, &gh->gh_iflags)) {
16681651
spin_unlock(&gl->gl_lockref.lock);
@@ -1671,6 +1654,24 @@ void gfs2_glock_dq(struct gfs2_holder *gh)
16711654
spin_lock(&gl->gl_lockref.lock);
16721655
}
16731656

1657+
/*
1658+
* If we're in the process of file system withdraw, we cannot just
1659+
* dequeue any glocks until our journal is recovered, lest we introduce
1660+
* file system corruption. We need two exceptions to this rule: We need
1661+
* to allow unlocking of nondisk glocks and the glock for our own
1662+
* journal that needs recovery.
1663+
*/
1664+
if (test_bit(SDF_WITHDRAW_RECOVERY, &sdp->sd_flags) &&
1665+
glock_blocked_by_withdraw(gl) &&
1666+
gh->gh_gl != sdp->sd_jinode_gl) {
1667+
sdp->sd_glock_dqs_held++;
1668+
spin_unlock(&gl->gl_lockref.lock);
1669+
might_sleep();
1670+
wait_on_bit(&sdp->sd_flags, SDF_WITHDRAW_RECOVERY,
1671+
TASK_UNINTERRUPTIBLE);
1672+
spin_lock(&gl->gl_lockref.lock);
1673+
}
1674+
16741675
__gfs2_glock_dq(gh);
16751676
out:
16761677
spin_unlock(&gl->gl_lockref.lock);

0 commit comments

Comments
 (0)