[PATCH 5/6] Btrfs-progs: fsck: reduce memory usage of extent record struct
Two changes: 1.use bit filed for @found_rec 2.u32 is enough to calculate duplicate extent number. Signed-off-by: Wang Shilong wangsl.f...@cn.fujitsu.com --- cmds-check.c | 9 ++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/cmds-check.c b/cmds-check.c index e1238d7..34f8fa6 100644 --- a/cmds-check.c +++ b/cmds-check.c @@ -92,7 +92,6 @@ struct extent_record { struct list_head list; struct cache_extent cache; struct btrfs_disk_key parent_key; - unsigned int found_rec; u64 start; u64 max_size; u64 nr; @@ -101,8 +100,9 @@ struct extent_record { u64 generation; u64 parent_generation; u64 info_objectid; - u64 num_duplicates; + u32 num_duplicates; u8 info_level; + unsigned int found_rec:1; unsigned int content_checked:1; unsigned int owner_ref_checked:1; unsigned int is_root:1; @@ -2742,7 +2742,10 @@ static int add_extent_rec(struct cache_tree *extent_cache, rec-start = start; rec-max_size = max_size; rec-nr = max(nr, max_size); - rec-found_rec = extent_rec; + if (extent_rec) + rec-found_rec = 1; + else + rec-found_rec = 0; rec-content_checked = 0; rec-owner_ref_checked = 0; rec-num_duplicates = 0; -- 1.9.0 -- To unsubscribe from this list: send the line unsubscribe linux-btrfs in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH 5/6] Btrfs-progs: fsck: reduce memory usage of extent record struct
On Tue, Mar 18, 2014 at 08:02:46PM +0800, Wang Shilong wrote: @@ -2742,7 +2742,10 @@ static int add_extent_rec(struct cache_tree *extent_cache, - rec-found_rec = extent_rec; + if (extent_rec) + rec-found_rec = 1; + else + rec-found_rec = 0; I've modified this to avoid 'if' rec-found_rec = !!extent_rec; -- To unsubscribe from this list: send the line unsubscribe linux-btrfs in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH 5/6] Btrfs-progs: fsck: reduce memory usage of extent record struct
On 03/19/2014 02:18 AM, David Sterba wrote: On Tue, Mar 18, 2014 at 08:02:46PM +0800, Wang Shilong wrote: @@ -2742,7 +2742,10 @@ static int add_extent_rec(struct cache_tree *extent_cache, - rec-found_rec = extent_rec; + if (extent_rec) + rec-found_rec = 1; + else + rec-found_rec = 0; I've modified this to avoid 'if' rec-found_rec = !!extent_rec; Dave, thanks for doing this.:-) -- To unsubscribe from this list: send the line unsubscribe linux-btrfs in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html -- To unsubscribe from this list: send the line unsubscribe linux-btrfs in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html