mirror of
https://github.com/torvalds/linux.git
synced 2025-12-07 20:06:24 +00:00
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>
This commit is contained in:
@@ -692,7 +692,7 @@ __acquires(&gl->gl_lockref.lock)
|
|||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
if (target != LM_ST_UNLOCKED && glock_blocked_by_withdraw(gl) &&
|
if (target != LM_ST_UNLOCKED && glock_blocked_by_withdraw(gl) &&
|
||||||
gh && !(gh->gh_flags & LM_FLAG_NOEXP))
|
gh && !(gh->gh_flags & LM_FLAG_RECOVER))
|
||||||
goto skip_inval;
|
goto skip_inval;
|
||||||
|
|
||||||
GLOCK_BUG_ON(gl, gl->gl_state == target);
|
GLOCK_BUG_ON(gl, gl->gl_state == target);
|
||||||
@@ -1550,7 +1550,7 @@ int gfs2_glock_nq(struct gfs2_holder *gh)
|
|||||||
struct gfs2_glock *gl = gh->gh_gl;
|
struct gfs2_glock *gl = gh->gh_gl;
|
||||||
int error;
|
int error;
|
||||||
|
|
||||||
if (glock_blocked_by_withdraw(gl) && !(gh->gh_flags & LM_FLAG_NOEXP))
|
if (glock_blocked_by_withdraw(gl) && !(gh->gh_flags & LM_FLAG_RECOVER))
|
||||||
return -EIO;
|
return -EIO;
|
||||||
|
|
||||||
if (gh->gh_flags & GL_NOBLOCK) {
|
if (gh->gh_flags & GL_NOBLOCK) {
|
||||||
@@ -1575,7 +1575,7 @@ unlock:
|
|||||||
gh->gh_error = 0;
|
gh->gh_error = 0;
|
||||||
spin_lock(&gl->gl_lockref.lock);
|
spin_lock(&gl->gl_lockref.lock);
|
||||||
add_to_queue(gh);
|
add_to_queue(gh);
|
||||||
if (unlikely((LM_FLAG_NOEXP & gh->gh_flags) &&
|
if (unlikely((LM_FLAG_RECOVER & gh->gh_flags) &&
|
||||||
test_and_clear_bit(GLF_HAVE_FROZEN_REPLY, &gl->gl_flags))) {
|
test_and_clear_bit(GLF_HAVE_FROZEN_REPLY, &gl->gl_flags))) {
|
||||||
set_bit(GLF_HAVE_REPLY, &gl->gl_flags);
|
set_bit(GLF_HAVE_REPLY, &gl->gl_flags);
|
||||||
gl->gl_lockref.count++;
|
gl->gl_lockref.count++;
|
||||||
@@ -1880,7 +1880,7 @@ void gfs2_glock_cb(struct gfs2_glock *gl, unsigned int state)
|
|||||||
*
|
*
|
||||||
* Glocks are not frozen if (a) the result of the dlm operation is
|
* Glocks are not frozen if (a) the result of the dlm operation is
|
||||||
* an error, (b) the locking operation was an unlock operation or
|
* an error, (b) the locking operation was an unlock operation or
|
||||||
* (c) if there is a "noexp" flagged request anywhere in the queue
|
* (c) if there is a "recover" flagged request anywhere in the queue
|
||||||
*
|
*
|
||||||
* Returns: 1 if freezing should occur, 0 otherwise
|
* Returns: 1 if freezing should occur, 0 otherwise
|
||||||
*/
|
*/
|
||||||
@@ -1897,7 +1897,7 @@ static int gfs2_should_freeze(const struct gfs2_glock *gl)
|
|||||||
list_for_each_entry(gh, &gl->gl_holders, gh_list) {
|
list_for_each_entry(gh, &gl->gl_holders, gh_list) {
|
||||||
if (test_bit(HIF_HOLDER, &gh->gh_iflags))
|
if (test_bit(HIF_HOLDER, &gh->gh_iflags))
|
||||||
continue;
|
continue;
|
||||||
if (LM_FLAG_NOEXP & gh->gh_flags)
|
if (LM_FLAG_RECOVER & gh->gh_flags)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -2246,7 +2246,7 @@ static const char *hflags2str(char *buf, u16 flags, unsigned long iflags)
|
|||||||
*p++ = 't';
|
*p++ = 't';
|
||||||
if (flags & LM_FLAG_TRY_1CB)
|
if (flags & LM_FLAG_TRY_1CB)
|
||||||
*p++ = 'T';
|
*p++ = 'T';
|
||||||
if (flags & LM_FLAG_NOEXP)
|
if (flags & LM_FLAG_RECOVER)
|
||||||
*p++ = 'e';
|
*p++ = 'e';
|
||||||
if (flags & LM_FLAG_ANY)
|
if (flags & LM_FLAG_ANY)
|
||||||
*p++ = 'A';
|
*p++ = 'A';
|
||||||
|
|||||||
@@ -58,10 +58,10 @@ enum {
|
|||||||
* LM_FLAG_TRY_1CB
|
* LM_FLAG_TRY_1CB
|
||||||
* Send one blocking callback if TRY is set and the lock is not granted.
|
* Send one blocking callback if TRY is set and the lock is not granted.
|
||||||
*
|
*
|
||||||
* LM_FLAG_NOEXP
|
* LM_FLAG_RECOVER
|
||||||
* GFS sets this flag on lock requests it makes while doing journal recovery.
|
* GFS sets this flag on lock requests it makes while doing journal recovery.
|
||||||
* These special requests should not be blocked due to the recovery like
|
* While ordinary requests are blocked until the end of recovery, requests
|
||||||
* ordinary locks would be.
|
* with this flag set do proceed.
|
||||||
*
|
*
|
||||||
* LM_FLAG_ANY
|
* LM_FLAG_ANY
|
||||||
* A SHARED request may also be granted in DEFERRED, or a DEFERRED request may
|
* A SHARED request may also be granted in DEFERRED, or a DEFERRED request may
|
||||||
@@ -80,7 +80,7 @@ enum {
|
|||||||
|
|
||||||
#define LM_FLAG_TRY 0x0001
|
#define LM_FLAG_TRY 0x0001
|
||||||
#define LM_FLAG_TRY_1CB 0x0002
|
#define LM_FLAG_TRY_1CB 0x0002
|
||||||
#define LM_FLAG_NOEXP 0x0004
|
#define LM_FLAG_RECOVER 0x0004
|
||||||
#define LM_FLAG_ANY 0x0008
|
#define LM_FLAG_ANY 0x0008
|
||||||
#define LM_FLAG_NODE_SCOPE 0x0020
|
#define LM_FLAG_NODE_SCOPE 0x0020
|
||||||
#define GL_ASYNC 0x0040
|
#define GL_ASYNC 0x0040
|
||||||
|
|||||||
@@ -370,7 +370,7 @@ static int init_locking(struct gfs2_sbd *sdp, struct gfs2_holder *mount_gh,
|
|||||||
error = gfs2_glock_nq_num(sdp,
|
error = gfs2_glock_nq_num(sdp,
|
||||||
GFS2_MOUNT_LOCK, &gfs2_nondisk_glops,
|
GFS2_MOUNT_LOCK, &gfs2_nondisk_glops,
|
||||||
LM_ST_EXCLUSIVE,
|
LM_ST_EXCLUSIVE,
|
||||||
LM_FLAG_NOEXP | GL_NOCACHE | GL_NOPID,
|
LM_FLAG_RECOVER | GL_NOCACHE | GL_NOPID,
|
||||||
mount_gh);
|
mount_gh);
|
||||||
if (error) {
|
if (error) {
|
||||||
fs_err(sdp, "can't acquire mount glock: %d\n", error);
|
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,
|
|||||||
error = gfs2_glock_nq_num(sdp,
|
error = gfs2_glock_nq_num(sdp,
|
||||||
GFS2_LIVE_LOCK, &gfs2_nondisk_glops,
|
GFS2_LIVE_LOCK, &gfs2_nondisk_glops,
|
||||||
LM_ST_SHARED,
|
LM_ST_SHARED,
|
||||||
LM_FLAG_NOEXP | GL_EXACT | GL_NOPID,
|
LM_FLAG_RECOVER | GL_EXACT | GL_NOPID,
|
||||||
&sdp->sd_live_gh);
|
&sdp->sd_live_gh);
|
||||||
if (error) {
|
if (error) {
|
||||||
fs_err(sdp, "can't acquire live glock: %d\n", error);
|
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)
|
|||||||
error = gfs2_glock_nq_num(sdp, sdp->sd_lockstruct.ls_jid,
|
error = gfs2_glock_nq_num(sdp, sdp->sd_lockstruct.ls_jid,
|
||||||
&gfs2_journal_glops,
|
&gfs2_journal_glops,
|
||||||
LM_ST_EXCLUSIVE,
|
LM_ST_EXCLUSIVE,
|
||||||
LM_FLAG_NOEXP | GL_NOCACHE | GL_NOPID,
|
LM_FLAG_RECOVER |
|
||||||
|
GL_NOCACHE | GL_NOPID,
|
||||||
&sdp->sd_journal_gh);
|
&sdp->sd_journal_gh);
|
||||||
if (error) {
|
if (error) {
|
||||||
fs_err(sdp, "can't acquire journal glock: %d\n", error);
|
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)
|
|||||||
ip = GFS2_I(sdp->sd_jdesc->jd_inode);
|
ip = GFS2_I(sdp->sd_jdesc->jd_inode);
|
||||||
sdp->sd_jinode_gl = ip->i_gl;
|
sdp->sd_jinode_gl = ip->i_gl;
|
||||||
error = gfs2_glock_nq_init(ip->i_gl, LM_ST_SHARED,
|
error = gfs2_glock_nq_init(ip->i_gl, LM_ST_SHARED,
|
||||||
LM_FLAG_NOEXP | GL_EXACT |
|
LM_FLAG_RECOVER | GL_EXACT |
|
||||||
GL_NOCACHE | GL_NOPID,
|
GL_NOCACHE | GL_NOPID,
|
||||||
&sdp->sd_jinode_gh);
|
&sdp->sd_jinode_gh);
|
||||||
if (error) {
|
if (error) {
|
||||||
|
|||||||
@@ -424,7 +424,8 @@ void gfs2_recover_func(struct work_struct *work)
|
|||||||
|
|
||||||
error = gfs2_glock_nq_num(sdp, jd->jd_jid, &gfs2_journal_glops,
|
error = gfs2_glock_nq_num(sdp, jd->jd_jid, &gfs2_journal_glops,
|
||||||
LM_ST_EXCLUSIVE,
|
LM_ST_EXCLUSIVE,
|
||||||
LM_FLAG_NOEXP | LM_FLAG_TRY | GL_NOCACHE,
|
LM_FLAG_RECOVER | LM_FLAG_TRY |
|
||||||
|
GL_NOCACHE,
|
||||||
&j_gh);
|
&j_gh);
|
||||||
switch (error) {
|
switch (error) {
|
||||||
case 0:
|
case 0:
|
||||||
@@ -440,7 +441,8 @@ void gfs2_recover_func(struct work_struct *work)
|
|||||||
}
|
}
|
||||||
|
|
||||||
error = gfs2_glock_nq_init(ip->i_gl, LM_ST_SHARED,
|
error = gfs2_glock_nq_init(ip->i_gl, LM_ST_SHARED,
|
||||||
LM_FLAG_NOEXP | GL_NOCACHE, &ji_gh);
|
LM_FLAG_RECOVER | GL_NOCACHE,
|
||||||
|
&ji_gh);
|
||||||
if (error)
|
if (error)
|
||||||
goto fail_gunlock_j;
|
goto fail_gunlock_j;
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
@@ -351,7 +351,7 @@ static int gfs2_lock_fs_check_clean(struct gfs2_sbd *sdp)
|
|||||||
gfs2_freeze_unlock(sdp);
|
gfs2_freeze_unlock(sdp);
|
||||||
|
|
||||||
error = gfs2_glock_nq_init(sdp->sd_freeze_gl, LM_ST_EXCLUSIVE,
|
error = gfs2_glock_nq_init(sdp->sd_freeze_gl, LM_ST_EXCLUSIVE,
|
||||||
LM_FLAG_NOEXP | GL_NOPID,
|
LM_FLAG_RECOVER | GL_NOPID,
|
||||||
&sdp->sd_freeze_gh);
|
&sdp->sd_freeze_gh);
|
||||||
if (error)
|
if (error)
|
||||||
goto relock_shared;
|
goto relock_shared;
|
||||||
|
|||||||
@@ -58,7 +58,7 @@ int check_journal_clean(struct gfs2_sbd *sdp, struct gfs2_jdesc *jd,
|
|||||||
struct gfs2_inode *ip;
|
struct gfs2_inode *ip;
|
||||||
|
|
||||||
ip = GFS2_I(jd->jd_inode);
|
ip = GFS2_I(jd->jd_inode);
|
||||||
error = gfs2_glock_nq_init(ip->i_gl, LM_ST_SHARED, LM_FLAG_NOEXP |
|
error = gfs2_glock_nq_init(ip->i_gl, LM_ST_SHARED, LM_FLAG_RECOVER |
|
||||||
GL_EXACT | GL_NOCACHE, &j_gh);
|
GL_EXACT | GL_NOCACHE, &j_gh);
|
||||||
if (error) {
|
if (error) {
|
||||||
if (verbose)
|
if (verbose)
|
||||||
@@ -99,7 +99,7 @@ out_unlock:
|
|||||||
*/
|
*/
|
||||||
int gfs2_freeze_lock_shared(struct gfs2_sbd *sdp)
|
int gfs2_freeze_lock_shared(struct gfs2_sbd *sdp)
|
||||||
{
|
{
|
||||||
int flags = LM_FLAG_NOEXP | GL_EXACT;
|
int flags = LM_FLAG_RECOVER | GL_EXACT;
|
||||||
int error;
|
int error;
|
||||||
|
|
||||||
error = gfs2_glock_nq_init(sdp->sd_freeze_gl, LM_ST_SHARED, flags,
|
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)
|
|||||||
fs_warn(sdp, "Requesting recovery of jid %d.\n",
|
fs_warn(sdp, "Requesting recovery of jid %d.\n",
|
||||||
sdp->sd_lockstruct.ls_jid);
|
sdp->sd_lockstruct.ls_jid);
|
||||||
gfs2_holder_reinit(LM_ST_EXCLUSIVE,
|
gfs2_holder_reinit(LM_ST_EXCLUSIVE,
|
||||||
LM_FLAG_TRY_1CB | LM_FLAG_NOEXP | GL_NOPID,
|
LM_FLAG_TRY_1CB | LM_FLAG_RECOVER | GL_NOPID,
|
||||||
&sdp->sd_live_gh);
|
&sdp->sd_live_gh);
|
||||||
msleep(GL_GLOCK_MAX_HOLD);
|
msleep(GL_GLOCK_MAX_HOLD);
|
||||||
/*
|
/*
|
||||||
|
|||||||
Reference in New Issue
Block a user