Skip to content

RFC e2fsprogs: Parallel fsck support

Ritesh Harjani (IBM) linux-ext4 1 version Applied

Status from this message: Applied, thanks.

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 RFC Latest72 patches 31 repliesApplied

Patches in v1 Applied

#Subject and filesSizeRepliesApplied
1/72e2fsck: Fix unbalanced mutex unlock for BOUNCE_MTXlib/ext2fs/unix_io.c+0 -17 replies
2/72gen_bitmaps: Fix ext2fs_compare_generic_bmap/bitmap logiclib/ext2fs/gen_bitmap.c lib/ext2fs/gen_bitmap64.c+13 -62 replies
3/72blkmap64_ba: Add common helper for bits size calculationlib/ext2fs/blkmap64_ba.c+13 -71 reply
4/72badblocks: Remove unused badblocks_flagslib/ext2fs/badblocks.c lib/ext2fs/ext2fsP.h+1 -61 reply
5/72badblocks: Add badblocks merge logiclib/ext2fs/badblocks.c lib/ext2fs/ext2fs.h+77 -01 reply
6/72dblist: add dblist merge logiclib/ext2fs/dblist.c lib/ext2fs/ext2fs.h+37 -01 reply
7/72libext2fs: Add rbtree bitmap merge logiclib/ext2fs/blkmap64_rb.c+65 -00 replies
8/72libext2fs: Add bitmaps merge opslib/ext2fs/bitmaps.c lib/ext2fs/bmap64.h lib/ext2fs/ext2fs.h +1 more+51 -01 reply
9/72libext2fs: Add flush cleanup APIlib/ext2fs/ext2_io.h lib/ext2fs/undo_io.c lib/ext2fs/unix_io.c+42 -31 reply
10/72libext2fs: merge icounts after thread finisheslib/ext2fs/ext2fs.h lib/ext2fs/icount.c+104 -01 reply
11/72libext2fs: merge quota context after threads finishlib/support/mkquota.c lib/support/quotaio.h+42 -01 reply
12/72libext2fs: dupfs: Add fs clone & merge apilib/ext2fs/dupfs.c lib/ext2fs/ext2fs.h+206 -02 replies
13/72tst_badblocks: Add unit test to verify badblocks list merge apilib/ext2fs/tst_badblocks.c+59 -21 reply
14/72tst_bitmaps_standalone: Add copy and merge bitmaps testlib/ext2fs/Makefile.in lib/ext2fs/tst_bitmaps_standalone.c+189 -62 replies
15/72tst_bitmaps_pthread: Add merge bitmaps test using pthreadslib/ext2fs/Makefile.in lib/ext2fs/tst_bitmaps_pthread.c+263 -11 reply
16/72tst_libext2fs_pthread: Add libext2fs merge/clone unit testslib/ext2fs/Makefile.in lib/ext2fs/tst_libext2fs_pthread.c+330 -21 reply
17/72libext2fs: Add support for ext2fs_test_block_bitmap_range2_valid()lib/ext2fs/bitops.h lib/ext2fs/gen_bitmap64.c+35 -01 reply
18/72libext2fs: Add support to get average group countlib/ext2fs/ext2fs.h+31 -11 reply
19/72libext2fs: Misc fixes for struct_ext2_filsyslib/ext2fs/ext2fs.h+2 -31 reply
20/72libext2fs: avoid too much memory allocation in case fs_num_threadslib/ext2fs/dblist.c lib/ext2fs/icount.c+6 -01 reply
21/72e2fsck: add -m option for multithreade2fsck/e2fsck.h e2fsck/unix.c tests/f_multithread/expect.1 +24 more+217 -61 reply
22/72e2fsck: copy context when using multi-thread fscke2fsck/e2fsck.h e2fsck/pass1.c e2fsck/unix.c+112 -80 replies
23/72e2fsck: create logs for multi-threadse2fsck/e2fsck.h e2fsck/logfile.c e2fsck/pass1.c +4 more+82 -30 replies
24/72e2fsck: configure one pfsck threade2fsck/e2fsck.h e2fsck/logfile.c e2fsck/pass1.c +2 more+166 -190 replies
25/72e2fsck: Add e2fsck_pass1_thread_join return valuee2fsck/pass1.c+18 -30 replies
26/72e2fsck: Use merge/clone apis of libext2fse2fsck/pass1.c+55 -30 replies
27/72e2fsck: Add e2fsck_pass1_merge_bitmap() apie2fsck/pass1.c+128 -00 replies
28/72e2fsck: Add asserts in open_channel_fse2fsck/pass1.c+12 -00 replies
29/72e2fsck: add start/end group for threade2fsck/e2fsck.h e2fsck/logfile.c e2fsck/pass1.c +3 more+75 -60 replies
30/72e2fsck: split groups to different threadse2fsck/pass1.c+17 -60 replies
31/72e2fsck: print thread log properlye2fsck/e2fsck.h e2fsck/pass1.c e2fsck/problem.c +4 more+98 -60 replies
32/72e2fsck: do not change global variablese2fsck/pass1.c+47 -280 replies
33/72e2fsck: optimize the inserting of dir_info_dbe2fsck/dirinfo.c+112 -600 replies
34/72e2fsck: merge dir_info after thread finishese2fsck/dirinfo.c e2fsck/e2fsck.h e2fsck/pass1.c+120 -10 replies
35/72e2fsck: rbtree bitmap for dire2fsck/pass1.c+1 -00 replies
36/72e2fsck: merge icounts after thread finishese2fsck/pass1.c+48 -00 replies
37/72e2fsck: add debug codes for multiple threadse2fsck/e2fsck.h e2fsck/pass1.c+45 -00 replies
38/72e2fsck: merge counts after threads finishe2fsck/pass1.c+34 -00 replies
39/72e2fsck: merge dx_dir_info after threads finishe2fsck/dx_dirinfo.c e2fsck/e2fsck.h e2fsck/pass1.c+88 -00 replies
40/72e2fsck: merge dirs_to_hash when threads finishe2fsck/pass1.c+30 -00 replies
41/72e2fsck: merge context flags properlye2fsck/pass1.c+1 -30 replies
42/72e2fsck: merge quota context after threads finishe2fsck/pass1.c+14 -00 replies
43/72e2fsck: serialize fix operationse2fsck/e2fsck.h e2fsck/pass1.c e2fsck/util.c+100 -70 replies
44/72e2fsck: move some fixes out of parallel pthreadse2fsck/e2fsck.h e2fsck/pass1.c e2fsck/util.c +3 more+210 -1320 replies
45/72e2fsck: split and merge invalid bitmapse2fsck/pass1.c+71 -00 replies
46/72e2fsck: merge EA blocks properlye2fsck/e2fsck.h e2fsck/pass1.c+212 -330 replies
47/72e2fsck: kickoff mutex lock for block found mape2fsck/e2fsck.h e2fsck/pass1.c e2fsck/util.c +1 more+137 -800 replies
48/72e2fsck: allow admin specify number of threadse2fsck/e2fsck.h e2fsck/pass1.c e2fsck/unix.c +6 more+122 -630 replies
49/72e2fsck: adjust number of threadse2fsck/pass1.c+15 -170 replies
50/72e2fsck: fix readahead for pfsck of pass1e2fsck/pass1.c+20 -90 replies
51/72e2fsck: merge options after threads finishe2fsck/pass1.c+4 -10 replies
52/72e2fsck: reset lost_and_found after threads finishe2fsck/pass1.c+5 -00 replies
53/72e2fsck: merge extent depth count after threads finishe2fsck/pass1.c+10 -10 replies
54/72e2fsck: simplify e2fsck context merging codese2fsck/pass1.c+31 -1270 replies
55/72e2fsck: set E2F_FLAG_ALLOC_OK after threadse2fsck/pass1.c+8 -20 replies
56/72e2fsck: wait fix thread finish before checkinge2fsck/e2fsck.c e2fsck/e2fsck.h e2fsck/pass1.c +1 more+122 -120 replies
57/72e2fsck: cleanup e2fsck_pass1_thread_join()e2fsck/pass1.c+7 -260 replies
58/72e2fsck: make default smallest RA size to 1Me2fsck/readahead.c+4 -00 replies
59/72e2fsck: update mmp block in one threade2fsck/e2fsck.h e2fsck/pass1.c+33 -20 replies
60/72e2fsck: reset @inodes_to_rebuild if restarte2fsck/e2fsck.c+4 -00 replies
61/72tests: add pfsck testtests/f_multithread_ok/expect.1 tests/f_multithread_ok/image.gz tests/f_multithread_ok/name +1 more+29 -00 replies
62/72e2fsck: fix memory leaks with pfsck enablede2fsck/e2fsck.c e2fsck/pass1.c+5 -00 replies
63/72e2fsck: misc cleanups for pfscke2fsck/e2fsck.8.in e2fsck/e2fsck.h e2fsck/pass1.c +1 more+25 -200 replies
64/72e2fsck: propagate number of threadse2fsck/unix.c+3 -00 replies
65/72e2fsck: Annotating fields in e2fsck_structe2fsck/e2fsck.h+14 -60 replies
66/72e2fsck: merge casefolded dir lists after thread finishe2fsck/pass1.c+26 -00 replies
67/72sec: support encrypted files handling in pfsck modee2fsck/e2fsck.h e2fsck/encrypted_files.c e2fsck/pass1.c+164 -31 reply
68/72e2fsck: Fix io->align assert checke2fsck/pass1.c+0 -10 replies
69/72e2fsck: Fix double free of inodes_to_processe2fsck/pass1.c+0 -10 replies
70/72e2fsck: Fix and simplify update_mmp in case of pfscke2fsck/pass1.c+63 -340 replies
71/72e2fsck: Make threads call log_out after pthread_joine2fsck/pass1.c+6 -70 replies
72/72tests/f_multithread: Fix f_multithread related teststests/f_multithread_ok/expect.1 tests/f_multithread_ok/script+8 -170 replies

