Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 89531
b: refs/heads/master
c: d82661d
h: refs/heads/master
i:
  89529: c6a48a9
  89527: 8a809eb
v: v3
  • Loading branch information
Steven Whitehouse committed Mar 31, 2008
1 parent 4a24e11 commit dfff86c
Show file tree
Hide file tree
Showing 7 changed files with 24 additions and 30 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: 860b25d4a913a00331d333f8e207a088c7a1b84a
refs/heads/master: d82661d96993ac4efc1d54259ea85ffcd9b8bec6
6 changes: 1 addition & 5 deletions trunk/fs/gfs2/bmap.c
Original file line number Diff line number Diff line change
Expand Up @@ -903,14 +903,10 @@ static int do_grow(struct gfs2_inode *ip, u64 size)
if (!al)
return -ENOMEM;

error = gfs2_quota_lock(ip, NO_QUOTA_CHANGE, NO_QUOTA_CHANGE);
error = gfs2_quota_lock_check(ip);
if (error)
goto out;

error = gfs2_quota_check(ip, ip->i_inode.i_uid, ip->i_inode.i_gid);
if (error)
goto out_gunlock_q;

al->al_requested = sdp->sd_max_height + RES_DATA;

error = gfs2_inplace_reserve(ip);
Expand Down
6 changes: 1 addition & 5 deletions trunk/fs/gfs2/eattr.c
Original file line number Diff line number Diff line change
Expand Up @@ -686,14 +686,10 @@ static int ea_alloc_skeleton(struct gfs2_inode *ip, struct gfs2_ea_request *er,
if (!al)
return -ENOMEM;

error = gfs2_quota_lock(ip, NO_QUOTA_CHANGE, NO_QUOTA_CHANGE);
error = gfs2_quota_lock_check(ip);
if (error)
goto out;

error = gfs2_quota_check(ip, ip->i_inode.i_uid, ip->i_inode.i_gid);
if (error)
goto out_gunlock_q;

al->al_requested = blks;

error = gfs2_inplace_reserve(ip);
Expand Down
6 changes: 1 addition & 5 deletions trunk/fs/gfs2/ops_address.c
Original file line number Diff line number Diff line change
Expand Up @@ -653,14 +653,10 @@ static int gfs2_write_begin(struct file *file, struct address_space *mapping,
goto out_unlock;
}

error = gfs2_quota_lock(ip, NO_QUOTA_CHANGE, NO_QUOTA_CHANGE);
error = gfs2_quota_lock_check(ip);
if (error)
goto out_alloc_put;

error = gfs2_quota_check(ip, ip->i_inode.i_uid, ip->i_inode.i_gid);
if (error)
goto out_qunlock;

al->al_requested = data_blocks + ind_blocks;
error = gfs2_inplace_reserve(ip);
if (error)
Expand Down
5 changes: 1 addition & 4 deletions trunk/fs/gfs2/ops_file.c
Original file line number Diff line number Diff line change
Expand Up @@ -369,12 +369,9 @@ static int gfs2_page_mkwrite(struct vm_area_struct *vma, struct page *page)
if (al == NULL)
goto out_unlock;

ret = gfs2_quota_lock(ip, NO_QUOTA_CHANGE, NO_QUOTA_CHANGE);
ret = gfs2_quota_lock_check(ip);
if (ret)
goto out_alloc_put;
ret = gfs2_quota_check(ip, ip->i_inode.i_uid, ip->i_inode.i_gid);
if (ret)
goto out_quota_unlock;
al->al_requested = data_blocks + ind_blocks;
ret = gfs2_inplace_reserve(ip);
if (ret)
Expand Down
12 changes: 2 additions & 10 deletions trunk/fs/gfs2/ops_inode.c
Original file line number Diff line number Diff line change
Expand Up @@ -205,14 +205,10 @@ static int gfs2_link(struct dentry *old_dentry, struct inode *dir,
goto out_gunlock;
}

error = gfs2_quota_lock(dip, NO_QUOTA_CHANGE, NO_QUOTA_CHANGE);
error = gfs2_quota_lock_check(dip);
if (error)
goto out_alloc;

error = gfs2_quota_check(dip, dip->i_inode.i_uid, dip->i_inode.i_gid);
if (error)
goto out_gunlock_q;

al->al_requested = sdp->sd_max_dirres;

error = gfs2_inplace_reserve(dip);
Expand Down Expand Up @@ -725,14 +721,10 @@ static int gfs2_rename(struct inode *odir, struct dentry *odentry,
goto out_gunlock;
}

error = gfs2_quota_lock(ndip, NO_QUOTA_CHANGE, NO_QUOTA_CHANGE);
error = gfs2_quota_lock_check(ndip);
if (error)
goto out_alloc;

error = gfs2_quota_check(ndip, ndip->i_inode.i_uid, ndip->i_inode.i_gid);
if (error)
goto out_gunlock_q;

al->al_requested = sdp->sd_max_dirres;

error = gfs2_inplace_reserve(ndip);
Expand Down
17 changes: 17 additions & 0 deletions trunk/fs/gfs2/quota.h
Original file line number Diff line number Diff line change
Expand Up @@ -32,4 +32,21 @@ int gfs2_quota_init(struct gfs2_sbd *sdp);
void gfs2_quota_scan(struct gfs2_sbd *sdp);
void gfs2_quota_cleanup(struct gfs2_sbd *sdp);

static inline int gfs2_quota_lock_check(struct gfs2_inode *ip)
{
struct gfs2_sbd *sdp = GFS2_SB(&ip->i_inode);
int ret;
if (sdp->sd_args.ar_quota == GFS2_QUOTA_OFF)
return 0;
ret = gfs2_quota_lock(ip, NO_QUOTA_CHANGE, NO_QUOTA_CHANGE);
if (ret)
return ret;
if (sdp->sd_args.ar_quota != GFS2_QUOTA_ON)
return 0;
ret = gfs2_quota_check(ip, ip->i_inode.i_uid, ip->i_inode.i_gid);
if (ret)
gfs2_quota_unlock(ip);
return ret;
}

#endif /* __QUOTA_DOT_H__ */

0 comments on commit dfff86c

Please sign in to comment.