diff options
Diffstat (limited to 'fs/gfs2/meta_io.c')
| -rw-r--r-- | fs/gfs2/meta_io.c | 26 | 
1 files changed, 17 insertions, 9 deletions
diff --git a/fs/gfs2/meta_io.c b/fs/gfs2/meta_io.c index 93241505054..b984a6e190b 100644 --- a/fs/gfs2/meta_io.c +++ b/fs/gfs2/meta_io.c @@ -97,6 +97,11 @@ const struct address_space_operations gfs2_meta_aops = {  	.releasepage = gfs2_releasepage,  }; +const struct address_space_operations gfs2_rgrp_aops = { +	.writepage = gfs2_aspace_writepage, +	.releasepage = gfs2_releasepage, +}; +  /**   * gfs2_getbuf - Get a buffer with a given address space   * @gl: the glock @@ -116,6 +121,9 @@ struct buffer_head *gfs2_getbuf(struct gfs2_glock *gl, u64 blkno, int create)  	unsigned long index;  	unsigned int bufnum; +	if (mapping == NULL) +		mapping = &sdp->sd_aspace; +  	shift = PAGE_CACHE_SHIFT - sdp->sd_sb.sb_bsize_shift;  	index = blkno >> shift;             /* convert block to page */  	bufnum = blkno - (index << shift);  /* block buf index within page */ @@ -128,7 +136,8 @@ struct buffer_head *gfs2_getbuf(struct gfs2_glock *gl, u64 blkno, int create)  			yield();  		}  	} else { -		page = find_lock_page(mapping, index); +		page = find_get_page_flags(mapping, index, +						FGP_LOCK|FGP_ACCESSED);  		if (!page)  			return NULL;  	} @@ -145,7 +154,6 @@ struct buffer_head *gfs2_getbuf(struct gfs2_glock *gl, u64 blkno, int create)  		map_bh(bh, sdp->sd_vfs, blkno);  	unlock_page(page); -	mark_page_accessed(page);  	page_cache_release(page);  	return bh; @@ -258,27 +266,27 @@ void gfs2_remove_from_journal(struct buffer_head *bh, struct gfs2_trans *tr, int  	struct address_space *mapping = bh->b_page->mapping;  	struct gfs2_sbd *sdp = gfs2_mapping2sbd(mapping);  	struct gfs2_bufdata *bd = bh->b_private; +	int was_pinned = 0;  	if (test_clear_buffer_pinned(bh)) {  		trace_gfs2_pin(bd, 0);  		atomic_dec(&sdp->sd_log_pinned);  		list_del_init(&bd->bd_list); -		if (meta) { -			gfs2_assert_warn(sdp, sdp->sd_log_num_buf); -			sdp->sd_log_num_buf--; +		if (meta)  			tr->tr_num_buf_rm++; -		} else { -			gfs2_assert_warn(sdp, sdp->sd_log_num_databuf); -			sdp->sd_log_num_databuf--; +		else  			tr->tr_num_databuf_rm++; -		}  		tr->tr_touched = 1; +		was_pinned = 1;  		brelse(bh);  	}  	if (bd) {  		spin_lock(&sdp->sd_ail_lock);  		if (bd->bd_tr) {  			gfs2_trans_add_revoke(sdp, bd); +		} else if (was_pinned) { +			bh->b_private = NULL; +			kmem_cache_free(gfs2_bufdata_cachep, bd);  		}  		spin_unlock(&sdp->sd_ail_lock);  	}  | 