Reviews trailers per patch

16 of 72 patches have a Reviewed-by or Acked-by.

PatchMalooAndreas DilgerLi Dongyang
1/72
2/72
3/72R-b
4/72R-b
5/72R-b
6/72R-b
7/72
8/72R-b
9/72R-b
10/72R-b
11/72R-b
12/72
13/72R-b
14/72R-b
15/72R-b
16/72R-b
17/72
18/72
19/72
20/72R-b
21/72R-b
22/72
23/72
24/72
25/72
26/72
27/72
28/72
29/72
30/72
31/72
32/72
33/72
34/72
35/72
36/72
37/72
38/72
39/72
40/72
41/72
42/72
43/72
44/72
45/72
46/72
47/72
48/72
49/72
50/72
51/72
52/72
53/72
54/72
55/72
56/72
57/72
58/72
59/72
60/72
61/72
62/72
63/72
64/72
65/72
66/72T-b R-b
67/72T-b R-b R-b
68/72
69/72
70/72
71/72
72/72

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes. Scroll the table sideways for all 3 reviewers.

Read the v1 thread

Cover letter [RFCv1 00/72] e2fsprogs: Parallel fsck support

Hello,

This is a RFC patch series which has the list of all pfsck related changes which should also address the problem statements mentioned by Ted and Harshad here [1]

