diff options
author | Steven Whitehouse <swhiteho@redhat.com> | 2008-02-01 09:52:30 -0500 |
---|---|---|
committer | Steven Whitehouse <swhiteho@redhat.com> | 2008-03-31 05:40:45 -0400 |
commit | 1639431a3f57b43da1e15e9268a1d691ac01ba26 (patch) | |
tree | 0e8147c9009c917566cf03c7e23f6ea4ffda8d72 /fs/gfs2/rgrp.c | |
parent | 5731be53e3d82aedd06e02574f833a57b07a08d2 (diff) |
[GFS2] Merge gfs2_alloc_meta and gfs2_alloc_data
Thanks to the preceeding patches, the only difference between
these two functions is their name. We can thus merge them
and call the new function gfs2_alloc_block to reflect the
fact that it can allocate either kind of block.
Signed-off-by: Steven Whitehouse <swhiteho@redhat.com>
Diffstat (limited to 'fs/gfs2/rgrp.c')
-rw-r--r-- | fs/gfs2/rgrp.c | 51 |
1 files changed, 3 insertions, 48 deletions
diff --git a/fs/gfs2/rgrp.c b/fs/gfs2/rgrp.c index 9f28463e62e5..274a2df13f02 100644 --- a/fs/gfs2/rgrp.c +++ b/fs/gfs2/rgrp.c | |||
@@ -1405,58 +1405,13 @@ static struct gfs2_rgrpd *rgblk_free(struct gfs2_sbd *sdp, u64 bstart, | |||
1405 | } | 1405 | } |
1406 | 1406 | ||
1407 | /** | 1407 | /** |
1408 | * gfs2_alloc_data - Allocate a data block | 1408 | * gfs2_alloc_block - Allocate a block |
1409 | * @ip: the inode to allocate the data block for | 1409 | * @ip: the inode to allocate the block for |
1410 | * | 1410 | * |
1411 | * Returns: the allocated block | 1411 | * Returns: the allocated block |
1412 | */ | 1412 | */ |
1413 | 1413 | ||
1414 | u64 gfs2_alloc_data(struct gfs2_inode *ip) | 1414 | u64 gfs2_alloc_block(struct gfs2_inode *ip) |
1415 | { | ||
1416 | struct gfs2_sbd *sdp = GFS2_SB(&ip->i_inode); | ||
1417 | struct gfs2_alloc *al = ip->i_alloc; | ||
1418 | struct gfs2_rgrpd *rgd = al->al_rgd; | ||
1419 | u32 goal, blk; | ||
1420 | u64 block; | ||
1421 | |||
1422 | if (rgrp_contains_block(rgd, ip->i_goal)) | ||
1423 | goal = ip->i_goal - rgd->rd_data0; | ||
1424 | else | ||
1425 | goal = rgd->rd_last_alloc; | ||
1426 | |||
1427 | blk = rgblk_search(rgd, goal, GFS2_BLKST_FREE, GFS2_BLKST_USED); | ||
1428 | BUG_ON(blk == BFITNOENT); | ||
1429 | rgd->rd_last_alloc = blk; | ||
1430 | |||
1431 | block = rgd->rd_data0 + blk; | ||
1432 | ip->i_goal = block; | ||
1433 | |||
1434 | gfs2_assert_withdraw(sdp, rgd->rd_rg.rg_free); | ||
1435 | rgd->rd_rg.rg_free--; | ||
1436 | |||
1437 | gfs2_trans_add_bh(rgd->rd_gl, rgd->rd_bits[0].bi_bh, 1); | ||
1438 | gfs2_rgrp_out(rgd, rgd->rd_bits[0].bi_bh->b_data); | ||
1439 | |||
1440 | al->al_alloced++; | ||
1441 | |||
1442 | gfs2_statfs_change(sdp, 0, -1, 0); | ||
1443 | gfs2_quota_change(ip, +1, ip->i_inode.i_uid, ip->i_inode.i_gid); | ||
1444 | |||
1445 | spin_lock(&sdp->sd_rindex_spin); | ||
1446 | rgd->rd_free_clone--; | ||
1447 | spin_unlock(&sdp->sd_rindex_spin); | ||
1448 | |||
1449 | return block; | ||
1450 | } | ||
1451 | |||
1452 | /** | ||
1453 | * gfs2_alloc_meta - Allocate a metadata block | ||
1454 | * @ip: the inode to allocate the metadata block for | ||
1455 | * | ||
1456 | * Returns: the allocated block | ||
1457 | */ | ||
1458 | |||
1459 | u64 gfs2_alloc_meta(struct gfs2_inode *ip) | ||
1460 | { | 1415 | { |
1461 | struct gfs2_sbd *sdp = GFS2_SB(&ip->i_inode); | 1416 | struct gfs2_sbd *sdp = GFS2_SB(&ip->i_inode); |
1462 | struct gfs2_alloc *al = ip->i_alloc; | 1417 | struct gfs2_alloc *al = ip->i_alloc; |