Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 211633
b: refs/heads/master
c: bf97b67
h: refs/heads/master
i:
  211631: a01ca05
v: v3
  • Loading branch information
Benjamin Marzinski authored and Steven Whitehouse committed Sep 28, 2010
1 parent aa1b559 commit e2d96b2
Show file tree
Hide file tree
Showing 8 changed files with 21 additions and 8 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: d0795f912318f65b800c6b619d749c3bf7c930fb
refs/heads/master: bf97b6734e027cc18abad420ab88f861f65d7816
2 changes: 2 additions & 0 deletions trunk/fs/gfs2/aops.c
Original file line number Diff line number Diff line change
Expand Up @@ -663,6 +663,8 @@ static int gfs2_write_begin(struct file *file, struct address_space *mapping,
rblocks += RES_STATFS + RES_QUOTA;
if (&ip->i_inode == sdp->sd_rindex)
rblocks += 2 * RES_STATFS;
if (alloc_required)
rblocks += gfs2_rg_blocks(al);

error = gfs2_trans_begin(sdp, rblocks,
PAGE_CACHE_SIZE/sdp->sd_sb.sb_bsize);
Expand Down
2 changes: 1 addition & 1 deletion trunk/fs/gfs2/bmap.c
Original file line number Diff line number Diff line change
Expand Up @@ -1151,7 +1151,7 @@ static int do_grow(struct inode *inode, u64 size)
goto do_grow_qunlock;
}

error = gfs2_trans_begin(sdp, RES_DINODE + 1, 0);
error = gfs2_trans_begin(sdp, RES_DINODE + RES_STATFS + RES_RG_BIT, 0);
if (error)
goto do_grow_release;

Expand Down
4 changes: 3 additions & 1 deletion trunk/fs/gfs2/file.c
Original file line number Diff line number Diff line change
Expand Up @@ -382,8 +382,10 @@ static int gfs2_page_mkwrite(struct vm_area_struct *vma, struct vm_fault *vmf)
rblocks = RES_DINODE + ind_blocks;
if (gfs2_is_jdata(ip))
rblocks += data_blocks ? data_blocks : 1;
if (ind_blocks || data_blocks)
if (ind_blocks || data_blocks) {
rblocks += RES_STATFS + RES_QUOTA;
rblocks += gfs2_rg_blocks(al);
}
ret = gfs2_trans_begin(sdp, rblocks, 0);
if (ret)
goto out_trans_fail;
Expand Down
6 changes: 3 additions & 3 deletions trunk/fs/gfs2/ops_inode.c
Original file line number Diff line number Diff line change
Expand Up @@ -219,7 +219,7 @@ static int gfs2_link(struct dentry *old_dentry, struct inode *dir,
goto out_gunlock_q;

error = gfs2_trans_begin(sdp, sdp->sd_max_dirres +
al->al_rgd->rd_length +
gfs2_rg_blocks(al) +
2 * RES_DINODE + RES_STATFS +
RES_QUOTA, 0);
if (error)
Expand Down Expand Up @@ -884,7 +884,7 @@ static int gfs2_rename(struct inode *odir, struct dentry *odentry,
goto out_gunlock_q;

error = gfs2_trans_begin(sdp, sdp->sd_max_dirres +
al->al_rgd->rd_length +
gfs2_rg_blocks(al) +
4 * RES_DINODE + 4 * RES_LEAF +
RES_STATFS + RES_QUOTA + 4, 0);
if (error)
Expand Down Expand Up @@ -1481,7 +1481,7 @@ static long gfs2_fallocate(struct inode *inode, int mode, loff_t offset,
al->al_requested = data_blocks + ind_blocks;

rblocks = RES_DINODE + ind_blocks + RES_STATFS + RES_QUOTA +
RES_RG_HDR + ip->i_alloc->al_rgd->rd_length;
RES_RG_HDR + gfs2_rg_blocks(al);
if (gfs2_is_jdata(ip))
rblocks += data_blocks ? data_blocks : 1;

Expand Down
3 changes: 2 additions & 1 deletion trunk/fs/gfs2/quota.c
Original file line number Diff line number Diff line change
Expand Up @@ -815,7 +815,7 @@ static int do_sync(unsigned int num_qd, struct gfs2_quota_data **qda)
goto out_alloc;

if (nalloc)
blocks += al->al_rgd->rd_length + nalloc * ind_blocks + RES_STATFS;
blocks += gfs2_rg_blocks(al) + nalloc * ind_blocks + RES_STATFS;

error = gfs2_trans_begin(sdp, blocks, 0);
if (error)
Expand Down Expand Up @@ -1586,6 +1586,7 @@ static int gfs2_set_dqblk(struct super_block *sb, int type, qid_t id,
error = gfs2_inplace_reserve(ip);
if (error)
goto out_alloc;
blocks += gfs2_rg_blocks(al);
}

error = gfs2_trans_begin(sdp, blocks + RES_DINODE + 1, 0);
Expand Down
8 changes: 8 additions & 0 deletions trunk/fs/gfs2/trans.h
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,14 @@ struct gfs2_glock;
#define RES_STATFS 1
#define RES_QUOTA 2

/* reserve either the number of blocks to be allocated plus the rg header
* block, or all of the blocks in the rg, whichever is smaller */
static inline unsigned int gfs2_rg_blocks(const struct gfs2_alloc *al)
{
return (al->al_requested < al->al_rgd->rd_length)?
al->al_requested + 1 : al->al_rgd->rd_length;
}

int gfs2_trans_begin(struct gfs2_sbd *sdp, unsigned int blocks,
unsigned int revokes);

Expand Down
2 changes: 1 addition & 1 deletion trunk/fs/gfs2/xattr.c
Original file line number Diff line number Diff line change
Expand Up @@ -734,7 +734,7 @@ static int ea_alloc_skeleton(struct gfs2_inode *ip, struct gfs2_ea_request *er,
goto out_gunlock_q;

error = gfs2_trans_begin(GFS2_SB(&ip->i_inode),
blks + al->al_rgd->rd_length +
blks + gfs2_rg_blocks(al) +
RES_DINODE + RES_STATFS + RES_QUOTA, 0);
if (error)
goto out_ipres;
Expand Down

0 comments on commit e2d96b2

Please sign in to comment.