Below points will provide more details on how this patch series is laid out:-

1. This series is rebased on the latest e2fsprogs master branch.

2. Patch series is broken down into logical patches for easier review. The series contains libext2fs changes first, followed by e2fsck changes which utilizes libext2fs apis to add pfsck support to pass1.

3. Changes [0005] to [0012] addresses the problem statement laid out by Ted and Harshad [1] i.e. we now have a libext2fs API for clone and merge of ext2_filsys struct. (ext2fs_clone_fs() & ext2fs_merge_fs())

4. These two changes [0016] & [0026] uses above clone/merge api for test and for use in e2fsck.

5. For a lot of libext2fs changes (for e.g. bitmap merging logic or clone/merge apis), there are some unit tests added for it's functionality verification.

Performance results:
=====================
1. On nvme with 22M 0-byte inodes: 7sec v/s 19sec
2. On nvme with 22M 4KB-32KB inodes: 17sec v/s 30sec
3. On nvme with 11M 32KB inodes: 9sec v/s 15sec
4. On RAID HDD setups: (will get back with perf results for this. Although, I had shared some numbers earlier, but I wanted to run pfsck with different FS layout and collect the numbers once again)

For review: Since these are large number of changes. So if the overall series looks good, then we can start reviewing changes in batches. For e.g. if we could review initial changes in libext2fs (from [001] - [0020]), that would be a good start.

