diff options
Diffstat (limited to 'fs/gfs2/aops.c')
-rw-r--r-- | fs/gfs2/aops.c | 18 |
1 files changed, 3 insertions, 15 deletions
diff --git a/fs/gfs2/aops.c b/fs/gfs2/aops.c index e80a464850c..d6526347d38 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); |
709 | out_qunlock: | 702 | out_qunlock: |
710 | gfs2_quota_unlock(ip); | 703 | gfs2_quota_unlock(ip); |
711 | out_alloc_put: | ||
712 | gfs2_qadata_put(ip); | ||
713 | } | 704 | } |
714 | out_unlock: | 705 | out_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; |
@@ -878,12 +868,10 @@ static int gfs2_write_end(struct file *file, struct address_space *mapping, | |||
878 | brelse(dibh); | 868 | brelse(dibh); |
879 | failed: | 869 | failed: |
880 | gfs2_trans_end(sdp); | 870 | gfs2_trans_end(sdp); |
881 | if (ip->i_res) | 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); |