Merge branch 'for-2.6.39/core' of git://git.kernel.dk/linux-2.6-block
[GitHub/mt8127/android_kernel_alcatel_ttab.git] / fs / gfs2 / log.c
index 7f1c1120234245ef91ccf3fb3b5db7b428dad0ad..5b102c1887fd92ffd9b1c14dc01458f112736973 100644 (file)
@@ -67,7 +67,7 @@ unsigned int gfs2_struct2blk(struct gfs2_sbd *sdp, unsigned int nstruct,
  * @mapping: The associated mapping (maybe NULL)
  * @bd: The gfs2_bufdata to remove
  *
- * The log lock _must_ be held when calling this function
+ * The ail lock _must_ be held when calling this function
  *
  */
 
@@ -88,8 +88,8 @@ void gfs2_remove_from_ail(struct gfs2_bufdata *bd)
  */
 
 static void gfs2_ail1_start_one(struct gfs2_sbd *sdp, struct gfs2_ail *ai)
-__releases(&sdp->sd_log_lock)
-__acquires(&sdp->sd_log_lock)
+__releases(&sdp->sd_ail_lock)
+__acquires(&sdp->sd_ail_lock)
 {
        struct gfs2_bufdata *bd, *s;
        struct buffer_head *bh;
@@ -117,7 +117,7 @@ __acquires(&sdp->sd_log_lock)
                        list_move(&bd->bd_ail_st_list, &ai->ai_ail1_list);
 
                        get_bh(bh);
-                       gfs2_log_unlock(sdp);
+                       spin_unlock(&sdp->sd_ail_lock);
                        lock_buffer(bh);
                        if (test_clear_buffer_dirty(bh)) {
                                bh->b_end_io = end_buffer_write_sync;
@@ -126,7 +126,7 @@ __acquires(&sdp->sd_log_lock)
                                unlock_buffer(bh);
                                brelse(bh);
                        }
-                       gfs2_log_lock(sdp);
+                       spin_lock(&sdp->sd_ail_lock);
 
                        retry = 1;
                        break;
@@ -175,10 +175,10 @@ static void gfs2_ail1_start(struct gfs2_sbd *sdp)
        struct gfs2_ail *ai;
        int done = 0;
 
-       gfs2_log_lock(sdp);
+       spin_lock(&sdp->sd_ail_lock);
        head = &sdp->sd_ail1_list;
        if (list_empty(head)) {
-               gfs2_log_unlock(sdp);
+               spin_unlock(&sdp->sd_ail_lock);
                return;
        }
        sync_gen = sdp->sd_ail_sync_gen++;
@@ -189,13 +189,13 @@ static void gfs2_ail1_start(struct gfs2_sbd *sdp)
                        if (ai->ai_sync_gen >= sync_gen)
                                continue;
                        ai->ai_sync_gen = sync_gen;
-                       gfs2_ail1_start_one(sdp, ai); /* This may drop log lock */
+                       gfs2_ail1_start_one(sdp, ai); /* This may drop ail lock */
                        done = 0;
                        break;
                }
        }
 
-       gfs2_log_unlock(sdp);
+       spin_unlock(&sdp->sd_ail_lock);
 }
 
 static int gfs2_ail1_empty(struct gfs2_sbd *sdp, int flags)
@@ -203,7 +203,7 @@ static int gfs2_ail1_empty(struct gfs2_sbd *sdp, int flags)
        struct gfs2_ail *ai, *s;
        int ret;
 
-       gfs2_log_lock(sdp);
+       spin_lock(&sdp->sd_ail_lock);
 
        list_for_each_entry_safe_reverse(ai, s, &sdp->sd_ail1_list, ai_list) {
                if (gfs2_ail1_empty_one(sdp, ai, flags))
@@ -214,7 +214,7 @@ static int gfs2_ail1_empty(struct gfs2_sbd *sdp, int flags)
 
        ret = list_empty(&sdp->sd_ail1_list);
 
-       gfs2_log_unlock(sdp);
+       spin_unlock(&sdp->sd_ail_lock);
 
        return ret;
 }
@@ -247,7 +247,7 @@ static void ail2_empty(struct gfs2_sbd *sdp, unsigned int new_tail)
        int wrap = (new_tail < old_tail);
        int a, b, rm;
 
-       gfs2_log_lock(sdp);
+       spin_lock(&sdp->sd_ail_lock);
 
        list_for_each_entry_safe(ai, safe, &sdp->sd_ail2_list, ai_list) {
                a = (old_tail <= ai->ai_first);
@@ -263,7 +263,7 @@ static void ail2_empty(struct gfs2_sbd *sdp, unsigned int new_tail)
                kfree(ai);
        }
 
-       gfs2_log_unlock(sdp);
+       spin_unlock(&sdp->sd_ail_lock);
 }
 
 /**
@@ -421,7 +421,7 @@ static unsigned int current_tail(struct gfs2_sbd *sdp)
        struct gfs2_ail *ai;
        unsigned int tail;
 
-       gfs2_log_lock(sdp);
+       spin_lock(&sdp->sd_ail_lock);
 
        if (list_empty(&sdp->sd_ail1_list)) {
                tail = sdp->sd_log_head;
@@ -430,7 +430,7 @@ static unsigned int current_tail(struct gfs2_sbd *sdp)
                tail = ai->ai_first;
        }
 
-       gfs2_log_unlock(sdp);
+       spin_unlock(&sdp->sd_ail_lock);
 
        return tail;
 }
@@ -743,10 +743,12 @@ void gfs2_log_flush(struct gfs2_sbd *sdp, struct gfs2_glock *gl)
        sdp->sd_log_commited_databuf = 0;
        sdp->sd_log_commited_revoke = 0;
 
+       spin_lock(&sdp->sd_ail_lock);
        if (!list_empty(&ai->ai_ail1_list)) {
                list_add(&ai->ai_list, &sdp->sd_ail1_list);
                ai = NULL;
        }
+       spin_unlock(&sdp->sd_ail_lock);
        gfs2_log_unlock(sdp);
        trace_gfs2_log_flush(sdp, 0);
        up_write(&sdp->sd_log_flush_lock);