Patch-0073 adds support to all tests/* with "-m 2" mode to test pfsck as well. If pthread support is present, make check then test with "-m 2" fsck mode option as well (for tests which utilizes run_e2fsck script).
This was mainly done for verifying that all existing tests passes with pfsck. In this only few tests are kept disabled by passing SKIP_MT=true (Note: Last min. I have decided to drop this patch from sending. Although this can still be found in the github branch [2] for any testing)

On Threadsan: I had tested this patch series against threadsan as well. It does lists few race conditions when running multi-threading (these doesn't looks to be any major problem). I have fixed a few [0070] and rest might either need some minor fixing or marking it false positive.

Here is the github link with all these commits (pfsck-RFCv1 branch) [2].

[1]: https://lore.kernel.org/linux-ext4/YMN10sXgoTR%[email protected]/
[2]: https://github.com/riteshharjani/e2fsprogs/commits/pfsck-RFCv1

Andreas Dilger (2):
libext2fs: Misc fixes for struct_ext2_filsys
e2fsck: misc cleanups for pfsck

Li Xi (16):
dblist: add dblist merge logic
libext2fs: Add flush cleanup API
libext2fs: merge icounts after thread finishes
e2fsck: add -m option for multithread
e2fsck: copy context when using multi-thread fsck
e2fsck: create logs for multi-threads
e2fsck: configure one pfsck thread
e2fsck: Add asserts in open_channel_fs
e2fsck: add start/end group for thread
e2fsck: split groups to different threads
e2fsck: print thread log properly
e2fsck: do not change global variables
e2fsck: optimize the inserting of dir_info_db
e2fsck: merge dir_info after thread finishes
e2fsck: merge icounts after thread finishes
e2fsck: add debug codes for multiple threads

Ritesh Harjani (IBM) (15):
e2fsck: Fix unbalanced mutex unlock for BOUNCE_MTX
gen_bitmaps: Fix ext2fs_compare_generic_bmap/bitmap logic
blkmap64_ba: Add common helper for bits size calculation
badblocks: Remove unused badblocks_flags
tst_badblocks: Add unit test to verify badblocks list merge api
tst_bitmaps_standalone: Add copy and merge bitmaps test
tst_bitmaps_pthread: Add merge bitmaps test using pthreads
tst_libext2fs_pthread: Add libext2fs merge/clone unit tests
e2fsck: Add e2fsck_pass1_thread_join return value
e2fsck: Use merge/clone apis of libext2fs
e2fsck: Fix io->align assert check
e2fsck: Fix double free of inodes_to_process
e2fsck: Fix and simplify update_mmp in case of pfsck
e2fsck: Make threads call log_out after pthread_join tests/f_multithread: Fix f_multithread related tests

Saranya Muruganandam (3):
libext2fs: dupfs: Add fs clone & merge api
e2fsck: propagate number of threads
e2fsck: Annotating fields in e2fsck_struct

Sebastien Buisson (1):
sec: support encrypted files handling in pfsck mode

Wang Shilong (35):
badblocks: Add badblocks merge logic
libext2fs: Add rbtree bitmap merge logic
libext2fs: Add bitmaps merge ops
libext2fs: merge quota context after threads finish
libext2fs: Add support for ext2fs_test_block_bitmap_range2_valid()
libext2fs: Add support to get average group count
libext2fs: avoid too much memory allocation in case fs_num_threads
e2fsck: Add e2fsck_pass1_merge_bitmap() api
e2fsck: rbtree bitmap for dir
e2fsck: merge counts after threads finish
e2fsck: merge dx_dir_info after threads finish
e2fsck: merge dirs_to_hash when threads finish
e2fsck: merge context flags properly
e2fsck: merge quota context after threads finish
e2fsck: serialize fix operations
e2fsck: move some fixes out of parallel pthreads
e2fsck: split and merge invalid bitmaps
e2fsck: merge EA blocks properly
e2fsck: kickoff mutex lock for block found map
e2fsck: allow admin specify number of threads
e2fsck: adjust number of threads
e2fsck: fix readahead for pfsck of pass1
e2fsck: merge options after threads finish
e2fsck: reset lost_and_found after threads finish
e2fsck: merge extent depth count after threads finish
e2fsck: simplify e2fsck context merging codes
e2fsck: set E2F_FLAG_ALLOC_OK after threads
e2fsck: wait fix thread finish before checking
e2fsck: cleanup e2fsck_pass1_thread_join()
e2fsck: make default smallest RA size to 1M
e2fsck: update mmp block in one thread
e2fsck: reset @inodes_to_rebuild if restart
tests: add pfsck test
e2fsck: fix memory leaks with pfsck enabled
e2fsck: merge casefolded dir lists after thread finish

 e2fsck/dirinfo.c                        |  238 ++-
 e2fsck/dx_dirinfo.c                     |   64 +
 e2fsck/e2fsck.8.in                      |    8 +-
 e2fsck/e2fsck.c                         |   11 +
 e2fsck/e2fsck.h                         |  103 +-
 e2fsck/encrypted_files.c                |  139 ++
 e2fsck/logfile.c                        |   13 +-
 e2fsck/pass1.c                          | 1894 +++++++++++++++++++----
 e2fsck/problem.c                        |   11 +
 e2fsck/problem.h                        |    3 +
 e2fsck/readahead.c                      |    4 +
 e2fsck/unix.c                           |   58 +-
 e2fsck/util.c                           |  193 ++-
 lib/ext2fs/Makefile.in                  |   53 +-
 lib/ext2fs/badblocks.c                  |   81 +-
 lib/ext2fs/bitmaps.c                    |   10 +
 lib/ext2fs/bitops.h                     |    2 +
 lib/ext2fs/blkmap64_ba.c                |   20 +-
 lib/ext2fs/blkmap64_rb.c                |   65 +
 lib/ext2fs/bmap64.h                     |    4 +
 lib/ext2fs/dblist.c                     |   38 +
 lib/ext2fs/dupfs.c                      |  183 +++
 lib/ext2fs/ext2_err.et.in               |    3 +
 lib/ext2fs/ext2_io.h                    |    2 +
 lib/ext2fs/ext2fs.h                     |   66 +-
 lib/ext2fs/ext2fsP.h                    |    1 -
 lib/ext2fs/gen_bitmap.c                 |    9 +-
 lib/ext2fs/gen_bitmap64.c               |   72 +-
 lib/ext2fs/icount.c                     |  107 ++
 lib/ext2fs/tst_badblocks.c              |   61 +-
 lib/ext2fs/tst_bitmaps_pthread.c        |  247 +++
 lib/ext2fs/tst_bitmaps_standalone.c     |  170 ++
 lib/ext2fs/tst_libext2fs_pthread.c      |  315 ++++
 lib/ext2fs/undo_io.c                    |   19 +
 lib/ext2fs/unix_io.c                    |   25 +-
 lib/support/mkquota.c                   |   39 +
 lib/support/quotaio.h                   |    3 +
 tests/f_itable_collision/expect.1       |    3 -
 tests/f_multithread/expect.1            |   25 +
 tests/f_multithread/expect.2            |    7 +
 tests/f_multithread/image.gz            |    1 +
 tests/f_multithread/name                |    1 +
 tests/f_multithread/script              |    4 +
 tests/f_multithread_completion/expect.1 |    2 +
 tests/f_multithread_completion/expect.2 |   23 +
 tests/f_multithread_completion/image.gz |    1 +
 tests/f_multithread_completion/name     |    1 +
 tests/f_multithread_completion/script   |    4 +
 tests/f_multithread_logfile/expect.1    |   25 +
 tests/f_multithread_logfile/image.gz    |    1 +
 tests/f_multithread_logfile/name        |    1 +
 tests/f_multithread_logfile/script      |   32 +
 tests/f_multithread_no/expect.1         |   26 +
 tests/f_multithread_no/expect.2         |   23 +
 tests/f_multithread_no/image.gz         |    1 +
 tests/f_multithread_no/name             |    1 +
 tests/f_multithread_no/script           |    4 +
 tests/f_multithread_ok/expect.1         |   15 +
 tests/f_multithread_ok/image.gz         |  Bin 0 -> 796311 bytes
 tests/f_multithread_ok/name             |    1 +
 tests/f_multithread_ok/script           |    4 +
 tests/f_multithread_preen/expect.1      |   11 +
 tests/f_multithread_preen/expect.2      |   23 +
 tests/f_multithread_preen/image.gz      |    1 +
 tests/f_multithread_preen/name          |    1 +
 tests/f_multithread_preen/script        |    4 +
 tests/f_multithread_yes/expect.1        |    2 +
 tests/f_multithread_yes/expect.2        |   23 +
 tests/f_multithread_yes/image.gz        |    1 +
 tests/f_multithread_yes/name            |    1 +
 tests/f_multithread_yes/script          |    4 +
 tests/test_one.in                       |    8 +
 72 files changed, 4186 insertions(+), 433 deletions(-)
 create mode 100644 lib/ext2fs/tst_bitmaps_pthread.c
 create mode 100644 lib/ext2fs/tst_bitmaps_standalone.c
 create mode 100644 lib/ext2fs/tst_libext2fs_pthread.c
 create mode 100644 tests/f_multithread/expect.1
 create mode 100644 tests/f_multithread/expect.2
 create mode 120000 tests/f_multithread/image.gz
 create mode 100644 tests/f_multithread/name
 create mode 100644 tests/f_multithread/script
 create mode 100644 tests/f_multithread_completion/expect.1
 create mode 100644 tests/f_multithread_completion/expect.2
 create mode 120000 tests/f_multithread_completion/image.gz
 create mode 100644 tests/f_multithread_completion/name
 create mode 100644 tests/f_multithread_completion/script
 create mode 100644 tests/f_multithread_logfile/expect.1
 create mode 120000 tests/f_multithread_logfile/image.gz
 create mode 100644 tests/f_multithread_logfile/name
 create mode 100644 tests/f_multithread_logfile/script
 create mode 100644 tests/f_multithread_no/expect.1
 create mode 100644 tests/f_multithread_no/expect.2
 create mode 120000 tests/f_multithread_no/image.gz
 create mode 100644 tests/f_multithread_no/name
 create mode 100644 tests/f_multithread_no/script
 create mode 100644 tests/f_multithread_ok/expect.1
 create mode 100644 tests/f_multithread_ok/image.gz
 create mode 100644 tests/f_multithread_ok/name
 create mode 100644 tests/f_multithread_ok/script
 create mode 100644 tests/f_multithread_preen/expect.1
 create mode 100644 tests/f_multithread_preen/expect.2
 create mode 120000 tests/f_multithread_preen/image.gz
 create mode 100644 tests/f_multithread_preen/name
 create mode 100644 tests/f_multithread_preen/script
 create mode 100644 tests/f_multithread_yes/expect.1
 create mode 100644 tests/f_multithread_yes/expect.2
 create mode 120000 tests/f_multithread_yes/image.gz
 create mode 100644 tests/f_multithread_yes/name
 create mode 100644 tests/f_multithread_yes/script
Signature · 1 line
2.37.3