aboutsummaryrefslogtreecommitdiffstats
path: root/fs/ocfs2/aops.c
diff options
context:
space:
mode:
Diffstat (limited to 'fs/ocfs2/aops.c')
-rw-r--r--fs/ocfs2/aops.c20
1 files changed, 12 insertions, 8 deletions
diff --git a/fs/ocfs2/aops.c b/fs/ocfs2/aops.c
index fae07672eb18..8416e383197c 100644
--- a/fs/ocfs2/aops.c
+++ b/fs/ocfs2/aops.c
@@ -830,18 +830,22 @@ struct ocfs2_write_ctxt {
830 struct ocfs2_cached_dealloc_ctxt w_dealloc; 830 struct ocfs2_cached_dealloc_ctxt w_dealloc;
831}; 831};
832 832
833static void ocfs2_free_write_ctxt(struct ocfs2_write_ctxt *wc) 833void ocfs2_unlock_and_free_pages(struct page **pages, int num_pages)
834{ 834{
835 int i; 835 int i;
836 836
837 for(i = 0; i < wc->w_num_pages; i++) { 837 for(i = 0; i < num_pages; i++) {
838 if (wc->w_pages[i] == NULL) 838 if (pages[i]) {
839 continue; 839 unlock_page(pages[i]);
840 840 mark_page_accessed(pages[i]);
841 unlock_page(wc->w_pages[i]); 841 page_cache_release(pages[i]);
842 mark_page_accessed(wc->w_pages[i]); 842 }
843 page_cache_release(wc->w_pages[i]);
844 } 843 }
844}
845
846static void ocfs2_free_write_ctxt(struct ocfs2_write_ctxt *wc)
847{
848 ocfs2_unlock_and_free_pages(wc->w_pages, wc->w_num_pages);
845 849
846 brelse(wc->w_di_bh); 850 brelse(wc->w_di_bh);
847 kfree(wc); 851 kfree(wc);