]> pilppa.org Git - linux-2.6-omap-h63xx.git/blobdiff - fs/gfs2/glock.c
[GFS2] Remove flags no longer required
[linux-2.6-omap-h63xx.git] / fs / gfs2 / glock.c
index a37efe4aae6f37d4812be6490e3379e129658c31..5fbd9d34ce230632463a9b50942a2c22c88427c6 100644 (file)
@@ -507,21 +507,12 @@ static int rq_mutex(struct gfs2_holder *gh)
 static int rq_promote(struct gfs2_holder *gh)
 {
        struct gfs2_glock *gl = gh->gh_gl;
-       struct gfs2_sbd *sdp = gl->gl_sbd;
 
        if (!relaxed_state_ok(gl->gl_state, gh->gh_state, gh->gh_flags)) {
                if (list_empty(&gl->gl_holders)) {
                        gl->gl_req_gh = gh;
                        set_bit(GLF_LOCK, &gl->gl_flags);
                        spin_unlock(&gl->gl_spin);
-
-                       if (atomic_read(&sdp->sd_reclaim_count) >
-                           gfs2_tune_get(sdp, gt_reclaim_limit) &&
-                           !(gh->gh_flags & LM_FLAG_PRIORITY)) {
-                               gfs2_reclaim_glock(sdp);
-                               gfs2_reclaim_glock(sdp);
-                       }
-
                        gfs2_glock_xmote_th(gh->gh_gl, gh);
                        spin_lock(&gl->gl_spin);
                }
@@ -567,7 +558,10 @@ static int rq_demote(struct gfs2_glock *gl)
                gfs2_demote_wake(gl);
                return 0;
        }
+
        set_bit(GLF_LOCK, &gl->gl_flags);
+       set_bit(GLF_DEMOTE_IN_PROGRESS, &gl->gl_flags);
+
        if (gl->gl_demote_state == LM_ST_UNLOCKED ||
            gl->gl_state != LM_ST_EXCLUSIVE) {
                spin_unlock(&gl->gl_spin);
@@ -576,7 +570,9 @@ static int rq_demote(struct gfs2_glock *gl)
                spin_unlock(&gl->gl_spin);
                gfs2_glock_xmote_th(gl, NULL);
        }
+
        spin_lock(&gl->gl_spin);
+       clear_bit(GLF_DEMOTE_IN_PROGRESS, &gl->gl_flags);
 
        return 0;
 }
@@ -598,23 +594,18 @@ static void run_queue(struct gfs2_glock *gl)
                if (!list_empty(&gl->gl_waiters1)) {
                        gh = list_entry(gl->gl_waiters1.next,
                                        struct gfs2_holder, gh_list);
-
-                       if (test_bit(HIF_MUTEX, &gh->gh_iflags))
-                               blocked = rq_mutex(gh);
-                       else
-                               gfs2_assert_warn(gl->gl_sbd, 0);
-
+                       blocked = rq_mutex(gh);
                } else if (test_bit(GLF_DEMOTE, &gl->gl_flags)) {
                        blocked = rq_demote(gl);
+                       if (gl->gl_waiters2 && !blocked) {
+                               set_bit(GLF_DEMOTE, &gl->gl_flags);
+                               gl->gl_demote_state = LM_ST_UNLOCKED;
+                       }
+                       gl->gl_waiters2 = 0;
                } else if (!list_empty(&gl->gl_waiters3)) {
                        gh = list_entry(gl->gl_waiters3.next,
                                        struct gfs2_holder, gh_list);
-
-                       if (test_bit(HIF_PROMOTE, &gh->gh_iflags))
-                               blocked = rq_promote(gh);
-                       else
-                               gfs2_assert_warn(gl->gl_sbd, 0);
-
+                       blocked = rq_promote(gh);
                } else
                        break;
 
@@ -635,7 +626,6 @@ static void gfs2_glmutex_lock(struct gfs2_glock *gl)
        struct gfs2_holder gh;
 
        gfs2_holder_init(gl, 0, 0, &gh);
-       set_bit(HIF_MUTEX, &gh.gh_iflags);
        if (test_and_set_bit(HIF_WAIT, &gh.gh_iflags))
                BUG();
 
@@ -722,7 +712,10 @@ static void handle_callback(struct gfs2_glock *gl, unsigned int state,
                }
        } else if (gl->gl_demote_state != LM_ST_UNLOCKED &&
                        gl->gl_demote_state != state) {
-               gl->gl_demote_state = LM_ST_UNLOCKED;
+               if (test_bit(GLF_DEMOTE_IN_PROGRESS,  &gl->gl_flags)) 
+                       gl->gl_waiters2 = 1;
+               else 
+                       gl->gl_demote_state = LM_ST_UNLOCKED;
        }
        spin_unlock(&gl->gl_spin);
 }
@@ -943,8 +936,8 @@ static void gfs2_glock_drop_th(struct gfs2_glock *gl)
        const struct gfs2_glock_operations *glops = gl->gl_ops;
        unsigned int ret;
 
-       if (glops->go_drop_th)
-               glops->go_drop_th(gl);
+       if (glops->go_xmote_th)
+               glops->go_xmote_th(gl);
 
        gfs2_assert_warn(sdp, test_bit(GLF_LOCK, &gl->gl_flags));
        gfs2_assert_warn(sdp, list_empty(&gl->gl_holders));
@@ -1156,8 +1149,6 @@ restart:
                return -EIO;
        }
 
-       set_bit(HIF_PROMOTE, &gh->gh_iflags);
-
        spin_lock(&gl->gl_spin);
        add_to_queue(gh);
        run_queue(gl);
@@ -1248,12 +1239,11 @@ void gfs2_glock_dq(struct gfs2_holder *gh)
        list_del_init(&gh->gh_list);
 
        if (list_empty(&gl->gl_holders)) {
-               spin_unlock(&gl->gl_spin);
-
-               if (glops->go_unlock)
+               if (glops->go_unlock) {
+                       spin_unlock(&gl->gl_spin);
                        glops->go_unlock(gh);
-
-               spin_lock(&gl->gl_spin);
+                       spin_lock(&gl->gl_spin);
+               }
                gl->gl_stamp = jiffies;
        }