aboutsummaryrefslogtreecommitdiffstats
path: root/fs/gfs2/inode.c
diff options
context:
space:
mode:
authorBob Peterson <rpeterso@redhat.com>2012-05-18 09:28:23 -0400
committerSteven Whitehouse <swhiteho@redhat.com>2012-06-06 06:20:22 -0400
commit5407e24229408d7586ee451a384fc13e4a2332be (patch)
tree7534b0d0fc69de50b6156ec4e384a71acf01dea1 /fs/gfs2/inode.c
parent0a305e496059a113f93bdd3ad27a5aaa917fe34d (diff)
GFS2: Fold quota data into the reservations struct
This patch moves the ancillary quota data structures into the block reservations structure. This saves GFS2 some time and effort in allocating and deallocating the qadata structure. Signed-off-by: Bob Peterson <rpeterso@redhat.com> Signed-off-by: Steven Whitehouse <swhiteho@redhat.com>
Diffstat (limited to 'fs/gfs2/inode.c')
-rw-r--r--fs/gfs2/inode.c44
1 files changed, 4 insertions, 40 deletions
diff --git a/fs/gfs2/inode.c b/fs/gfs2/inode.c
index 2a1b4b5a648c..2b035e0959b2 100644
--- a/fs/gfs2/inode.c
+++ b/fs/gfs2/inode.c
@@ -521,12 +521,10 @@ static int make_dinode(struct gfs2_inode *dip, struct gfs2_glock *gl,
521 int error; 521 int error;
522 522
523 munge_mode_uid_gid(dip, &mode, &uid, &gid); 523 munge_mode_uid_gid(dip, &mode, &uid, &gid);
524 if (!gfs2_qadata_get(dip))
525 return -ENOMEM;
526 524
527 error = gfs2_quota_lock(dip, uid, gid); 525 error = gfs2_quota_lock(dip, uid, gid);
528 if (error) 526 if (error)
529 goto out; 527 return error;
530 528
531 error = gfs2_quota_check(dip, uid, gid); 529 error = gfs2_quota_check(dip, uid, gid);
532 if (error) 530 if (error)
@@ -542,8 +540,6 @@ static int make_dinode(struct gfs2_inode *dip, struct gfs2_glock *gl,
542 540
543out_quota: 541out_quota:
544 gfs2_quota_unlock(dip); 542 gfs2_quota_unlock(dip);
545out:
546 gfs2_qadata_put(dip);
547 return error; 543 return error;
548} 544}
549 545
@@ -551,15 +547,10 @@ static int link_dinode(struct gfs2_inode *dip, const struct qstr *name,
551 struct gfs2_inode *ip) 547 struct gfs2_inode *ip)
552{ 548{
553 struct gfs2_sbd *sdp = GFS2_SB(&dip->i_inode); 549 struct gfs2_sbd *sdp = GFS2_SB(&dip->i_inode);
554 struct gfs2_qadata *qa;
555 int alloc_required; 550 int alloc_required;
556 struct buffer_head *dibh; 551 struct buffer_head *dibh;
557 int error; 552 int error;
558 553
559 qa = gfs2_qadata_get(dip);
560 if (!qa)
561 return -ENOMEM;
562
563 error = gfs2_quota_lock(dip, NO_QUOTA_CHANGE, NO_QUOTA_CHANGE); 554 error = gfs2_quota_lock(dip, NO_QUOTA_CHANGE, NO_QUOTA_CHANGE);
564 if (error) 555 if (error)
565 goto fail; 556 goto fail;
@@ -611,7 +602,6 @@ fail_quota_locks:
611 gfs2_quota_unlock(dip); 602 gfs2_quota_unlock(dip);
612 603
613fail: 604fail:
614 gfs2_qadata_put(dip);
615 return error; 605 return error;
616} 606}
617 607
@@ -734,7 +724,6 @@ static int gfs2_create_inode(struct inode *dir, struct dentry *dentry,
734 if (gfs2_mb_reserved(dip)) 724 if (gfs2_mb_reserved(dip))
735 gfs2_inplace_release(dip); 725 gfs2_inplace_release(dip);
736 gfs2_quota_unlock(dip); 726 gfs2_quota_unlock(dip);
737 gfs2_qadata_put(dip);
738 mark_inode_dirty(inode); 727 mark_inode_dirty(inode);
739 gfs2_glock_dq_uninit_m(2, ghs); 728 gfs2_glock_dq_uninit_m(2, ghs);
740 d_instantiate(dentry, inode); 729 d_instantiate(dentry, inode);
@@ -883,16 +872,9 @@ static int gfs2_link(struct dentry *old_dentry, struct inode *dir,
883 error = 0; 872 error = 0;
884 873
885 if (alloc_required) { 874 if (alloc_required) {
886 struct gfs2_qadata *qa = gfs2_qadata_get(dip);
887
888 if (!qa) {
889 error = -ENOMEM;
890 goto out_gunlock;
891 }
892
893 error = gfs2_quota_lock_check(dip); 875 error = gfs2_quota_lock_check(dip);
894 if (error) 876 if (error)
895 goto out_alloc; 877 goto out_gunlock;
896 878
897 error = gfs2_inplace_reserve(dip, sdp->sd_max_dirres); 879 error = gfs2_inplace_reserve(dip, sdp->sd_max_dirres);
898 if (error) 880 if (error)
@@ -935,9 +917,6 @@ out_ipres:
935out_gunlock_q: 917out_gunlock_q:
936 if (alloc_required) 918 if (alloc_required)
937 gfs2_quota_unlock(dip); 919 gfs2_quota_unlock(dip);
938out_alloc:
939 if (alloc_required)
940 gfs2_qadata_put(dip);
941out_gunlock: 920out_gunlock:
942 gfs2_glock_dq(ghs + 1); 921 gfs2_glock_dq(ghs + 1);
943out_child: 922out_child:
@@ -1374,16 +1353,9 @@ static int gfs2_rename(struct inode *odir, struct dentry *odentry,
1374 goto out_gunlock; 1353 goto out_gunlock;
1375 1354
1376 if (alloc_required) { 1355 if (alloc_required) {
1377 struct gfs2_qadata *qa = gfs2_qadata_get(ndip);
1378
1379 if (!qa) {
1380 error = -ENOMEM;
1381 goto out_gunlock;
1382 }
1383
1384 error = gfs2_quota_lock_check(ndip); 1356 error = gfs2_quota_lock_check(ndip);
1385 if (error) 1357 if (error)
1386 goto out_alloc; 1358 goto out_gunlock;
1387 1359
1388 error = gfs2_inplace_reserve(ndip, sdp->sd_max_dirres); 1360 error = gfs2_inplace_reserve(ndip, sdp->sd_max_dirres);
1389 if (error) 1361 if (error)
@@ -1444,9 +1416,6 @@ out_ipreserv:
1444out_gunlock_q: 1416out_gunlock_q:
1445 if (alloc_required) 1417 if (alloc_required)
1446 gfs2_quota_unlock(ndip); 1418 gfs2_quota_unlock(ndip);
1447out_alloc:
1448 if (alloc_required)
1449 gfs2_qadata_put(ndip);
1450out_gunlock: 1419out_gunlock:
1451 while (x--) { 1420 while (x--) {
1452 gfs2_glock_dq(ghs + x); 1421 gfs2_glock_dq(ghs + x);
@@ -1607,12 +1576,9 @@ static int setattr_chown(struct inode *inode, struct iattr *attr)
1607 if (!(attr->ia_valid & ATTR_GID) || ogid == ngid) 1576 if (!(attr->ia_valid & ATTR_GID) || ogid == ngid)
1608 ogid = ngid = NO_QUOTA_CHANGE; 1577 ogid = ngid = NO_QUOTA_CHANGE;
1609 1578
1610 if (!gfs2_qadata_get(ip))
1611 return -ENOMEM;
1612
1613 error = gfs2_quota_lock(ip, nuid, ngid); 1579 error = gfs2_quota_lock(ip, nuid, ngid);
1614 if (error) 1580 if (error)
1615 goto out_alloc; 1581 return error;
1616 1582
1617 if (ouid != NO_QUOTA_CHANGE || ogid != NO_QUOTA_CHANGE) { 1583 if (ouid != NO_QUOTA_CHANGE || ogid != NO_QUOTA_CHANGE) {
1618 error = gfs2_quota_check(ip, nuid, ngid); 1584 error = gfs2_quota_check(ip, nuid, ngid);
@@ -1638,8 +1604,6 @@ out_end_trans:
1638 gfs2_trans_end(sdp); 1604 gfs2_trans_end(sdp);
1639out_gunlock_q: 1605out_gunlock_q:
1640 gfs2_quota_unlock(ip); 1606 gfs2_quota_unlock(ip);
1641out_alloc:
1642 gfs2_qadata_put(ip);
1643 return error; 1607 return error;
1644} 1608}
1645 1609