Skip to content

Commit 1714e85

Browse files
author
Andreas Gruenbacher
committed
gfs2: Rename LM_FLAG_{NOEXP -> RECOVER}
GFS sets the LM_FLAG_NOEXP flag on locking requests it makes during journal recovery, so rename the flag to LM_FLAG_RECOVER for improved code readability. Signed-off-by: Andreas Gruenbacher <agruenba@redhat.com>
1 parent fab27b4 commit 1714e85

6 files changed

Lines changed: 23 additions & 20 deletions

File tree

fs/gfs2/glock.c

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -692,7 +692,7 @@ __acquires(&gl->gl_lockref.lock)
692692
int ret;
693693

694694
if (target != LM_ST_UNLOCKED && glock_blocked_by_withdraw(gl) &&
695-
gh && !(gh->gh_flags & LM_FLAG_NOEXP))
695+
gh && !(gh->gh_flags & LM_FLAG_RECOVER))
696696
goto skip_inval;
697697

698698
GLOCK_BUG_ON(gl, gl->gl_state == target);
@@ -1550,7 +1550,7 @@ int gfs2_glock_nq(struct gfs2_holder *gh)
15501550
struct gfs2_glock *gl = gh->gh_gl;
15511551
int error;
15521552

1553-
if (glock_blocked_by_withdraw(gl) && !(gh->gh_flags & LM_FLAG_NOEXP))
1553+
if (glock_blocked_by_withdraw(gl) && !(gh->gh_flags & LM_FLAG_RECOVER))
15541554
return -EIO;
15551555

