aboutsummaryrefslogtreecommitdiffstats
path: root/fs/gfs2/aops.c
diff options
context:
space:
mode:
authorBob Peterson <rpeterso@redhat.com>2012-05-18 09:28:23 -0400
committerSteven Whitehouse <swhiteho@redhat.com>2012-06-06 06:20:22 -0400
commit5407e24229408d7586ee451a384fc13e4a2332be (patch)
tree7534b0d0fc69de50b6156ec4e384a71acf01dea1 /fs/gfs2/aops.c
parent0a305e496059a113f93bdd3ad27a5aaa917fe34d (diff)
GFS2: Fold quota data into the reservations struct
This patch moves the ancillary quota data structures into the block reservations structure. This saves GFS2 some time and effort in allocating and deallocating the qadata structure. Signed-off-by: Bob Peterson <rpeterso@redhat.com> Signed-off-by: Steven Whitehouse <swhiteho@redhat.com>
Diffstat (limited to 'fs/gfs2/aops.c')
-rw-r--r--fs/gfs2/aops.c16
1 files changed, 2 insertions, 14 deletions
diff --git a/fs/gfs2/aops.c b/fs/gfs2/aops.c
index aba77b5720bc..d6526347d386 100644
--- a/fs/gfs2/aops.c
+++ b/fs/gfs2/aops.c
@@ -614,7 +614,6 @@ static int gfs2_write_begin(struct file *file, struct address_space *mapping,
614 unsigned int data_blocks = 0, ind_blocks = 0, rblocks; 614 unsigned int data_blocks = 0, ind_blocks = 0, rblocks;
615 int alloc_required; 615 int alloc_required;
616 int error = 0; 616 int error = 0;
617 struct gfs2_qadata *qa = NULL;
618 pgoff_t index = pos >> PAGE_CACHE_SHIFT; 617 pgoff_t index = pos >> PAGE_CACHE_SHIFT;
619 unsigned from = pos & (PAGE_CACHE_SIZE - 1); 618 unsigned from = pos & (PAGE_CACHE_SIZE - 1);
620 struct page *page; 619 struct page *page;
@@ -638,15 +637,9 @@ static int gfs2_write_begin(struct file *file, struct address_space *mapping,
638 gfs2_write_calc_reserv(ip, len, &data_blocks, &ind_blocks); 637 gfs2_write_calc_reserv(ip, len, &data_blocks, &ind_blocks);
639 638
640 if (alloc_required) { 639 if (alloc_required) {
641 qa = gfs2_qadata_get(ip);
642 if (!qa) {
643 error = -ENOMEM;
644 goto out_unlock;
645 }
646
647 error = gfs2_quota_lock_check(ip); 640 error = gfs2_quota_lock_check(ip);
648 if (error) 641 if (error)
649 goto out_alloc_put; 642 goto out_unlock;
650 643
651 error = gfs2_inplace_reserve(ip, data_blocks + ind_blocks); 644 error = gfs2_inplace_reserve(ip, data_blocks + ind_blocks);
652 if (error) 645 if (error)
@@ -708,8 +701,6 @@ out_trans_fail:
708 gfs2_inplace_release(ip); 701 gfs2_inplace_release(ip);
709out_qunlock: 702out_qunlock:
710 gfs2_quota_unlock(ip); 703 gfs2_quota_unlock(ip);
711out_alloc_put:
712 gfs2_qadata_put(ip);
713 } 704 }
714out_unlock: 705out_unlock:
715 if (&ip->i_inode == sdp->sd_rindex) { 706 if (&ip->i_inode == sdp->sd_rindex) {
@@ -846,7 +837,6 @@ static int gfs2_write_end(struct file *file, struct address_space *mapping,
846 struct gfs2_sbd *sdp = GFS2_SB(inode); 837 struct gfs2_sbd *sdp = GFS2_SB(inode);
847 struct gfs2_inode *m_ip = GFS2_I(sdp->sd_statfs_inode); 838 struct gfs2_inode *m_ip = GFS2_I(sdp->sd_statfs_inode);
848 struct buffer_head *dibh; 839 struct buffer_head *dibh;
849 struct gfs2_qadata *qa = ip->i_qadata;
850 unsigned int from = pos & (PAGE_CACHE_SIZE - 1); 840 unsigned int from = pos & (PAGE_CACHE_SIZE - 1);
851 unsigned int to = from + len; 841 unsigned int to = from + len;
852 int ret; 842 int ret;
@@ -880,10 +870,8 @@ failed:
880 gfs2_trans_end(sdp); 870 gfs2_trans_end(sdp);
881 if (gfs2_mb_reserved(ip)) 871 if (gfs2_mb_reserved(ip))
882 gfs2_inplace_release(ip); 872 gfs2_inplace_release(ip);
883 if (qa) { 873 if (ip->i_res->rs_qa_qd_num)
884 gfs2_quota_unlock(ip); 874 gfs2_quota_unlock(ip);
885 gfs2_qadata_put(ip);
886 }
887 if (inode == sdp->sd_rindex) { 875 if (inode == sdp->sd_rindex) {
888 gfs2_glock_dq(&m_ip->i_gh); 876 gfs2_glock_dq(&m_ip->i_gh);
889 gfs2_holder_uninit(&m_ip->i_gh); 877 gfs2_holder_uninit(&m_ip->i_gh);