diff options
Diffstat (limited to 'fs/gfs2/aops.c')
| -rw-r--r-- | fs/gfs2/aops.c | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/fs/gfs2/aops.c b/fs/gfs2/aops.c index d6526347d386..01c4975da4bc 100644 --- a/fs/gfs2/aops.c +++ b/fs/gfs2/aops.c | |||
| @@ -612,6 +612,7 @@ static int gfs2_write_begin(struct file *file, struct address_space *mapping, | |||
| 612 | struct gfs2_sbd *sdp = GFS2_SB(mapping->host); | 612 | struct gfs2_sbd *sdp = GFS2_SB(mapping->host); |
| 613 | struct gfs2_inode *m_ip = GFS2_I(sdp->sd_statfs_inode); | 613 | struct gfs2_inode *m_ip = GFS2_I(sdp->sd_statfs_inode); |
| 614 | unsigned int data_blocks = 0, ind_blocks = 0, rblocks; | 614 | unsigned int data_blocks = 0, ind_blocks = 0, rblocks; |
| 615 | unsigned requested = 0; | ||
| 615 | int alloc_required; | 616 | int alloc_required; |
| 616 | int error = 0; | 617 | int error = 0; |
| 617 | pgoff_t index = pos >> PAGE_CACHE_SHIFT; | 618 | pgoff_t index = pos >> PAGE_CACHE_SHIFT; |
| @@ -641,7 +642,8 @@ static int gfs2_write_begin(struct file *file, struct address_space *mapping, | |||
| 641 | if (error) | 642 | if (error) |
| 642 | goto out_unlock; | 643 | goto out_unlock; |
| 643 | 644 | ||
| 644 | error = gfs2_inplace_reserve(ip, data_blocks + ind_blocks); | 645 | requested = data_blocks + ind_blocks; |
| 646 | error = gfs2_inplace_reserve(ip, requested); | ||
| 645 | if (error) | 647 | if (error) |
| 646 | goto out_qunlock; | 648 | goto out_qunlock; |
| 647 | } | 649 | } |
| @@ -654,7 +656,7 @@ static int gfs2_write_begin(struct file *file, struct address_space *mapping, | |||
| 654 | if (&ip->i_inode == sdp->sd_rindex) | 656 | if (&ip->i_inode == sdp->sd_rindex) |
| 655 | rblocks += 2 * RES_STATFS; | 657 | rblocks += 2 * RES_STATFS; |
| 656 | if (alloc_required) | 658 | if (alloc_required) |
| 657 | rblocks += gfs2_rg_blocks(ip); | 659 | rblocks += gfs2_rg_blocks(ip, requested); |
| 658 | 660 | ||
| 659 | error = gfs2_trans_begin(sdp, rblocks, | 661 | error = gfs2_trans_begin(sdp, rblocks, |
| 660 | PAGE_CACHE_SIZE/sdp->sd_sb.sb_bsize); | 662 | PAGE_CACHE_SIZE/sdp->sd_sb.sb_bsize); |
| @@ -868,8 +870,7 @@ static int gfs2_write_end(struct file *file, struct address_space *mapping, | |||
| 868 | brelse(dibh); | 870 | brelse(dibh); |
| 869 | failed: | 871 | failed: |
| 870 | gfs2_trans_end(sdp); | 872 | gfs2_trans_end(sdp); |
| 871 | if (gfs2_mb_reserved(ip)) | 873 | gfs2_inplace_release(ip); |
| 872 | gfs2_inplace_release(ip); | ||
| 873 | if (ip->i_res->rs_qa_qd_num) | 874 | if (ip->i_res->rs_qa_qd_num) |
| 874 | gfs2_quota_unlock(ip); | 875 | gfs2_quota_unlock(ip); |
| 875 | if (inode == sdp->sd_rindex) { | 876 | if (inode == sdp->sd_rindex) { |
| @@ -1023,7 +1024,7 @@ static ssize_t gfs2_direct_IO(int rw, struct kiocb *iocb, | |||
| 1023 | offset, nr_segs, gfs2_get_block_direct, | 1024 | offset, nr_segs, gfs2_get_block_direct, |
| 1024 | NULL, NULL, 0); | 1025 | NULL, NULL, 0); |
| 1025 | out: | 1026 | out: |
| 1026 | gfs2_glock_dq_m(1, &gh); | 1027 | gfs2_glock_dq(&gh); |
| 1027 | gfs2_holder_uninit(&gh); | 1028 | gfs2_holder_uninit(&gh); |
| 1028 | return rv; | 1029 | return rv; |
| 1029 | } | 1030 | } |
