aboutsummaryrefslogtreecommitdiffstats
path: root/fs/gfs2
diff options
context:
space:
mode:
authorSteven Whitehouse <swhiteho@redhat.com>2013-11-26 08:21:08 -0500
committerSteven Whitehouse <swhiteho@redhat.com>2014-01-03 04:58:41 -0500
commite4f2920625cc2c562941b280914823a553f6973d (patch)
tree154c0fc597abecba1dcd1c72be4c16f428d49832 /fs/gfs2
parent5ea5050cec9c02e86ceb5e707a889003f895a690 (diff)
GFS2: Clean up releasepage
For historical reasons, we drop and retake the log lock in ->releasepage() however, since there is no reason why we cannot hold the log lock over the whole function, this allows some simplification. In particular, pinning a buffer is only ever done under the log lock, so it is possible here to remove the test for pinned buffers in the second loop, since it is impossible for that to happen (it is also tested in the first loop). As a result, two tests made later in the second loop become constants and can also be reduced to the only possible branch. So the net result is to remove various bits of unreachable code and make this more readable. Signed-off-by: Steven Whitehouse <swhiteho@redhat.com>
Diffstat (limited to 'fs/gfs2')
-rw-r--r--fs/gfs2/aops.c18
1 files changed, 5 insertions, 13 deletions
diff --git a/fs/gfs2/aops.c b/fs/gfs2/aops.c
index 73f3e4ee4037..cf858dad75d9 100644
--- a/fs/gfs2/aops.c
+++ b/fs/gfs2/aops.c
@@ -1080,30 +1080,22 @@ int gfs2_releasepage(struct page *page, gfp_t gfp_mask)
1080 bh = bh->b_this_page; 1080 bh = bh->b_this_page;
1081 } while(bh != head); 1081 } while(bh != head);
1082 spin_unlock(&sdp->sd_ail_lock); 1082 spin_unlock(&sdp->sd_ail_lock);
1083 gfs2_log_unlock(sdp);
1084 1083
1085 head = bh = page_buffers(page); 1084 head = bh = page_buffers(page);
1086 do { 1085 do {
1087 gfs2_log_lock(sdp);
1088 bd = bh->b_private; 1086 bd = bh->b_private;
1089 if (bd) { 1087 if (bd) {
1090 gfs2_assert_warn(sdp, bd->bd_bh == bh); 1088 gfs2_assert_warn(sdp, bd->bd_bh == bh);
1091 if (!list_empty(&bd->bd_list)) { 1089 if (!list_empty(&bd->bd_list))
1092 if (!buffer_pinned(bh)) 1090 list_del_init(&bd->bd_list);
1093 list_del_init(&bd->bd_list); 1091 bd->bd_bh = NULL;
1094 else
1095 bd = NULL;
1096 }
1097 if (bd)
1098 bd->bd_bh = NULL;
1099 bh->b_private = NULL; 1092 bh->b_private = NULL;
1100 }
1101 gfs2_log_unlock(sdp);
1102 if (bd)
1103 kmem_cache_free(gfs2_bufdata_cachep, bd); 1093 kmem_cache_free(gfs2_bufdata_cachep, bd);
1094 }
1104 1095
1105 bh = bh->b_this_page; 1096 bh = bh->b_this_page;
1106 } while (bh != head); 1097 } while (bh != head);
1098 gfs2_log_unlock(sdp);
1107 1099
1108 return try_to_free_buffers(page); 1100 return try_to_free_buffers(page);
1109 1101