diff options
author | Steven Whitehouse <swhiteho@redhat.com> | 2008-02-06 04:25:45 -0500 |
---|---|---|
committer | Steven Whitehouse <swhiteho@redhat.com> | 2008-03-31 05:40:37 -0400 |
commit | ce276b06e8b81845926387e93f77bf81e14b5cc2 (patch) | |
tree | ed28cd74af058761ccaa30829babc872762cf0a7 /fs/gfs2/rgrp.c | |
parent | 9feb7c889f2a3b088a7f6583e609bd39997c0f47 (diff) |
[GFS2] Reduce inode size by merging fields
There were three fields being used to keep track of the location
of the most recently allocated block for each inode. These have
been merged into a single field in order to better keep the
data and metadata for an inode close on disk, and also to reduce
the space required for storage.
Signed-off-by: Steven Whitehouse <swhiteho@redhat.com>
Diffstat (limited to 'fs/gfs2/rgrp.c')
-rw-r--r-- | fs/gfs2/rgrp.c | 40 |
1 files changed, 17 insertions, 23 deletions
diff --git a/fs/gfs2/rgrp.c b/fs/gfs2/rgrp.c index 3f10b1fafd66..66193b45e50b 100644 --- a/fs/gfs2/rgrp.c +++ b/fs/gfs2/rgrp.c | |||
@@ -915,24 +915,20 @@ static struct inode *try_rgrp_unlink(struct gfs2_rgrpd *rgd, u64 *last_unlinked) | |||
915 | static struct gfs2_rgrpd *recent_rgrp_first(struct gfs2_sbd *sdp, | 915 | static struct gfs2_rgrpd *recent_rgrp_first(struct gfs2_sbd *sdp, |
916 | u64 rglast) | 916 | u64 rglast) |
917 | { | 917 | { |
918 | struct gfs2_rgrpd *rgd = NULL; | 918 | struct gfs2_rgrpd *rgd; |
919 | 919 | ||
920 | spin_lock(&sdp->sd_rindex_spin); | 920 | spin_lock(&sdp->sd_rindex_spin); |
921 | 921 | ||
922 | if (list_empty(&sdp->sd_rindex_recent_list)) | 922 | if (rglast) { |
923 | goto out; | 923 | list_for_each_entry(rgd, &sdp->sd_rindex_recent_list, rd_recent) { |
924 | 924 | if (rgrp_contains_block(rgd, rglast)) | |
925 | if (!rglast) | 925 | goto out; |
926 | goto first; | 926 | } |
927 | |||
928 | list_for_each_entry(rgd, &sdp->sd_rindex_recent_list, rd_recent) { | ||
929 | if (rgd->rd_addr == rglast) | ||
930 | goto out; | ||
931 | } | 927 | } |
932 | 928 | rgd = NULL; | |
933 | first: | 929 | if (!list_empty(&sdp->sd_rindex_recent_list)) |
934 | rgd = list_entry(sdp->sd_rindex_recent_list.next, struct gfs2_rgrpd, | 930 | rgd = list_entry(sdp->sd_rindex_recent_list.next, |
935 | rd_recent); | 931 | struct gfs2_rgrpd, rd_recent); |
936 | out: | 932 | out: |
937 | spin_unlock(&sdp->sd_rindex_spin); | 933 | spin_unlock(&sdp->sd_rindex_spin); |
938 | return rgd; | 934 | return rgd; |
@@ -1078,7 +1074,7 @@ static struct inode *get_local_rgrp(struct gfs2_inode *ip, u64 *last_unlinked) | |||
1078 | 1074 | ||
1079 | /* Try recently successful rgrps */ | 1075 | /* Try recently successful rgrps */ |
1080 | 1076 | ||
1081 | rgd = recent_rgrp_first(sdp, ip->i_last_rg_alloc); | 1077 | rgd = recent_rgrp_first(sdp, ip->i_goal); |
1082 | 1078 | ||
1083 | while (rgd) { | 1079 | while (rgd) { |
1084 | rg_locked = 0; | 1080 | rg_locked = 0; |
@@ -1162,8 +1158,6 @@ static struct inode *get_local_rgrp(struct gfs2_inode *ip, u64 *last_unlinked) | |||
1162 | } | 1158 | } |
1163 | 1159 | ||
1164 | out: | 1160 | out: |
1165 | ip->i_last_rg_alloc = rgd->rd_addr; | ||
1166 | |||
1167 | if (begin) { | 1161 | if (begin) { |
1168 | recent_rgrp_add(rgd); | 1162 | recent_rgrp_add(rgd); |
1169 | rgd = gfs2_rgrpd_get_next(rgd); | 1163 | rgd = gfs2_rgrpd_get_next(rgd); |
@@ -1425,8 +1419,8 @@ u64 gfs2_alloc_data(struct gfs2_inode *ip) | |||
1425 | u32 goal, blk; | 1419 | u32 goal, blk; |
1426 | u64 block; | 1420 | u64 block; |
1427 | 1421 | ||
1428 | if (rgrp_contains_block(rgd, ip->i_di.di_goal_data)) | 1422 | if (rgrp_contains_block(rgd, ip->i_goal)) |
1429 | goal = ip->i_di.di_goal_data - rgd->rd_data0; | 1423 | goal = ip->i_goal - rgd->rd_data0; |
1430 | else | 1424 | else |
1431 | goal = rgd->rd_last_alloc_data; | 1425 | goal = rgd->rd_last_alloc_data; |
1432 | 1426 | ||
@@ -1435,7 +1429,7 @@ u64 gfs2_alloc_data(struct gfs2_inode *ip) | |||
1435 | rgd->rd_last_alloc_data = blk; | 1429 | rgd->rd_last_alloc_data = blk; |
1436 | 1430 | ||
1437 | block = rgd->rd_data0 + blk; | 1431 | block = rgd->rd_data0 + blk; |
1438 | ip->i_di.di_goal_data = block; | 1432 | ip->i_goal = block; |
1439 | 1433 | ||
1440 | gfs2_assert_withdraw(sdp, rgd->rd_rg.rg_free); | 1434 | gfs2_assert_withdraw(sdp, rgd->rd_rg.rg_free); |
1441 | rgd->rd_rg.rg_free--; | 1435 | rgd->rd_rg.rg_free--; |
@@ -1470,8 +1464,8 @@ u64 gfs2_alloc_meta(struct gfs2_inode *ip) | |||
1470 | u32 goal, blk; | 1464 | u32 goal, blk; |
1471 | u64 block; | 1465 | u64 block; |
1472 | 1466 | ||
1473 | if (rgrp_contains_block(rgd, ip->i_di.di_goal_meta)) | 1467 | if (rgrp_contains_block(rgd, ip->i_goal)) |
1474 | goal = ip->i_di.di_goal_meta - rgd->rd_data0; | 1468 | goal = ip->i_goal - rgd->rd_data0; |
1475 | else | 1469 | else |
1476 | goal = rgd->rd_last_alloc_meta; | 1470 | goal = rgd->rd_last_alloc_meta; |
1477 | 1471 | ||
@@ -1480,7 +1474,7 @@ u64 gfs2_alloc_meta(struct gfs2_inode *ip) | |||
1480 | rgd->rd_last_alloc_meta = blk; | 1474 | rgd->rd_last_alloc_meta = blk; |
1481 | 1475 | ||
1482 | block = rgd->rd_data0 + blk; | 1476 | block = rgd->rd_data0 + blk; |
1483 | ip->i_di.di_goal_meta = block; | 1477 | ip->i_goal = block; |
1484 | 1478 | ||
1485 | gfs2_assert_withdraw(sdp, rgd->rd_rg.rg_free); | 1479 | gfs2_assert_withdraw(sdp, rgd->rd_rg.rg_free); |
1486 | rgd->rd_rg.rg_free--; | 1480 | rgd->rd_rg.rg_free--; |