diff options
Diffstat (limited to 'fs/gfs2/quota.c')
-rw-r--r-- | fs/gfs2/quota.c | 16 |
1 files changed, 7 insertions, 9 deletions
diff --git a/fs/gfs2/quota.c b/fs/gfs2/quota.c index 1bc6b5695e6d..58a9b9998b42 100644 --- a/fs/gfs2/quota.c +++ b/fs/gfs2/quota.c | |||
@@ -735,10 +735,8 @@ get_a_page: | |||
735 | goto out; | 735 | goto out; |
736 | 736 | ||
737 | size = loc + sizeof(struct gfs2_quota); | 737 | size = loc + sizeof(struct gfs2_quota); |
738 | if (size > inode->i_size) { | 738 | if (size > inode->i_size) |
739 | ip->i_disksize = size; | ||
740 | i_size_write(inode, size); | 739 | i_size_write(inode, size); |
741 | } | ||
742 | inode->i_mtime = inode->i_atime = CURRENT_TIME; | 740 | inode->i_mtime = inode->i_atime = CURRENT_TIME; |
743 | gfs2_trans_add_bh(ip->i_gl, dibh, 1); | 741 | gfs2_trans_add_bh(ip->i_gl, dibh, 1); |
744 | gfs2_dinode_out(ip, dibh->b_data); | 742 | gfs2_dinode_out(ip, dibh->b_data); |
@@ -817,7 +815,7 @@ static int do_sync(unsigned int num_qd, struct gfs2_quota_data **qda) | |||
817 | goto out_alloc; | 815 | goto out_alloc; |
818 | 816 | ||
819 | if (nalloc) | 817 | if (nalloc) |
820 | blocks += al->al_rgd->rd_length + nalloc * ind_blocks + RES_STATFS; | 818 | blocks += gfs2_rg_blocks(al) + nalloc * ind_blocks + RES_STATFS; |
821 | 819 | ||
822 | error = gfs2_trans_begin(sdp, blocks, 0); | 820 | error = gfs2_trans_begin(sdp, blocks, 0); |
823 | if (error) | 821 | if (error) |
@@ -1190,18 +1188,17 @@ static void gfs2_quota_change_in(struct gfs2_quota_change_host *qc, const void * | |||
1190 | int gfs2_quota_init(struct gfs2_sbd *sdp) | 1188 | int gfs2_quota_init(struct gfs2_sbd *sdp) |
1191 | { | 1189 | { |
1192 | struct gfs2_inode *ip = GFS2_I(sdp->sd_qc_inode); | 1190 | struct gfs2_inode *ip = GFS2_I(sdp->sd_qc_inode); |
1193 | unsigned int blocks = ip->i_disksize >> sdp->sd_sb.sb_bsize_shift; | 1191 | u64 size = i_size_read(sdp->sd_qc_inode); |
1192 | unsigned int blocks = size >> sdp->sd_sb.sb_bsize_shift; | ||
1194 | unsigned int x, slot = 0; | 1193 | unsigned int x, slot = 0; |
1195 | unsigned int found = 0; | 1194 | unsigned int found = 0; |
1196 | u64 dblock; | 1195 | u64 dblock; |
1197 | u32 extlen = 0; | 1196 | u32 extlen = 0; |
1198 | int error; | 1197 | int error; |
1199 | 1198 | ||
1200 | if (!ip->i_disksize || ip->i_disksize > (64 << 20) || | 1199 | if (gfs2_check_internal_file_size(sdp->sd_qc_inode, 1, 64 << 20)) |
1201 | ip->i_disksize & (sdp->sd_sb.sb_bsize - 1)) { | ||
1202 | gfs2_consist_inode(ip); | ||
1203 | return -EIO; | 1200 | return -EIO; |
1204 | } | 1201 | |
1205 | sdp->sd_quota_slots = blocks * sdp->sd_qc_per_block; | 1202 | sdp->sd_quota_slots = blocks * sdp->sd_qc_per_block; |
1206 | sdp->sd_quota_chunks = DIV_ROUND_UP(sdp->sd_quota_slots, 8 * PAGE_SIZE); | 1203 | sdp->sd_quota_chunks = DIV_ROUND_UP(sdp->sd_quota_slots, 8 * PAGE_SIZE); |
1207 | 1204 | ||
@@ -1589,6 +1586,7 @@ static int gfs2_set_dqblk(struct super_block *sb, int type, qid_t id, | |||
1589 | error = gfs2_inplace_reserve(ip); | 1586 | error = gfs2_inplace_reserve(ip); |
1590 | if (error) | 1587 | if (error) |
1591 | goto out_alloc; | 1588 | goto out_alloc; |
1589 | blocks += gfs2_rg_blocks(al); | ||
1592 | } | 1590 | } |
1593 | 1591 | ||
1594 | error = gfs2_trans_begin(sdp, blocks + RES_DINODE + 1, 0); | 1592 | error = gfs2_trans_begin(sdp, blocks + RES_DINODE + 1, 0); |