15561556
if (gh->gh_flags & GL_NOBLOCK) {
@@ -1575,7 +1575,7 @@ int gfs2_glock_nq(struct gfs2_holder *gh)
15751575
gh->gh_error = 0;
15761576
spin_lock(&gl->gl_lockref.lock);
15771577
add_to_queue(gh);
1578-
if (unlikely((LM_FLAG_NOEXP & gh->gh_flags) &&
1578+
if (unlikely((LM_FLAG_RECOVER & gh->gh_flags) &&
15791579
test_and_clear_bit(GLF_HAVE_FROZEN_REPLY, &gl->gl_flags))) {
15801580
set_bit(GLF_HAVE_REPLY, &gl->gl_flags);
15811581
gl->gl_lockref.count++;
@@ -1880,7 +1880,7 @@ void gfs2_glock_cb(struct gfs2_glock *gl, unsigned int state)
18801880
*
18811881
* Glocks are not frozen if (a) the result of the dlm operation is
18821882
* an error, (b) the locking operation was an unlock operation or
1883-
* (c) if there is a "noexp" flagged request anywhere in the queue
1883+
* (c) if there is a "recover" flagged request anywhere in the queue
18841884
*
18851885
* Returns: 1 if freezing should occur, 0 otherwise
18861886
*/
@@ -1897,7 +1897,7 @@ static int gfs2_should_freeze(const struct gfs2_glock *gl)
18971897
list_for_each_entry(gh, &gl->gl_holders, gh_list) {
18981898
if (test_bit(HIF_HOLDER, &gh->gh_iflags))
18991899
continue;
1900-
if (LM_FLAG_NOEXP & gh->gh_flags)
1900+
if (LM_FLAG_RECOVER & gh->gh_flags)
19011901
return 0;
19021902
}
19031903

@@ -2246,7 +2246,7 @@ static const char *hflags2str(char *buf, u16 flags, unsigned long iflags)
22462246
*p++ = 't';
22472247
if (flags & LM_FLAG_TRY_1CB)
22482248
*p++ = 'T';
2249-
if (flags & LM_FLAG_NOEXP)
2249+
if (flags & LM_FLAG_RECOVER)
22502250
*p++ = 'e';
22512251
if (flags & LM_FLAG_ANY)
22522252
*p++ = 'A';

fs/gfs2/glock.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -58,10 +58,10 @@ enum {
5858
* LM_FLAG_TRY_1CB
5959
* Send one blocking callback if TRY is set and the lock is not granted.
6060
*
61-
* LM_FLAG_NOEXP
61+
* LM_FLAG_RECOVER
6262
* GFS sets this flag on lock requests it makes while doing journal recovery.
63-
* These special requests should not be blocked due to the recovery like
64-
* ordinary locks would be.
63+
* While ordinary requests are blocked until the end of recovery, requests
64+
* with this flag set do proceed.
6565
*
6666
* LM_FLAG_ANY
6767
* A SHARED request may also be granted in DEFERRED, or a DEFERRED request may
@@ -80,7 +80,7 @@ enum {
8080

8181
#define LM_FLAG_TRY 0x0001
8282
#define LM_FLAG_TRY_1CB 0x0002
83-
#define LM_FLAG_NOEXP 0x0004
83+
#define LM_FLAG_RECOVER 0x0004
8484
#define LM_FLAG_ANY 0x0008
8585
#define LM_FLAG_NODE_SCOPE 0x0020
8686
#define GL_ASYNC 0x0040

fs/gfs2/ops_fstype.c

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -370,7 +370,7 @@ static int init_locking(struct gfs2_sbd *sdp, struct gfs2_holder *mount_gh,
370370
error = gfs2_glock_nq_num(sdp,
371371
GFS2_MOUNT_LOCK, &gfs2_nondisk_glops,
372372
LM_ST_EXCLUSIVE,
373-
LM_FLAG_NOEXP | GL_NOCACHE | GL_NOPID,
373+
LM_FLAG_RECOVER | GL_NOCACHE | GL_NOPID,
374374
mount_gh);
375375
if (error) {
376376
fs_err(sdp, "can't acquire mount glock: %d\n", error);
@@ -380,7 +380,7 @@ static int init_locking(struct gfs2_sbd *sdp, struct gfs2_holder *mount_gh,
380380
error = gfs2_glock_nq_num(sdp,
381381
GFS2_LIVE_LOCK, &gfs2_nondisk_glops,
382382
LM_ST_SHARED,
383-
LM_FLAG_NOEXP | GL_EXACT | GL_NOPID,
383+
LM_FLAG_RECOVER | GL_EXACT | GL_NOPID,
384384
&sdp->sd_live_gh);
385385
if (error) {
386386
fs_err(sdp, "can't acquire live glock: %d\n", error);
@@ -745,7 +745,8 @@ static int init_journal(struct gfs2_sbd *sdp, int undo)
745745
error = gfs2_glock_nq_num(sdp, sdp->sd_lockstruct.ls_jid,
746746
&gfs2_journal_glops,
747747
LM_ST_EXCLUSIVE,
748-
LM_FLAG_NOEXP | GL_NOCACHE | GL_NOPID,
748+
LM_FLAG_RECOVER |
749+
GL_NOCACHE | GL_NOPID,
749750
&sdp->sd_journal_gh);
750751
if (error) {
751752
fs_err(sdp, "can't acquire journal glock: %d\n", error);
@@ -755,7 +756,7 @@ static int init_journal(struct gfs2_sbd *sdp, int undo)
755756
ip = GFS2_I(sdp->sd_jdesc->jd_inode);
756757
sdp->sd_jinode_gl = ip->i_gl;
757758
error = gfs2_glock_nq_init(ip->i_gl, LM_ST_SHARED,
758-
LM_FLAG_NOEXP | GL_EXACT |
759+
LM_FLAG_RECOVER | GL_EXACT |
759760
GL_NOCACHE | GL_NOPID,
760761
&sdp->sd_jinode_gh);
761762
if (error) {

fs/gfs2/recovery.c

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -424,7 +424,8 @@ void gfs2_recover_func(struct work_struct *work)
424424

425425
error = gfs2_glock_nq_num(sdp, jd->jd_jid, &gfs2_journal_glops,
426426
LM_ST_EXCLUSIVE,
427-
LM_FLAG_NOEXP | LM_FLAG_TRY | GL_NOCACHE,
427+
LM_FLAG_RECOVER | LM_FLAG_TRY |
428+
GL_NOCACHE,
428429
&j_gh);
429430
switch (error) {
430431
case 0:
@@ -440,7 +441,8 @@ void gfs2_recover_func(struct work_struct *work)
440441
}
441442

442443
error = gfs2_glock_nq_init(ip->i_gl, LM_ST_SHARED,
443-
LM_FLAG_NOEXP | GL_NOCACHE, &ji_gh);
444+
LM_FLAG_RECOVER | GL_NOCACHE,
445+
&ji_gh);
444446
if (error)
445447
goto fail_gunlock_j;
446448
} else {

fs/gfs2/super.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -351,7 +351,7 @@ static int gfs2_lock_fs_check_clean(struct gfs2_sbd *sdp)
351351
gfs2_freeze_unlock(sdp);
352352

353353
error = gfs2_glock_nq_init(sdp->sd_freeze_gl, LM_ST_EXCLUSIVE,
354-
LM_FLAG_NOEXP | GL_NOPID,
354+
LM_FLAG_RECOVER | GL_NOPID,
355355
&sdp->sd_freeze_gh);
356356
if (error)
357357
goto relock_shared;

fs/gfs2/util.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ int check_journal_clean(struct gfs2_sbd *sdp, struct gfs2_jdesc *jd,
5858
struct gfs2_inode *ip;
5959

6060
ip = GFS2_I(jd->jd_inode);
61-
error = gfs2_glock_nq_init(ip->i_gl, LM_ST_SHARED, LM_FLAG_NOEXP |
61+
error = gfs2_glock_nq_init(ip->i_gl, LM_ST_SHARED, LM_FLAG_RECOVER |
6262
GL_EXACT | GL_NOCACHE, &j_gh);
6363
if (error) {
6464
if (verbose)
@@ -99,7 +99,7 @@ int check_journal_clean(struct gfs2_sbd *sdp, struct gfs2_jdesc *jd,
9999
*/
100100
int gfs2_freeze_lock_shared(struct gfs2_sbd *sdp)
101101
{
102-
int flags = LM_FLAG_NOEXP | GL_EXACT;
102+
int flags = LM_FLAG_RECOVER | GL_EXACT;
103103
int error;
104104

105105
error = gfs2_glock_nq_init(sdp->sd_freeze_gl, LM_ST_SHARED, flags,
@@ -224,7 +224,7 @@ static void signal_our_withdraw(struct gfs2_sbd *sdp)
224224
fs_warn(sdp, "Requesting recovery of jid %d.\n",
225225
sdp->sd_lockstruct.ls_jid);
226226
gfs2_holder_reinit(LM_ST_EXCLUSIVE,
227-
LM_FLAG_TRY_1CB | LM_FLAG_NOEXP | GL_NOPID,
227+
LM_FLAG_TRY_1CB | LM_FLAG_RECOVER | GL_NOPID,
228228
&sdp->sd_live_gh);
229229
msleep(GL_GLOCK_MAX_HOLD);
230230
/*

0 commit comments

Comments
 (0)