Skip to content

fsck.gfs2: memory reduction patches

Bob Peterson cluster-devel 2 versions – New

Get series with b4
b4 am [email protected]

Versions newest first · linked by author and title

  1. v2 Latest40 patches 0 repliesNew
  2. v130 patches 0 repliesSuperseded

Patches in v2 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/40fsck.gfs2: Move pass5 to immediately follow pass1gfs2/fsck/main.c+1 -10 replies
2/40fsck.gfs2: Convert block_type to bitmap_type after pass1 and 5gfs2/fsck/lost_n_found.c gfs2/fsck/metawalk.c gfs2/fsck/pass1b.c +5 more+28 -200 replies
3/40fsck.gfs2: Change bitmap_type variables to intgfs2/fsck/fsck.h gfs2/fsck/lost_n_found.c gfs2/fsck/metawalk.c +8 more+38 -380 replies
4/40fsck.gfs2: Use di_entries to determine if lost+found was createdgfs2/fsck/lost_n_found.c+3 -30 replies
5/40fsck.gfs2: pass1b shouldn't complain about non-bitmap blocksgfs2/fsck/pass1b.c+1 -10 replies
6/40fsck.gfs2: Change all fsck_blockmap_set to fsck_bitmap_setgfs2/fsck/lost_n_found.c gfs2/fsck/metawalk.c gfs2/fsck/metawalk.h +4 more+122 -810 replies
7/40fsck.gfs2: Move set_ip_blockmap to pass1gfs2/fsck/pass1.c gfs2/fsck/util.c gfs2/fsck/util.h+49 -510 replies
8/40fsck.gfs2: Remove unneeded parameter instree from set_ip_blockmapgfs2/fsck/pass1.c+3 -50 replies
9/40fsck.gfs2: Move leaf repair to pass2gfs2/fsck/metawalk.c gfs2/fsck/metawalk.h gfs2/fsck/pass1.c +1 more+146 -1970 replies
10/40fsck.gfs2: Eliminate astate codegfs2/fsck/metawalk.c gfs2/fsck/pass2.c gfs2/fsck/pass3.c +2 more+0 -700 replies
11/40fsck.gfs2: Move reprocess code to pass1gfs2/fsck/metawalk.c gfs2/fsck/metawalk.h gfs2/fsck/pass1.c+107 -1080 replies
12/40fsck.gfs2: Separate out functions that may only be done after pass1gfs2/fsck/Makefile.am gfs2/fsck/afterpass1_common.c gfs2/fsck/afterpass1_common.h +7 more+335 -2991 reply
12/40fsck.gfs2: Separate out functions that may only be done after pass1+0 -00 replies
13/40fsck.gfs2: Divest check_metatree from fsck_blockmap_setgfs2/fsck/metawalk.c gfs2/fsck/pass1.c+8 -30 replies
14/40fsck.gfs2: eliminate fsck_blockmap_set from check_eattr_entriesgfs2/fsck/afterpass1_common.c gfs2/fsck/afterpass1_common.h gfs2/fsck/metawalk.c +3 more+82 -480 replies
15/40fsck.gfs2: Move blockmap stuff to pass1.cgfs2/fsck/metawalk.c gfs2/fsck/metawalk.h gfs2/fsck/pass1.c+21 -240 replies
16/40fsck: make pass1 call bitmap reconciliation AKA pass5gfs2/fsck/main.c gfs2/fsck/pass1.c gfs2/fsck/util.c +1 more+40 -340 replies
17/40fsck.gfs2: make blockmap global variable only to pass1gfs2/fsck/fsck.h gfs2/fsck/initialize.c gfs2/fsck/main.c +4 more+112 -1120 replies
18/40fsck.gfs2: Add wrapper function pass1_check_metatreegfs2/fsck/pass1.c+25 -100 replies
19/40fsck.gfs2: pass counted_links into fix_link_count in pass4gfs2/fsck/pass4.c+8 -90 replies
20/40fsck.gfs2: refactor pass4 function scan_inode_listgfs2/fsck/pass4.c+85 -760 replies
21/40fsck.gfs2: More refactoring of pass4 function scan_inode_listgfs2/fsck/pass4.c+32 -280 replies
22/40fsck.gfs2: Fix white space problemsgfs2/fsck/fsck.h+9 -100 replies
23/40fsck.gfs2: move link count info for directories to directory treegfs2/fsck/fsck.h gfs2/fsck/inode_hash.c gfs2/fsck/link.c +6 more+136 -170 replies
24/40fsck.gfs2: Use bitmaps instead of linked list for inodes w/nlink == 1gfs2/fsck/link.c gfs2/fsck/link.h gfs2/fsck/main.c +6 more+214 -590 replies
25/40fsck.gfs2: Refactor check_n_fix_bitmap to make it more readablegfs2/fsck/metawalk.c+60 -620 replies
26/40fsck.gfs2: adjust rgrp inode count when fixing bitmapgfs2/fsck/metawalk.c+43 -20 replies
27/40fsck.gfs2: blocks cannot be UNLINKED in pass1b or after thatgfs2/fsck/pass1b.c gfs2/fsck/pass2.c gfs2/fsck/pass3.c +1 more+12 -200 replies
28/40fsck.gfs2: Add error checks to get_next_leafgfs2/libgfs2/fs_ops.c+11 -00 replies
29/40fsck.gfs2: re-add a non-allocating repair_leaf to pass1gfs2/fsck/pass1.c+47 -00 replies
30/40libgfs2: Allocate new GFS1 metadata as type 3, not type 1gfs2/libgfs2/fs_ops.c+15 -70 replies
31/40fsck.gfs2: Undo partially done metadata recordsgfs2/fsck/afterpass1_common.c gfs2/fsck/afterpass1_common.h gfs2/fsck/metawalk.c +2 more+85 -170 replies
32/40fsck.gfs2: Eliminate redundant code in _fsck_bitmap_setgfs2/fsck/metawalk.c+0 -110 replies
33/40fsck.gfs2: Fix inode counting buggfs2/fsck/metawalk.c+27 -190 replies
34/40fsck.gfs2: Adjust bitmap for lost+found after adding to dirtreegfs2/fsck/lost_n_found.c+4 -10 replies
35/40GFS2: Add initialization checks for GFS1 used metadatagfs2/fsck/initialize.c+49 -30 replies
36/40fsck.gfs2: Use BLKST constants to make pass5 more cleargfs2/fsck/pass5.c+19 -160 replies
37/40fsck.gfs2: Fix GFS1 "used meta" accounting buggfs2/fsck/pass5.c+7 -50 replies
38/40fsck.gfs2: pass1b is too noisy wrt gfs1 non-dinode metadatagfs2/fsck/pass1b.c+4 -30 replies
39/40fsck.gfs2: Fix rgrp dinode accounting buggfs2/fsck/pass1b.c+7 -30 replies
40/40fsck.gfs2: Fix rgrp accounting in check_n_fix_bitmapgfs2/fsck/metawalk.c+59 -600 replies

