diff options
author | Steven Whitehouse <swhiteho@redhat.com> | 2008-01-10 10:18:55 -0500 |
---|---|---|
committer | Steven Whitehouse <swhiteho@redhat.com> | 2008-01-25 03:18:25 -0500 |
commit | 6dbd822487d0a9f14432cb4680415b80656b63a2 (patch) | |
tree | f0391d598c27cd7c39c67cfa13799a784f4c389a /fs/gfs2/rgrp.c | |
parent | ac39aadd0440ae696e6dacaa8006ce1737b17008 (diff) |
[GFS2] Reduce inode size by moving i_alloc out of line
It is possible to reduce the size of GFS2 inodes by taking the i_alloc
structure out of the gfs2_inode. This patch allocates the i_alloc
structure whenever its needed, and frees it afterward. This decreases
the amount of low memory we use at the expense of requiring a memory
allocation for each page or partial page that we write. A quick test
with postmark shows that the overhead is not measurable and I also note
that OCFS2 use the same approach.
In the future I'd like to solve the problem by shrinking down the size
of the members of the i_alloc structure, but for now, this reduces the
immediate problem of using too much low-memory on x86 and doesn't add
too much overhead.
Signed-off-by: Steven Whitehouse <swhiteho@redhat.com>
Diffstat (limited to 'fs/gfs2/rgrp.c')
-rw-r--r-- | fs/gfs2/rgrp.c | 20 |
1 files changed, 9 insertions, 11 deletions
diff --git a/fs/gfs2/rgrp.c b/fs/gfs2/rgrp.c index 68c4bf363c46..3552110b2e5f 100644 --- a/fs/gfs2/rgrp.c +++ b/fs/gfs2/rgrp.c | |||
@@ -819,11 +819,9 @@ void gfs2_rgrp_repolish_clones(struct gfs2_rgrpd *rgd) | |||
819 | 819 | ||
820 | struct gfs2_alloc *gfs2_alloc_get(struct gfs2_inode *ip) | 820 | struct gfs2_alloc *gfs2_alloc_get(struct gfs2_inode *ip) |
821 | { | 821 | { |
822 | struct gfs2_alloc *al = &ip->i_alloc; | 822 | BUG_ON(ip->i_alloc != NULL); |
823 | 823 | ip->i_alloc = kzalloc(sizeof(struct gfs2_alloc), GFP_KERNEL); | |
824 | /* FIXME: Should assert that the correct locks are held here... */ | 824 | return ip->i_alloc; |
825 | memset(al, 0, sizeof(*al)); | ||
826 | return al; | ||
827 | } | 825 | } |
828 | 826 | ||
829 | /** | 827 | /** |
@@ -1061,7 +1059,7 @@ static struct inode *get_local_rgrp(struct gfs2_inode *ip, u64 *last_unlinked) | |||
1061 | struct inode *inode = NULL; | 1059 | struct inode *inode = NULL; |
1062 | struct gfs2_sbd *sdp = GFS2_SB(&ip->i_inode); | 1060 | struct gfs2_sbd *sdp = GFS2_SB(&ip->i_inode); |
1063 | struct gfs2_rgrpd *rgd, *begin = NULL; | 1061 | struct gfs2_rgrpd *rgd, *begin = NULL; |
1064 | struct gfs2_alloc *al = &ip->i_alloc; | 1062 | struct gfs2_alloc *al = ip->i_alloc; |
1065 | int flags = LM_FLAG_TRY; | 1063 | int flags = LM_FLAG_TRY; |
1066 | int skipped = 0; | 1064 | int skipped = 0; |
1067 | int loops = 0; | 1065 | int loops = 0; |
@@ -1176,7 +1174,7 @@ out: | |||
1176 | int gfs2_inplace_reserve_i(struct gfs2_inode *ip, char *file, unsigned int line) | 1174 | int gfs2_inplace_reserve_i(struct gfs2_inode *ip, char *file, unsigned int line) |
1177 | { | 1175 | { |
1178 | struct gfs2_sbd *sdp = GFS2_SB(&ip->i_inode); | 1176 | struct gfs2_sbd *sdp = GFS2_SB(&ip->i_inode); |
1179 | struct gfs2_alloc *al = &ip->i_alloc; | 1177 | struct gfs2_alloc *al = ip->i_alloc; |
1180 | struct inode *inode; | 1178 | struct inode *inode; |
1181 | int error = 0; | 1179 | int error = 0; |
1182 | u64 last_unlinked = NO_BLOCK; | 1180 | u64 last_unlinked = NO_BLOCK; |
@@ -1222,7 +1220,7 @@ try_again: | |||
1222 | void gfs2_inplace_release(struct gfs2_inode *ip) | 1220 | void gfs2_inplace_release(struct gfs2_inode *ip) |
1223 | { | 1221 | { |
1224 | struct gfs2_sbd *sdp = GFS2_SB(&ip->i_inode); | 1222 | struct gfs2_sbd *sdp = GFS2_SB(&ip->i_inode); |
1225 | struct gfs2_alloc *al = &ip->i_alloc; | 1223 | struct gfs2_alloc *al = ip->i_alloc; |
1226 | 1224 | ||
1227 | if (gfs2_assert_warn(sdp, al->al_alloced <= al->al_requested) == -1) | 1225 | if (gfs2_assert_warn(sdp, al->al_alloced <= al->al_requested) == -1) |
1228 | fs_warn(sdp, "al_alloced = %u, al_requested = %u " | 1226 | fs_warn(sdp, "al_alloced = %u, al_requested = %u " |
@@ -1412,7 +1410,7 @@ static struct gfs2_rgrpd *rgblk_free(struct gfs2_sbd *sdp, u64 bstart, | |||
1412 | u64 gfs2_alloc_data(struct gfs2_inode *ip) | 1410 | u64 gfs2_alloc_data(struct gfs2_inode *ip) |
1413 | { | 1411 | { |
1414 | struct gfs2_sbd *sdp = GFS2_SB(&ip->i_inode); | 1412 | struct gfs2_sbd *sdp = GFS2_SB(&ip->i_inode); |
1415 | struct gfs2_alloc *al = &ip->i_alloc; | 1413 | struct gfs2_alloc *al = ip->i_alloc; |
1416 | struct gfs2_rgrpd *rgd = al->al_rgd; | 1414 | struct gfs2_rgrpd *rgd = al->al_rgd; |
1417 | u32 goal, blk; | 1415 | u32 goal, blk; |
1418 | u64 block; | 1416 | u64 block; |
@@ -1457,7 +1455,7 @@ u64 gfs2_alloc_data(struct gfs2_inode *ip) | |||
1457 | u64 gfs2_alloc_meta(struct gfs2_inode *ip) | 1455 | u64 gfs2_alloc_meta(struct gfs2_inode *ip) |
1458 | { | 1456 | { |
1459 | struct gfs2_sbd *sdp = GFS2_SB(&ip->i_inode); | 1457 | struct gfs2_sbd *sdp = GFS2_SB(&ip->i_inode); |
1460 | struct gfs2_alloc *al = &ip->i_alloc; | 1458 | struct gfs2_alloc *al = ip->i_alloc; |
1461 | struct gfs2_rgrpd *rgd = al->al_rgd; | 1459 | struct gfs2_rgrpd *rgd = al->al_rgd; |
1462 | u32 goal, blk; | 1460 | u32 goal, blk; |
1463 | u64 block; | 1461 | u64 block; |
@@ -1503,7 +1501,7 @@ u64 gfs2_alloc_meta(struct gfs2_inode *ip) | |||
1503 | u64 gfs2_alloc_di(struct gfs2_inode *dip, u64 *generation) | 1501 | u64 gfs2_alloc_di(struct gfs2_inode *dip, u64 *generation) |
1504 | { | 1502 | { |
1505 | struct gfs2_sbd *sdp = GFS2_SB(&dip->i_inode); | 1503 | struct gfs2_sbd *sdp = GFS2_SB(&dip->i_inode); |
1506 | struct gfs2_alloc *al = &dip->i_alloc; | 1504 | struct gfs2_alloc *al = dip->i_alloc; |
1507 | struct gfs2_rgrpd *rgd = al->al_rgd; | 1505 | struct gfs2_rgrpd *rgd = al->al_rgd; |
1508 | u32 blk; | 1506 | u32 blk; |
1509 | u64 block; | 1507 | u64 block; |