]> asedeno.scripts.mit.edu Git - linux.git/blobdiff - fs/gfs2/lops.c
gfs2: Remove unnecessary extern declarations
[linux.git] / fs / gfs2 / lops.c
index 2295042bc6259887c87bfcb786e5d4bfc511662c..6c1ec6c6063929ef746ab3a914331b4537b78921 100644 (file)
@@ -168,7 +168,8 @@ u64 gfs2_log_bmap(struct gfs2_sbd *sdp)
  * that is pinned in the pagecache.
  */
 
-static void gfs2_end_log_write_bh(struct gfs2_sbd *sdp, struct bio_vec *bvec,
+static void gfs2_end_log_write_bh(struct gfs2_sbd *sdp,
+                                 struct bio_vec *bvec,
                                  blk_status_t error)
 {
        struct buffer_head *bh, *next;
@@ -207,6 +208,7 @@ static void gfs2_end_log_write(struct bio *bio)
        struct bio_vec *bvec;
        struct page *page;
        int i;
+       struct bvec_iter_all iter_all;
 
        if (bio->bi_status) {
                fs_err(sdp, "Error %d writing to journal, jid=%u\n",
@@ -214,7 +216,7 @@ static void gfs2_end_log_write(struct bio *bio)
                wake_up(&sdp->sd_logd_waitq);
        }
 
-       bio_for_each_segment_all(bvec, bio, i) {
+       bio_for_each_segment_all(bvec, bio, i, iter_all) {
                page = bvec->bv_page;
                if (page_has_buffers(page))
                        gfs2_end_log_write_bh(sdp, bvec, bio->bi_status);
@@ -528,7 +530,7 @@ static void buf_lo_before_scan(struct gfs2_jdesc *jd,
        jd->jd_replayed_blocks = 0;
 }
 
-static int buf_lo_scan_elements(struct gfs2_jdesc *jd, unsigned int start,
+static int buf_lo_scan_elements(struct gfs2_jdesc *jd, u32 start,
                                struct gfs2_log_descriptor *ld, __be64 *ptr,
                                int pass)
 {
@@ -660,17 +662,34 @@ static void revoke_lo_before_commit(struct gfs2_sbd *sdp, struct gfs2_trans *tr)
 static void revoke_lo_after_commit(struct gfs2_sbd *sdp, struct gfs2_trans *tr)
 {
        struct list_head *head = &sdp->sd_log_le_revoke;
-       struct gfs2_bufdata *bd;
-       struct gfs2_glock *gl;
+       struct gfs2_bufdata *bd, *tmp;
 
-       while (!list_empty(head)) {
-               bd = list_entry(head->next, struct gfs2_bufdata, bd_list);
-               list_del_init(&bd->bd_list);
-               gl = bd->bd_gl;
-               atomic_dec(&gl->gl_revokes);
-               clear_bit(GLF_LFLUSH, &gl->gl_flags);
+       /*
+        * Glocks can be referenced repeatedly on the revoke list, but the list
+        * only holds one reference.  All glocks on the list will have the
+        * GLF_REVOKES flag set initially.
+        */
+
+       list_for_each_entry_safe(bd, tmp, head, bd_list) {
+               struct gfs2_glock *gl = bd->bd_gl;
+
+               if (test_bit(GLF_REVOKES, &gl->gl_flags)) {
+                       /* Keep each glock on the list exactly once. */
+                       clear_bit(GLF_REVOKES, &gl->gl_flags);
+                       continue;
+               }
+               list_del(&bd->bd_list);
+               kmem_cache_free(gfs2_bufdata_cachep, bd);
+       }
+       list_for_each_entry_safe(bd, tmp, head, bd_list) {
+               struct gfs2_glock *gl = bd->bd_gl;
+
+               list_del(&bd->bd_list);
                kmem_cache_free(gfs2_bufdata_cachep, bd);
+               clear_bit(GLF_LFLUSH, &gl->gl_flags);
+               gfs2_glock_queue_put(gl);
        }
+       /* the list is empty now */
 }
 
 static void revoke_lo_before_scan(struct gfs2_jdesc *jd,
@@ -683,7 +702,7 @@ static void revoke_lo_before_scan(struct gfs2_jdesc *jd,
        jd->jd_replay_tail = head->lh_tail;
 }
 
-static int revoke_lo_scan_elements(struct gfs2_jdesc *jd, unsigned int start,
+static int revoke_lo_scan_elements(struct gfs2_jdesc *jd, u32 start,
                                   struct gfs2_log_descriptor *ld, __be64 *ptr,
                                   int pass)
 {
@@ -765,7 +784,7 @@ static void databuf_lo_before_commit(struct gfs2_sbd *sdp, struct gfs2_trans *tr
        gfs2_before_commit(sdp, limit, nbuf, &tr->tr_databuf, 1);
 }
 
-static int databuf_lo_scan_elements(struct gfs2_jdesc *jd, unsigned int start,
+static int databuf_lo_scan_elements(struct gfs2_jdesc *jd, u32 start,
                                    struct gfs2_log_descriptor *ld,
                                    __be64 *ptr, int pass)
 {
@@ -851,7 +870,7 @@ static void databuf_lo_after_commit(struct gfs2_sbd *sdp, struct gfs2_trans *tr)
 }
 
 
-const struct gfs2_log_operations gfs2_buf_lops = {
+static const struct gfs2_log_operations gfs2_buf_lops = {
        .lo_before_commit = buf_lo_before_commit,
        .lo_after_commit = buf_lo_after_commit,
        .lo_before_scan = buf_lo_before_scan,
@@ -860,7 +879,7 @@ const struct gfs2_log_operations gfs2_buf_lops = {
        .lo_name = "buf",
 };
 
-const struct gfs2_log_operations gfs2_revoke_lops = {
+static const struct gfs2_log_operations gfs2_revoke_lops = {
        .lo_before_commit = revoke_lo_before_commit,
        .lo_after_commit = revoke_lo_after_commit,
        .lo_before_scan = revoke_lo_before_scan,
@@ -869,7 +888,7 @@ const struct gfs2_log_operations gfs2_revoke_lops = {
        .lo_name = "revoke",
 };
 
-const struct gfs2_log_operations gfs2_databuf_lops = {
+static const struct gfs2_log_operations gfs2_databuf_lops = {
        .lo_before_commit = databuf_lo_before_commit,
        .lo_after_commit = databuf_lo_after_commit,
        .lo_scan_elements = databuf_lo_scan_elements,