Reviews trailers per patch

No Reviewed-by, Acked-by or Tested-by trailers for v2 yet.

Read the v2 thread

Cover letter [Cluster-devel] [fsck.gfs2 v2 PATCH 00/40] fsck.gfs2: memory reduction patches

On 15 April, I posted a set of 30 patches for fsck.gfs2 to reduce its memory requirements. Since that time, I've been testing and fixing problems. Here is version 2.
---
Right now, fsck.gfs2 is a memory hog with regard to very large file systems. A file system of 250TB would require an absurd about of memory. That's because it uses memory for (1) rgrp bitmaps, (2) its own internal blockmap, (3) a directory tree, and (4) a tree of ALL inodes in the file system, for reconciling link counts.

This series of 40 patches is designed to reduce the memory footprint of fsck.gfs2. It does so by almost entirely eliminating the inode tree in favor of two much smaller bitmaps. In order to do that, I rearranged the order in which things are done.

In order to save on memory, some things will be slower, so this will cause a performance hit to fsck.gfs2. However, I'm confident that we can fix them and make it fast again. The slowness is caused because most bitmap manipulation is now done on the bitmaps in the resource groups, which means the code needs to search out the rgrp for these operations. This can be optimized to pass in the rgrp, since it will be known in most cases (for example, pass1 operates on one rgrp at a time, and chances are quite good that the rgrp needed will be that one.) These further optimizations will be done in later patches.

I'm still testing these changes against my collection of gfs2 and gfs1 metadata, but the results are good so far. So there may be changes.

