Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 316735
b: refs/heads/master
c: 5407e24
h: refs/heads/master
i:
  316733: d516eb3
  316731: 8b09511
  316727: 34da9f4
  316719: 831af94
  316703: e573f98
  316671: a09113b
v: v3
  • Loading branch information
Bob Peterson authored and Steven Whitehouse committed Jun 6, 2012
1 parent f9bee35 commit 3c3867f
Show file tree
Hide file tree
Showing 13 changed files with 57 additions and 187 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: 0a305e496059a113f93bdd3ad27a5aaa917fe34d
refs/heads/master: 5407e24229408d7586ee451a384fc13e4a2332be
16 changes: 2 additions & 14 deletions trunk/fs/gfs2/aops.c
Original file line number Diff line number Diff line change
Expand Up @@ -614,7 +614,6 @@ static int gfs2_write_begin(struct file *file, struct address_space *mapping,
unsigned int data_blocks = 0, ind_blocks = 0, rblocks;
int alloc_required;
int error = 0;
struct gfs2_qadata *qa = NULL;
pgoff_t index = pos >> PAGE_CACHE_SHIFT;
unsigned from = pos & (PAGE_CACHE_SIZE - 1);
struct page *page;
Expand All @@ -638,15 +637,9 @@ static int gfs2_write_begin(struct file *file, struct address_space *mapping,
gfs2_write_calc_reserv(ip, len, &data_blocks, &ind_blocks);

if (alloc_required) {
qa = gfs2_qadata_get(ip);
if (!qa) {
error = -ENOMEM;
goto out_unlock;
}

error = gfs2_quota_lock_check(ip);
if (error)
goto out_alloc_put;
goto out_unlock;

error = gfs2_inplace_reserve(ip, data_blocks + ind_blocks);
if (error)
Expand Down Expand Up @@ -708,8 +701,6 @@ static int gfs2_write_begin(struct file *file, struct address_space *mapping,
gfs2_inplace_release(ip);
out_qunlock:
gfs2_quota_unlock(ip);
out_alloc_put:
gfs2_qadata_put(ip);
}
out_unlock:
if (&ip->i_inode == sdp->sd_rindex) {
Expand Down Expand Up @@ -846,7 +837,6 @@ static int gfs2_write_end(struct file *file, struct address_space *mapping,
struct gfs2_sbd *sdp = GFS2_SB(inode);
struct gfs2_inode *m_ip = GFS2_I(sdp->sd_statfs_inode);
struct buffer_head *dibh;
struct gfs2_qadata *qa = ip->i_qadata;
unsigned int from = pos & (PAGE_CACHE_SIZE - 1);
unsigned int to = from + len;
int ret;
Expand Down Expand Up @@ -880,10 +870,8 @@ static int gfs2_write_end(struct file *file, struct address_space *mapping,
gfs2_trans_end(sdp);
if (gfs2_mb_reserved(ip))
gfs2_inplace_release(ip);
if (qa) {
if (ip->i_res->rs_qa_qd_num)
gfs2_quota_unlock(ip);
gfs2_qadata_put(ip);
}
if (inode == sdp->sd_rindex) {
gfs2_glock_dq(&m_ip->i_gh);
gfs2_holder_uninit(&m_ip->i_gh);
Expand Down
18 changes: 5 additions & 13 deletions trunk/fs/gfs2/bmap.c
Original file line number Diff line number Diff line change
Expand Up @@ -1045,12 +1045,13 @@ static int trunc_dealloc(struct gfs2_inode *ip, u64 size)
lblock = (size - 1) >> sdp->sd_sb.sb_bsize_shift;

find_metapath(sdp, lblock, &mp, ip->i_height);
if (!gfs2_qadata_get(ip))
return -ENOMEM;
error = gfs2_rindex_update(sdp);
if (error)
return error;

error = gfs2_quota_hold(ip, NO_QUOTA_CHANGE, NO_QUOTA_CHANGE);
if (error)
goto out;
return error;

while (height--) {
struct strip_mine sm;
Expand All @@ -1064,8 +1065,6 @@ static int trunc_dealloc(struct gfs2_inode *ip, u64 size)

gfs2_quota_unhold(ip);

out:
gfs2_qadata_put(ip);
return error;
}

Expand Down Expand Up @@ -1167,19 +1166,14 @@ static int do_grow(struct inode *inode, u64 size)
struct gfs2_inode *ip = GFS2_I(inode);
struct gfs2_sbd *sdp = GFS2_SB(inode);
struct buffer_head *dibh;
struct gfs2_qadata *qa = NULL;
int error;
int unstuff = 0;

if (gfs2_is_stuffed(ip) &&
(size > (sdp->sd_sb.sb_bsize - sizeof(struct gfs2_dinode)))) {
qa = gfs2_qadata_get(ip);
if (qa == NULL)
return -ENOMEM;

error = gfs2_quota_lock_check(ip);
if (error)
goto do_grow_alloc_put;
return error;

error = gfs2_inplace_reserve(ip, 1);
if (error)
Expand Down Expand Up @@ -1214,8 +1208,6 @@ static int do_grow(struct inode *inode, u64 size)
gfs2_inplace_release(ip);
do_grow_qunlock:
gfs2_quota_unlock(ip);
do_grow_alloc_put:
gfs2_qadata_put(ip);
}
return error;
}
Expand Down
9 changes: 1 addition & 8 deletions trunk/fs/gfs2/dir.c
Original file line number Diff line number Diff line change
Expand Up @@ -1854,14 +1854,9 @@ static int leaf_dealloc(struct gfs2_inode *dip, u32 index, u32 len,
if (!ht)
return -ENOMEM;

if (!gfs2_qadata_get(dip)) {
error = -ENOMEM;
goto out;
}

error = gfs2_quota_hold(dip, NO_QUOTA_CHANGE, NO_QUOTA_CHANGE);
if (error)
goto out_put;
goto out;

/* Count the number of leaves */
bh = leaf_bh;
Expand Down Expand Up @@ -1942,8 +1937,6 @@ static int leaf_dealloc(struct gfs2_inode *dip, u32 index, u32 len,
out_rlist:
gfs2_rlist_free(&rlist);
gfs2_quota_unhold(dip);
out_put:
gfs2_qadata_put(dip);
out:
kfree(ht);
return error;
Expand Down
22 changes: 6 additions & 16 deletions trunk/fs/gfs2/file.c
Original file line number Diff line number Diff line change
Expand Up @@ -366,7 +366,6 @@ static int gfs2_page_mkwrite(struct vm_area_struct *vma, struct vm_fault *vmf)
u64 pos = page->index << PAGE_CACHE_SHIFT;
unsigned int data_blocks, ind_blocks, rblocks;
struct gfs2_holder gh;
struct gfs2_qadata *qa;
loff_t size;
int ret;

Expand Down Expand Up @@ -397,14 +396,13 @@ static int gfs2_page_mkwrite(struct vm_area_struct *vma, struct vm_fault *vmf)
goto out_unlock;
}

ret = -ENOMEM;
qa = gfs2_qadata_get(ip);
if (qa == NULL)
ret = gfs2_rindex_update(sdp);
if (ret)
goto out_unlock;

ret = gfs2_quota_lock_check(ip);
if (ret)
goto out_alloc_put;
goto out_unlock;
gfs2_write_calc_reserv(ip, PAGE_CACHE_SIZE, &data_blocks, &ind_blocks);
ret = gfs2_inplace_reserve(ip, data_blocks + ind_blocks);
if (ret)
Expand Down Expand Up @@ -451,8 +449,6 @@ static int gfs2_page_mkwrite(struct vm_area_struct *vma, struct vm_fault *vmf)
gfs2_inplace_release(ip);
out_quota_unlock:
gfs2_quota_unlock(ip);
out_alloc_put:
gfs2_qadata_put(ip);
out_unlock:
gfs2_glock_dq(&gh);
out:
Expand Down Expand Up @@ -764,7 +760,6 @@ static long gfs2_fallocate(struct file *file, int mode, loff_t offset,
struct gfs2_inode *ip = GFS2_I(inode);
unsigned int data_blocks = 0, ind_blocks = 0, rblocks;
loff_t bytes, max_bytes;
struct gfs2_qadata *qa;
int error;
const loff_t pos = offset;
const loff_t count = len;
Expand Down Expand Up @@ -804,15 +799,13 @@ static long gfs2_fallocate(struct file *file, int mode, loff_t offset,
offset += bytes;
continue;
}
qa = gfs2_qadata_get(ip);
if (!qa) {
error = -ENOMEM;
error = gfs2_rindex_update(sdp);
if (error)
goto out_unlock;
}

error = gfs2_quota_lock_check(ip);
if (error)
goto out_alloc_put;
goto out_unlock;

retry:
gfs2_write_calc_reserv(ip, bytes, &data_blocks, &ind_blocks);
Expand Down Expand Up @@ -852,7 +845,6 @@ static long gfs2_fallocate(struct file *file, int mode, loff_t offset,
offset += max_bytes;
gfs2_inplace_release(ip);
gfs2_quota_unlock(ip);
gfs2_qadata_put(ip);
}

if (error == 0)
Expand All @@ -863,8 +855,6 @@ static long gfs2_fallocate(struct file *file, int mode, loff_t offset,
gfs2_inplace_release(ip);
out_qunlock:
gfs2_quota_unlock(ip);
out_alloc_put:
gfs2_qadata_put(ip);
out_unlock:
gfs2_glock_dq(&ip->i_gh);
out_uninit:
Expand Down
13 changes: 5 additions & 8 deletions trunk/fs/gfs2/incore.h
Original file line number Diff line number Diff line change
Expand Up @@ -289,16 +289,14 @@ struct gfs2_glock {

#define GFS2_MIN_LVB_SIZE 32 /* Min size of LVB that gfs2 supports */

struct gfs2_qadata { /* quota allocation data */
/* Quota stuff */
struct gfs2_quota_data *qa_qd[2*MAXQUOTAS];
struct gfs2_holder qa_qd_ghs[2*MAXQUOTAS];
unsigned int qa_qd_num;
};

struct gfs2_blkreserv {
u32 rs_requested; /* Filled in by caller of gfs2_inplace_reserve() */
struct gfs2_holder rs_rgd_gh; /* Filled in by gfs2_inplace_reserve() */

/* ancillary quota stuff */
struct gfs2_quota_data *rs_qa_qd[2 * MAXQUOTAS];
struct gfs2_holder rs_qa_qd_ghs[2 * MAXQUOTAS];
unsigned int rs_qa_qd_num;
};

enum {
Expand All @@ -319,7 +317,6 @@ struct gfs2_inode {
struct gfs2_glock *i_gl; /* Move into i_gh? */
struct gfs2_holder i_iopen_gh;
struct gfs2_holder i_gh; /* for prepare/commit_write only */
struct gfs2_qadata *i_qadata; /* quota allocation data */
struct gfs2_blkreserv *i_res; /* resource group block reservation */
struct gfs2_rgrpd *i_rgd;
u64 i_goal; /* goal block for allocations */
Expand Down
44 changes: 4 additions & 40 deletions trunk/fs/gfs2/inode.c
Original file line number Diff line number Diff line change
Expand Up @@ -521,12 +521,10 @@ static int make_dinode(struct gfs2_inode *dip, struct gfs2_glock *gl,
int error;

munge_mode_uid_gid(dip, &mode, &uid, &gid);
if (!gfs2_qadata_get(dip))
return -ENOMEM;

error = gfs2_quota_lock(dip, uid, gid);
if (error)
goto out;
return error;

error = gfs2_quota_check(dip, uid, gid);
if (error)
Expand All @@ -542,24 +540,17 @@ static int make_dinode(struct gfs2_inode *dip, struct gfs2_glock *gl,

out_quota:
gfs2_quota_unlock(dip);
out:
gfs2_qadata_put(dip);
return error;
}

static int link_dinode(struct gfs2_inode *dip, const struct qstr *name,
struct gfs2_inode *ip)
{
struct gfs2_sbd *sdp = GFS2_SB(&dip->i_inode);
struct gfs2_qadata *qa;
int alloc_required;
struct buffer_head *dibh;
int error;

qa = gfs2_qadata_get(dip);
if (!qa)
return -ENOMEM;

error = gfs2_quota_lock(dip, NO_QUOTA_CHANGE, NO_QUOTA_CHANGE);
if (error)
goto fail;
Expand Down Expand Up @@ -611,7 +602,6 @@ static int link_dinode(struct gfs2_inode *dip, const struct qstr *name,
gfs2_quota_unlock(dip);

fail:
gfs2_qadata_put(dip);
return error;
}

Expand Down Expand Up @@ -734,7 +724,6 @@ static int gfs2_create_inode(struct inode *dir, struct dentry *dentry,
if (gfs2_mb_reserved(dip))
gfs2_inplace_release(dip);
gfs2_quota_unlock(dip);
gfs2_qadata_put(dip);
mark_inode_dirty(inode);
gfs2_glock_dq_uninit_m(2, ghs);
d_instantiate(dentry, inode);
Expand Down Expand Up @@ -883,16 +872,9 @@ static int gfs2_link(struct dentry *old_dentry, struct inode *dir,
error = 0;

if (alloc_required) {
struct gfs2_qadata *qa = gfs2_qadata_get(dip);

if (!qa) {
error = -ENOMEM;
goto out_gunlock;
}

error = gfs2_quota_lock_check(dip);
if (error)
goto out_alloc;
goto out_gunlock;

error = gfs2_inplace_reserve(dip, sdp->sd_max_dirres);
if (error)
Expand Down Expand Up @@ -935,9 +917,6 @@ static int gfs2_link(struct dentry *old_dentry, struct inode *dir,
out_gunlock_q:
if (alloc_required)
gfs2_quota_unlock(dip);
out_alloc:
if (alloc_required)
gfs2_qadata_put(dip);
out_gunlock:
gfs2_glock_dq(ghs + 1);
out_child:
Expand Down Expand Up @@ -1374,16 +1353,9 @@ static int gfs2_rename(struct inode *odir, struct dentry *odentry,
goto out_gunlock;

if (alloc_required) {
struct gfs2_qadata *qa = gfs2_qadata_get(ndip);

if (!qa) {
error = -ENOMEM;
goto out_gunlock;
}

error = gfs2_quota_lock_check(ndip);
if (error)
goto out_alloc;
goto out_gunlock;

error = gfs2_inplace_reserve(ndip, sdp->sd_max_dirres);
if (error)
Expand Down Expand Up @@ -1444,9 +1416,6 @@ static int gfs2_rename(struct inode *odir, struct dentry *odentry,
out_gunlock_q:
if (alloc_required)
gfs2_quota_unlock(ndip);
out_alloc:
if (alloc_required)
gfs2_qadata_put(ndip);
out_gunlock:
while (x--) {
gfs2_glock_dq(ghs + x);
Expand Down Expand Up @@ -1607,12 +1576,9 @@ static int setattr_chown(struct inode *inode, struct iattr *attr)
if (!(attr->ia_valid & ATTR_GID) || ogid == ngid)
ogid = ngid = NO_QUOTA_CHANGE;

if (!gfs2_qadata_get(ip))
return -ENOMEM;

error = gfs2_quota_lock(ip, nuid, ngid);
if (error)
goto out_alloc;
return error;

if (ouid != NO_QUOTA_CHANGE || ogid != NO_QUOTA_CHANGE) {
error = gfs2_quota_check(ip, nuid, ngid);
Expand All @@ -1638,8 +1604,6 @@ static int setattr_chown(struct inode *inode, struct iattr *attr)
gfs2_trans_end(sdp);
out_gunlock_q:
gfs2_quota_unlock(ip);
out_alloc:
gfs2_qadata_put(ip);
return error;
}

Expand Down
1 change: 0 additions & 1 deletion trunk/fs/gfs2/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,6 @@ static void gfs2_init_inode_once(void *foo)
inode_init_once(&ip->i_inode);
init_rwsem(&ip->i_rw_mutex);
INIT_LIST_HEAD(&ip->i_trunc_list);
ip->i_qadata = NULL;
ip->i_res = NULL;
ip->i_hash_cache = NULL;
}
Expand Down
Loading

0 comments on commit 3c3867f

Please sign in to comment.