diff options
author | Bob Peterson <rpeterso@redhat.com> | 2008-01-28 19:38:07 -0500 |
---|---|---|
committer | Steven Whitehouse <swhiteho@redhat.com> | 2008-03-31 05:40:10 -0400 |
commit | 42d52e3818751633656fb90df1bd5cb5362fa8cc (patch) | |
tree | 83097388e3e82f921cffa79499d30a5f09d6a020 /fs | |
parent | 6bdd9be628fa5f4dd14eb89ebddc12840d684277 (diff) |
[GFS2] Combine rg_flags and rd_flags
This patch reduces the memory required by GFS2 by combining
the rd_flags and rg_flags (in core only).
Signed-off-by: Bob Peterson <rpeterso@redhat.com>
Signed-off-by: Steven Whitehouse <swhiteho@redhat.com>
Diffstat (limited to 'fs')
-rw-r--r-- | fs/gfs2/incore.h | 6 | ||||
-rw-r--r-- | fs/gfs2/rgrp.c | 36 |
2 files changed, 26 insertions, 16 deletions
diff --git a/fs/gfs2/incore.h b/fs/gfs2/incore.h index 7ae12d2b6262..39bab7b213e9 100644 --- a/fs/gfs2/incore.h +++ b/fs/gfs2/incore.h | |||
@@ -69,7 +69,6 @@ struct gfs2_bitmap { | |||
69 | }; | 69 | }; |
70 | 70 | ||
71 | struct gfs2_rgrp_host { | 71 | struct gfs2_rgrp_host { |
72 | u32 rg_flags; | ||
73 | u32 rg_free; | 72 | u32 rg_free; |
74 | u32 rg_dinodes; | 73 | u32 rg_dinodes; |
75 | u64 rg_igeneration; | 74 | u64 rg_igeneration; |
@@ -95,8 +94,9 @@ struct gfs2_rgrpd { | |||
95 | u32 rd_last_alloc_data; | 94 | u32 rd_last_alloc_data; |
96 | u32 rd_last_alloc_meta; | 95 | u32 rd_last_alloc_meta; |
97 | struct gfs2_sbd *rd_sbd; | 96 | struct gfs2_sbd *rd_sbd; |
98 | unsigned long rd_flags; | 97 | unsigned char rd_flags; |
99 | #define GFS2_RDF_CHECK 0x0001 /* Need to check for unlinked inodes */ | 98 | #define GFS2_RDF_CHECK 0x01 /* Need to check for unlinked inodes */ |
99 | #define GFS2_RDF_NOALLOC 0x02 /* rg prohibits allocation */ | ||
100 | }; | 100 | }; |
101 | 101 | ||
102 | enum gfs2_state_bits { | 102 | enum gfs2_state_bits { |
diff --git a/fs/gfs2/rgrp.c b/fs/gfs2/rgrp.c index dc7e83eed32d..da60ce8c5d7d 100644 --- a/fs/gfs2/rgrp.c +++ b/fs/gfs2/rgrp.c | |||
@@ -655,21 +655,31 @@ int gfs2_rindex_hold(struct gfs2_sbd *sdp, struct gfs2_holder *ri_gh) | |||
655 | return error; | 655 | return error; |
656 | } | 656 | } |
657 | 657 | ||
658 | static void gfs2_rgrp_in(struct gfs2_rgrp_host *rg, const void *buf) | 658 | static void gfs2_rgrp_in(struct gfs2_rgrpd *rgd, const void *buf) |
659 | { | 659 | { |
660 | const struct gfs2_rgrp *str = buf; | 660 | const struct gfs2_rgrp *str = buf; |
661 | struct gfs2_rgrp_host *rg = &rgd->rd_rg; | ||
662 | u32 rg_flags; | ||
661 | 663 | ||
662 | rg->rg_flags = be32_to_cpu(str->rg_flags); | 664 | rg_flags = be32_to_cpu(str->rg_flags); |
665 | if (rg_flags & GFS2_RGF_NOALLOC) | ||
666 | rgd->rd_flags |= GFS2_RDF_NOALLOC; | ||
667 | else | ||
668 | rgd->rd_flags &= ~GFS2_RDF_NOALLOC; | ||
663 | rg->rg_free = be32_to_cpu(str->rg_free); | 669 | rg->rg_free = be32_to_cpu(str->rg_free); |
664 | rg->rg_dinodes = be32_to_cpu(str->rg_dinodes); | 670 | rg->rg_dinodes = be32_to_cpu(str->rg_dinodes); |
665 | rg->rg_igeneration = be64_to_cpu(str->rg_igeneration); | 671 | rg->rg_igeneration = be64_to_cpu(str->rg_igeneration); |
666 | } | 672 | } |
667 | 673 | ||
668 | static void gfs2_rgrp_out(const struct gfs2_rgrp_host *rg, void *buf) | 674 | static void gfs2_rgrp_out(struct gfs2_rgrpd *rgd, void *buf) |
669 | { | 675 | { |
670 | struct gfs2_rgrp *str = buf; | 676 | struct gfs2_rgrp *str = buf; |
677 | struct gfs2_rgrp_host *rg = &rgd->rd_rg; | ||
678 | u32 rg_flags = 0; | ||
671 | 679 | ||
672 | str->rg_flags = cpu_to_be32(rg->rg_flags); | 680 | if (rgd->rd_flags & GFS2_RDF_NOALLOC) |
681 | rg_flags |= GFS2_RGF_NOALLOC; | ||
682 | str->rg_flags = cpu_to_be32(rg_flags); | ||
673 | str->rg_free = cpu_to_be32(rg->rg_free); | 683 | str->rg_free = cpu_to_be32(rg->rg_free); |
674 | str->rg_dinodes = cpu_to_be32(rg->rg_dinodes); | 684 | str->rg_dinodes = cpu_to_be32(rg->rg_dinodes); |
675 | str->__pad = cpu_to_be32(0); | 685 | str->__pad = cpu_to_be32(0); |
@@ -727,7 +737,7 @@ int gfs2_rgrp_bh_get(struct gfs2_rgrpd *rgd) | |||
727 | } | 737 | } |
728 | 738 | ||
729 | if (rgd->rd_rg_vn != gl->gl_vn) { | 739 | if (rgd->rd_rg_vn != gl->gl_vn) { |
730 | gfs2_rgrp_in(&rgd->rd_rg, (rgd->rd_bits[0].bi_bh)->b_data); | 740 | gfs2_rgrp_in(rgd, (rgd->rd_bits[0].bi_bh)->b_data); |
731 | rgd->rd_rg_vn = gl->gl_vn; | 741 | rgd->rd_rg_vn = gl->gl_vn; |
732 | } | 742 | } |
733 | 743 | ||
@@ -840,7 +850,7 @@ static int try_rgrp_fit(struct gfs2_rgrpd *rgd, struct gfs2_alloc *al) | |||
840 | struct gfs2_sbd *sdp = rgd->rd_sbd; | 850 | struct gfs2_sbd *sdp = rgd->rd_sbd; |
841 | int ret = 0; | 851 | int ret = 0; |
842 | 852 | ||
843 | if (rgd->rd_rg.rg_flags & GFS2_RGF_NOALLOC) | 853 | if (rgd->rd_flags & GFS2_RDF_NOALLOC) |
844 | return 0; | 854 | return 0; |
845 | 855 | ||
846 | spin_lock(&sdp->sd_rindex_spin); | 856 | spin_lock(&sdp->sd_rindex_spin); |
@@ -1431,7 +1441,7 @@ u64 gfs2_alloc_data(struct gfs2_inode *ip) | |||
1431 | rgd->rd_rg.rg_free--; | 1441 | rgd->rd_rg.rg_free--; |
1432 | 1442 | ||
1433 | gfs2_trans_add_bh(rgd->rd_gl, rgd->rd_bits[0].bi_bh, 1); | 1443 | gfs2_trans_add_bh(rgd->rd_gl, rgd->rd_bits[0].bi_bh, 1); |
1434 | gfs2_rgrp_out(&rgd->rd_rg, rgd->rd_bits[0].bi_bh->b_data); | 1444 | gfs2_rgrp_out(rgd, rgd->rd_bits[0].bi_bh->b_data); |
1435 | 1445 | ||
1436 | al->al_alloced++; | 1446 | al->al_alloced++; |
1437 | 1447 | ||
@@ -1476,7 +1486,7 @@ u64 gfs2_alloc_meta(struct gfs2_inode *ip) | |||
1476 | rgd->rd_rg.rg_free--; | 1486 | rgd->rd_rg.rg_free--; |
1477 | 1487 | ||
1478 | gfs2_trans_add_bh(rgd->rd_gl, rgd->rd_bits[0].bi_bh, 1); | 1488 | gfs2_trans_add_bh(rgd->rd_gl, rgd->rd_bits[0].bi_bh, 1); |
1479 | gfs2_rgrp_out(&rgd->rd_rg, rgd->rd_bits[0].bi_bh->b_data); | 1489 | gfs2_rgrp_out(rgd, rgd->rd_bits[0].bi_bh->b_data); |
1480 | 1490 | ||
1481 | al->al_alloced++; | 1491 | al->al_alloced++; |
1482 | 1492 | ||
@@ -1519,7 +1529,7 @@ u64 gfs2_alloc_di(struct gfs2_inode *dip, u64 *generation) | |||
1519 | rgd->rd_rg.rg_dinodes++; | 1529 | rgd->rd_rg.rg_dinodes++; |
1520 | *generation = rgd->rd_rg.rg_igeneration++; | 1530 | *generation = rgd->rd_rg.rg_igeneration++; |
1521 | gfs2_trans_add_bh(rgd->rd_gl, rgd->rd_bits[0].bi_bh, 1); | 1531 | gfs2_trans_add_bh(rgd->rd_gl, rgd->rd_bits[0].bi_bh, 1); |
1522 | gfs2_rgrp_out(&rgd->rd_rg, rgd->rd_bits[0].bi_bh->b_data); | 1532 | gfs2_rgrp_out(rgd, rgd->rd_bits[0].bi_bh->b_data); |
1523 | 1533 | ||
1524 | al->al_alloced++; | 1534 | al->al_alloced++; |
1525 | 1535 | ||
@@ -1553,7 +1563,7 @@ void gfs2_free_data(struct gfs2_inode *ip, u64 bstart, u32 blen) | |||
1553 | rgd->rd_rg.rg_free += blen; | 1563 | rgd->rd_rg.rg_free += blen; |
1554 | 1564 | ||
1555 | gfs2_trans_add_bh(rgd->rd_gl, rgd->rd_bits[0].bi_bh, 1); | 1565 | gfs2_trans_add_bh(rgd->rd_gl, rgd->rd_bits[0].bi_bh, 1); |
1556 | gfs2_rgrp_out(&rgd->rd_rg, rgd->rd_bits[0].bi_bh->b_data); | 1566 | gfs2_rgrp_out(rgd, rgd->rd_bits[0].bi_bh->b_data); |
1557 | 1567 | ||
1558 | gfs2_trans_add_rg(rgd); | 1568 | gfs2_trans_add_rg(rgd); |
1559 | 1569 | ||
@@ -1581,7 +1591,7 @@ void gfs2_free_meta(struct gfs2_inode *ip, u64 bstart, u32 blen) | |||
1581 | rgd->rd_rg.rg_free += blen; | 1591 | rgd->rd_rg.rg_free += blen; |
1582 | 1592 | ||
1583 | gfs2_trans_add_bh(rgd->rd_gl, rgd->rd_bits[0].bi_bh, 1); | 1593 | gfs2_trans_add_bh(rgd->rd_gl, rgd->rd_bits[0].bi_bh, 1); |
1584 | gfs2_rgrp_out(&rgd->rd_rg, rgd->rd_bits[0].bi_bh->b_data); | 1594 | gfs2_rgrp_out(rgd, rgd->rd_bits[0].bi_bh->b_data); |
1585 | 1595 | ||
1586 | gfs2_trans_add_rg(rgd); | 1596 | gfs2_trans_add_rg(rgd); |
1587 | 1597 | ||
@@ -1601,7 +1611,7 @@ void gfs2_unlink_di(struct inode *inode) | |||
1601 | if (!rgd) | 1611 | if (!rgd) |
1602 | return; | 1612 | return; |
1603 | gfs2_trans_add_bh(rgd->rd_gl, rgd->rd_bits[0].bi_bh, 1); | 1613 | gfs2_trans_add_bh(rgd->rd_gl, rgd->rd_bits[0].bi_bh, 1); |
1604 | gfs2_rgrp_out(&rgd->rd_rg, rgd->rd_bits[0].bi_bh->b_data); | 1614 | gfs2_rgrp_out(rgd, rgd->rd_bits[0].bi_bh->b_data); |
1605 | gfs2_trans_add_rg(rgd); | 1615 | gfs2_trans_add_rg(rgd); |
1606 | } | 1616 | } |
1607 | 1617 | ||
@@ -1621,7 +1631,7 @@ static void gfs2_free_uninit_di(struct gfs2_rgrpd *rgd, u64 blkno) | |||
1621 | rgd->rd_rg.rg_free++; | 1631 | rgd->rd_rg.rg_free++; |
1622 | 1632 | ||
1623 | gfs2_trans_add_bh(rgd->rd_gl, rgd->rd_bits[0].bi_bh, 1); | 1633 | gfs2_trans_add_bh(rgd->rd_gl, rgd->rd_bits[0].bi_bh, 1); |
1624 | gfs2_rgrp_out(&rgd->rd_rg, rgd->rd_bits[0].bi_bh->b_data); | 1634 | gfs2_rgrp_out(rgd, rgd->rd_bits[0].bi_bh->b_data); |
1625 | 1635 | ||
1626 | gfs2_statfs_change(sdp, 0, +1, -1); | 1636 | gfs2_statfs_change(sdp, 0, +1, -1); |
1627 | gfs2_trans_add_rg(rgd); | 1637 | gfs2_trans_add_rg(rgd); |