diff options
author | Bob Peterson <rpeterso@redhat.com> | 2011-11-21 13:36:17 -0500 |
---|---|---|
committer | Steven Whitehouse <swhiteho@redhat.com> | 2011-11-22 05:25:21 -0500 |
commit | 564e12b1157215171e7f3af5b70611ec7154327c (patch) | |
tree | f2a6e3394e59209f8e43a36f10f67bf1372c966c /fs/gfs2/xattr.c | |
parent | b3e47ca0c2427ec72a74e36c6408784b6098f2b5 (diff) |
GFS2: decouple quota allocations from block allocations
This patch separates the code pertaining to allocations into two
parts: quota-related information and block reservations.
This patch also moves all the block reservation structure allocations to
function gfs2_inplace_reserve to simplify the code, and moves
the frees to function gfs2_inplace_release.
Signed-off-by: Bob Peterson <rpeterso@redhat.com>
Signed-off-by: Steven Whitehouse <swhiteho@redhat.com>
Diffstat (limited to 'fs/gfs2/xattr.c')
-rw-r--r-- | fs/gfs2/xattr.c | 35 |
1 files changed, 16 insertions, 19 deletions
diff --git a/fs/gfs2/xattr.c b/fs/gfs2/xattr.c index ef74e1591b89..e9636591b5d5 100644 --- a/fs/gfs2/xattr.c +++ b/fs/gfs2/xattr.c | |||
@@ -321,11 +321,11 @@ static int ea_remove_unstuffed(struct gfs2_inode *ip, struct buffer_head *bh, | |||
321 | struct gfs2_ea_header *ea, | 321 | struct gfs2_ea_header *ea, |
322 | struct gfs2_ea_header *prev, int leave) | 322 | struct gfs2_ea_header *prev, int leave) |
323 | { | 323 | { |
324 | struct gfs2_alloc *al; | 324 | struct gfs2_qadata *qa; |
325 | int error; | 325 | int error; |
326 | 326 | ||
327 | al = gfs2_alloc_get(ip); | 327 | qa = gfs2_qadata_get(ip); |
328 | if (!al) | 328 | if (!qa) |
329 | return -ENOMEM; | 329 | return -ENOMEM; |
330 | 330 | ||
331 | error = gfs2_quota_hold(ip, NO_QUOTA_CHANGE, NO_QUOTA_CHANGE); | 331 | error = gfs2_quota_hold(ip, NO_QUOTA_CHANGE, NO_QUOTA_CHANGE); |
@@ -336,7 +336,7 @@ static int ea_remove_unstuffed(struct gfs2_inode *ip, struct buffer_head *bh, | |||
336 | 336 | ||
337 | gfs2_quota_unhold(ip); | 337 | gfs2_quota_unhold(ip); |
338 | out_alloc: | 338 | out_alloc: |
339 | gfs2_alloc_put(ip); | 339 | gfs2_qadata_put(ip); |
340 | return error; | 340 | return error; |
341 | } | 341 | } |
342 | 342 | ||
@@ -709,21 +709,19 @@ static int ea_alloc_skeleton(struct gfs2_inode *ip, struct gfs2_ea_request *er, | |||
709 | unsigned int blks, | 709 | unsigned int blks, |
710 | ea_skeleton_call_t skeleton_call, void *private) | 710 | ea_skeleton_call_t skeleton_call, void *private) |
711 | { | 711 | { |
712 | struct gfs2_alloc *al; | 712 | struct gfs2_qadata *qa; |
713 | struct buffer_head *dibh; | 713 | struct buffer_head *dibh; |
714 | int error; | 714 | int error; |
715 | 715 | ||
716 | al = gfs2_alloc_get(ip); | 716 | qa = gfs2_qadata_get(ip); |
717 | if (!al) | 717 | if (!qa) |
718 | return -ENOMEM; | 718 | return -ENOMEM; |
719 | 719 | ||
720 | error = gfs2_quota_lock_check(ip); | 720 | error = gfs2_quota_lock_check(ip); |
721 | if (error) | 721 | if (error) |
722 | goto out; | 722 | goto out; |
723 | 723 | ||
724 | al->al_requested = blks; | 724 | error = gfs2_inplace_reserve(ip, blks); |
725 | |||
726 | error = gfs2_inplace_reserve(ip); | ||
727 | if (error) | 725 | if (error) |
728 | goto out_gunlock_q; | 726 | goto out_gunlock_q; |
729 | 727 | ||
@@ -752,7 +750,7 @@ out_ipres: | |||
752 | out_gunlock_q: | 750 | out_gunlock_q: |
753 | gfs2_quota_unlock(ip); | 751 | gfs2_quota_unlock(ip); |
754 | out: | 752 | out: |
755 | gfs2_alloc_put(ip); | 753 | gfs2_qadata_put(ip); |
756 | return error; | 754 | return error; |
757 | } | 755 | } |
758 | 756 | ||
@@ -1436,9 +1434,9 @@ out: | |||
1436 | static int ea_dealloc_block(struct gfs2_inode *ip) | 1434 | static int ea_dealloc_block(struct gfs2_inode *ip) |
1437 | { | 1435 | { |
1438 | struct gfs2_sbd *sdp = GFS2_SB(&ip->i_inode); | 1436 | struct gfs2_sbd *sdp = GFS2_SB(&ip->i_inode); |
1439 | struct gfs2_alloc *al = ip->i_alloc; | ||
1440 | struct gfs2_rgrpd *rgd; | 1437 | struct gfs2_rgrpd *rgd; |
1441 | struct buffer_head *dibh; | 1438 | struct buffer_head *dibh; |
1439 | struct gfs2_holder gh; | ||
1442 | int error; | 1440 | int error; |
1443 | 1441 | ||
1444 | rgd = gfs2_blk2rgrpd(sdp, ip->i_eattr); | 1442 | rgd = gfs2_blk2rgrpd(sdp, ip->i_eattr); |
@@ -1447,8 +1445,7 @@ static int ea_dealloc_block(struct gfs2_inode *ip) | |||
1447 | return -EIO; | 1445 | return -EIO; |
1448 | } | 1446 | } |
1449 | 1447 | ||
1450 | error = gfs2_glock_nq_init(rgd->rd_gl, LM_ST_EXCLUSIVE, 0, | 1448 | error = gfs2_glock_nq_init(rgd->rd_gl, LM_ST_EXCLUSIVE, 0, &gh); |
1451 | &al->al_rgd_gh); | ||
1452 | if (error) | 1449 | if (error) |
1453 | return error; | 1450 | return error; |
1454 | 1451 | ||
@@ -1472,7 +1469,7 @@ static int ea_dealloc_block(struct gfs2_inode *ip) | |||
1472 | gfs2_trans_end(sdp); | 1469 | gfs2_trans_end(sdp); |
1473 | 1470 | ||
1474 | out_gunlock: | 1471 | out_gunlock: |
1475 | gfs2_glock_dq_uninit(&al->al_rgd_gh); | 1472 | gfs2_glock_dq_uninit(&gh); |
1476 | return error; | 1473 | return error; |
1477 | } | 1474 | } |
1478 | 1475 | ||
@@ -1485,11 +1482,11 @@ out_gunlock: | |||
1485 | 1482 | ||
1486 | int gfs2_ea_dealloc(struct gfs2_inode *ip) | 1483 | int gfs2_ea_dealloc(struct gfs2_inode *ip) |
1487 | { | 1484 | { |
1488 | struct gfs2_alloc *al; | 1485 | struct gfs2_qadata *qa; |
1489 | int error; | 1486 | int error; |
1490 | 1487 | ||
1491 | al = gfs2_alloc_get(ip); | 1488 | qa = gfs2_qadata_get(ip); |
1492 | if (!al) | 1489 | if (!qa) |
1493 | return -ENOMEM; | 1490 | return -ENOMEM; |
1494 | 1491 | ||
1495 | error = gfs2_quota_hold(ip, NO_QUOTA_CHANGE, NO_QUOTA_CHANGE); | 1492 | error = gfs2_quota_hold(ip, NO_QUOTA_CHANGE, NO_QUOTA_CHANGE); |
@@ -1511,7 +1508,7 @@ int gfs2_ea_dealloc(struct gfs2_inode *ip) | |||
1511 | out_quota: | 1508 | out_quota: |
1512 | gfs2_quota_unhold(ip); | 1509 | gfs2_quota_unhold(ip); |
1513 | out_alloc: | 1510 | out_alloc: |
1514 | gfs2_alloc_put(ip); | 1511 | gfs2_qadata_put(ip); |
1515 | return error; | 1512 | return error; |
1516 | } | 1513 | } |
1517 | 1514 | ||