---
Bob Peterson (40):
fsck.gfs2: Move pass5 to immediately follow pass1 fsck.gfs2: Convert block_type to bitmap_type after pass1 and 5 fsck.gfs2: Change bitmap_type variables to int
fsck.gfs2: Use di_entries to determine if lost+found was created fsck.gfs2: pass1b shouldn't complain about non-bitmap blocks fsck.gfs2: Change all fsck_blockmap_set to fsck_bitmap_set fsck.gfs2: Move set_ip_blockmap to pass1
fsck.gfs2: Remove unneeded parameter instree from set_ip_blockmap fsck.gfs2: Move leaf repair to pass2
fsck.gfs2: Eliminate astate code
fsck.gfs2: Move reprocess code to pass1
fsck.gfs2: Separate out functions that may only be done after pass1 fsck.gfs2: Divest check_metatree from fsck_blockmap_set fsck.gfs2: eliminate fsck_blockmap_set from check_eattr_entries fsck.gfs2: Move blockmap stuff to pass1.c
fsck: make pass1 call bitmap reconciliation AKA pass5 fsck.gfs2: make blockmap global variable only to pass1 fsck.gfs2: Add wrapper function pass1_check_metatree fsck.gfs2: pass counted_links into fix_link_count in pass4 fsck.gfs2: refactor pass4 function scan_inode_list fsck.gfs2: More refactoring of pass4 function scan_inode_list fsck.gfs2: Fix white space problems
fsck.gfs2: move link count info for directories to directory tree fsck.gfs2: Use bitmaps instead of linked list for inodes w/nlink == 1 fsck.gfs2: Refactor check_n_fix_bitmap to make it more readable fsck.gfs2: adjust rgrp inode count when fixing bitmap fsck.gfs2: blocks cannot be UNLINKED in pass1b or after that fsck.gfs2: Add error checks to get_next_leaf
fsck.gfs2: re-add a non-allocating repair_leaf to pass1
libgfs2: Allocate new GFS1 metadata as type 3, not type 1 fsck.gfs2: Undo partially done metadata records
fsck.gfs2: Eliminate redundant code in _fsck_bitmap_set fsck.gfs2: Fix inode counting bug
fsck.gfs2: Adjust bitmap for lost+found after adding to dirtree
GFS2: Add initialization checks for GFS1 used metadata fsck.gfs2: Use BLKST constants to make pass5 more clear fsck.gfs2: Fix GFS1 "used meta" accounting bug
fsck.gfs2: pass1b is too noisy wrt gfs1 non-dinode metadata fsck.gfs2: Fix rgrp dinode accounting bug
fsck.gfs2: Fix rgrp accounting in check_n_fix_bitmap

 gfs2/fsck/Makefile.am         |   1 +
 gfs2/fsck/afterpass1_common.c | 319 ++++++++++++++++
 gfs2/fsck/afterpass1_common.h |  31 ++
 gfs2/fsck/fsck.h              |  26 +-
 gfs2/fsck/initialize.c        |  63 +++-
 gfs2/fsck/inode_hash.c        |   3 +-
 gfs2/fsck/link.c              | 139 ++++++-
 gfs2/fsck/link.h              |   6 +-
 gfs2/fsck/lost_n_found.c      |  17 +-
 gfs2/fsck/main.c              |  38 +-
 gfs2/fsck/metawalk.c          | 847 ++++++++----------------------------------
 gfs2/fsck/metawalk.h          |  59 +--
 gfs2/fsck/pass1.c             | 479 ++++++++++++++++++++++--
 gfs2/fsck/pass1b.c            | 148 +++++---
 gfs2/fsck/pass2.c             | 276 ++++++++++----
 gfs2/fsck/pass3.c             |  52 +--
 gfs2/fsck/pass4.c             | 339 ++++++++++-------
 gfs2/fsck/pass5.c             |  60 +--
 gfs2/fsck/util.c              | 171 +++------
 gfs2/fsck/util.h              |  70 ++--
 gfs2/libgfs2/fs_ops.c         |  33 +-
 21 files changed, 1849 insertions(+), 1328 deletions(-)
 create mode 100644 gfs2/fsck/afterpass1_common.c
 create mode 100644 gfs2/fsck/afterpass1_common.h
Signature · 1 line
2.5.5