Commit edeb180f authored by Andreas Gruenbacher's avatar Andreas Gruenbacher

gfs2: Rename handle_callback to request_demote

Function handle_callback() is used to request a glock demote.  This
often happens in response to a conflicting remote locking request and
subsequent bast callback from DLM, but there are other reasons for
triggering a demote request as well, such as when trying to release a
glock in response to memory pressure.  To clarify that, rename the
function to request_demote().
Signed-off-by: default avatarAndreas Gruenbacher <agruenba@redhat.com>
parent 1fb5f67e
...@@ -61,8 +61,8 @@ struct gfs2_glock_iter { ...@@ -61,8 +61,8 @@ struct gfs2_glock_iter {
typedef void (*glock_examiner) (struct gfs2_glock * gl); typedef void (*glock_examiner) (struct gfs2_glock * gl);
static void do_xmote(struct gfs2_glock *gl, struct gfs2_holder *gh, unsigned int target); static void do_xmote(struct gfs2_glock *gl, struct gfs2_holder *gh, unsigned int target);
static void handle_callback(struct gfs2_glock *gl, unsigned int state, static void request_demote(struct gfs2_glock *gl, unsigned int state,
unsigned long delay, bool remote); unsigned long delay, bool remote);
static struct dentry *gfs2_root; static struct dentry *gfs2_root;
static struct workqueue_struct *glock_workqueue; static struct workqueue_struct *glock_workqueue;
...@@ -811,7 +811,7 @@ __acquires(&gl->gl_lockref.lock) ...@@ -811,7 +811,7 @@ __acquires(&gl->gl_lockref.lock)
(target != LM_ST_UNLOCKED || (target != LM_ST_UNLOCKED ||
test_bit(SDF_WITHDRAW_RECOVERY, &sdp->sd_flags))) { test_bit(SDF_WITHDRAW_RECOVERY, &sdp->sd_flags))) {
if (!is_system_glock(gl)) { if (!is_system_glock(gl)) {
handle_callback(gl, LM_ST_UNLOCKED, 0, false); /* sets demote */ request_demote(gl, LM_ST_UNLOCKED, 0, false);
/* /*
* Ordinarily, we would call dlm and its callback would call * Ordinarily, we would call dlm and its callback would call
* finish_xmote, which would call state_change() to the new state. * finish_xmote, which would call state_change() to the new state.
...@@ -1459,7 +1459,7 @@ int gfs2_glock_async_wait(unsigned int num_gh, struct gfs2_holder *ghs) ...@@ -1459,7 +1459,7 @@ int gfs2_glock_async_wait(unsigned int num_gh, struct gfs2_holder *ghs)
} }
/** /**
* handle_callback - process a demote request * request_demote - process a demote request
* @gl: the glock * @gl: the glock
* @state: the state the caller wants us to change to * @state: the state the caller wants us to change to
* @delay: zero to demote immediately; otherwise pending demote * @delay: zero to demote immediately; otherwise pending demote
...@@ -1469,8 +1469,8 @@ int gfs2_glock_async_wait(unsigned int num_gh, struct gfs2_holder *ghs) ...@@ -1469,8 +1469,8 @@ int gfs2_glock_async_wait(unsigned int num_gh, struct gfs2_holder *ghs)
* practise: LM_ST_SHARED and LM_ST_UNLOCKED * practise: LM_ST_SHARED and LM_ST_UNLOCKED
*/ */
static void handle_callback(struct gfs2_glock *gl, unsigned int state, static void request_demote(struct gfs2_glock *gl, unsigned int state,
unsigned long delay, bool remote) unsigned long delay, bool remote)
{ {
if (delay) if (delay)
set_bit(GLF_PENDING_DEMOTE, &gl->gl_flags); set_bit(GLF_PENDING_DEMOTE, &gl->gl_flags);
...@@ -1686,7 +1686,7 @@ static void __gfs2_glock_dq(struct gfs2_holder *gh) ...@@ -1686,7 +1686,7 @@ static void __gfs2_glock_dq(struct gfs2_holder *gh)
* below. * below.
*/ */
if (gh->gh_flags & GL_NOCACHE) if (gh->gh_flags & GL_NOCACHE)
handle_callback(gl, LM_ST_UNLOCKED, 0, false); request_demote(gl, LM_ST_UNLOCKED, 0, false);
list_del_init(&gh->gh_list); list_del_init(&gh->gh_list);
clear_bit(HIF_HOLDER, &gh->gh_iflags); clear_bit(HIF_HOLDER, &gh->gh_iflags);
...@@ -1933,7 +1933,7 @@ void gfs2_glock_cb(struct gfs2_glock *gl, unsigned int state) ...@@ -1933,7 +1933,7 @@ void gfs2_glock_cb(struct gfs2_glock *gl, unsigned int state)
if (test_bit(GLF_HAVE_REPLY, &gl->gl_flags)) if (test_bit(GLF_HAVE_REPLY, &gl->gl_flags))
delay = gl->gl_hold_time; delay = gl->gl_hold_time;
} }
handle_callback(gl, state, delay, true); request_demote(gl, state, delay, true);
gfs2_glock_queue_work(gl, delay); gfs2_glock_queue_work(gl, delay);
spin_unlock(&gl->gl_lockref.lock); spin_unlock(&gl->gl_lockref.lock);
} }
...@@ -2062,7 +2062,7 @@ __acquires(&lru_lock) ...@@ -2062,7 +2062,7 @@ __acquires(&lru_lock)
freed++; freed++;
gl->gl_lockref.count++; gl->gl_lockref.count++;
if (demote_ok(gl)) if (demote_ok(gl))
handle_callback(gl, LM_ST_UNLOCKED, 0, false); request_demote(gl, LM_ST_UNLOCKED, 0, false);
gfs2_glock_queue_work(gl, 0); gfs2_glock_queue_work(gl, 0);
spin_unlock(&gl->gl_lockref.lock); spin_unlock(&gl->gl_lockref.lock);
cond_resched_lock(&lru_lock); cond_resched_lock(&lru_lock);
...@@ -2205,7 +2205,7 @@ static void clear_glock(struct gfs2_glock *gl) ...@@ -2205,7 +2205,7 @@ static void clear_glock(struct gfs2_glock *gl)
if (!__lockref_is_dead(&gl->gl_lockref)) { if (!__lockref_is_dead(&gl->gl_lockref)) {
gl->gl_lockref.count++; gl->gl_lockref.count++;
if (gl->gl_state != LM_ST_UNLOCKED) if (gl->gl_state != LM_ST_UNLOCKED)
handle_callback(gl, LM_ST_UNLOCKED, 0, false); request_demote(gl, LM_ST_UNLOCKED, 0, false);
gfs2_glock_queue_work(gl, 0); gfs2_glock_queue_work(gl, 0);
} }
spin_unlock(&gl->gl_lockref.lock); spin_unlock(&gl->gl_lockref.lock);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment