mkfs: factor the crap out of the code
Get series with b4
b4 am [email protected]Versions newest first
- v1 Latest42 patches 21 repliesIn review
Patches in v1 No applies recorded yet
| # | Subject and files | Size | Replies | Applied |
|---|---|---|---|---|
| 1/42 | mkfs: can't specify sector size of internal logmkfs/ | +4 | 0 replies | |
| 2/42 | mkfs: make subopt table constmkfs/ | +15 | 0 replies | |
| 3/42 | mkfs: introduce a structure to hold CLI optionsinclude/ mkfs/ | +91 | 0 replies | |
| 4/42 | mkfs: add generic subopt parsing tablemkfs/ | +130 | 0 replies | |
| 5/42 | mkfs: factor block subopts parsermkfs/ | +22 | 0 replies | |
| 6/42 | mkfs: factor data subopts parsermkfs/ | +91 | 0 replies | |
| 7/42 | mkfs: factor inode subopts parsermkfs/ | +48 | 0 replies | |
| 8/42 | mkfs: factor log subopts parsermkfs/ | +65 | 0 replies | |
| 9/42 | mkfs: factor meta subopts parsermkfs/ | +28 | 0 replies | |
| 10/42 | mkfs: factor naming subopts parsermkfs/ | +30 | 0 replies | |
| 11/42 | mkfs: factor rt subopts parsermkfs/ | +26 | 0 replies | |
| 12/42 | mkfs: factor sector subopts parsermkfs/ | +33 | 0 replies | |
| 13/42 | mkfs: Introduce mkfs configuration structuremkfs/ | +87 | 0 replies | |
| 14/42 | mkfs: factor printing of mkfs configmkfs/ | +35 | 0 replies | |
| 15/42 | mkfs: factor in memory superblock setupmkfs/ | +82 | 0 replies | |
| 16/42 | mkfs: factor out device preparationmkfs/ | +96 | 0 replies | |
| 17/42 | mkfs: factor writing AG headersmkfs/ | +390 | 0 replies | |
| 18/42 | mkfs: factor secondary superblock updatesmkfs/ | +36 | 0 replies | |
| 19/42 | mkfs: introduce default configuration structuremkfs/ | +61 | 0 replies | |
| 20/42 | mkfs: rename top level CLI parametersmkfs/ | +12 | 0 replies | |
| 21/42 | mkfs: factor sectorsize validationmkfs/ | +114 | 0 replies | |
| 22/42 | mkfs: factor blocksize validationmkfs/ | +38 | 0 replies | |
| 23/42 | mkfs: factor log sector size validationmkfs/ | +65 | 0 replies | |
| 24/42 | mkfs: factor superblock feature validationmkfs/ | +127 | 0 replies | |
| 25/42 | mkfs: factor directory blocksize validationmkfs/ | +42 | 0 replies | |
| 26/42 | mkfs: factor inode size validationmkfs/ | +53 | 0 replies | |
| 27/42 | mkfs: factor out device size calculationsmkfs/ | +43 | 0 replies | |
| 28/42 | mkfs: fix hidden parameter in DTOBT()mkfs/ | +14 | 0 replies | |
| 29/42 | mkfs: factor rtdev extent size validationmkfs/ | +59 | 0 replies | |
| 30/42 | mkfs: rework stripe calculationsmkfs/ | +180 | 0 replies | |
| 31/42 | mkfs: factor device openingmkfs/ | +51 | 0 replies | |
| 32/42 | mkfs: factor data device validationmkfs/ | +49 | 0 replies | |
| 33/42 | mkfs: factor log device validationmkfs/ | +89 | 0 replies | |
| 34/42 | mkfs: factor rt device validationmkfs/ | +63 | 0 replies | |
| 35/42 | mkfs: factor AG geometry calculationsmkfs/ | +42 | 0 replies | |
| 36/42 | mkfs: factor AG alignmentmkfs/ | +117 | 1 reply | |
| 37/42 | mkfs: rework imaxpct calculationmkfs/ | +29 | 0 replies | |
| 38/42 | mkfs: factor initial mount setupmkfs/ | +141 | 0 replies | |
| 39/42 | mkfs: factor log size calculationsmkfs/ | +217 | 1 reply | |
| 40/42 | mkfs: cleanup redundant temporary codemkfs/ | +34 | 0 replies | |
| 41/42 | mkfs: move error functionsmkfs/ | +157 | 0 replies | |
| 42/42 | mkfs: tidy up definitionsmkfs/ | +17 | 0 replies |
Reviews trailers per patch
None of the 42 patches has a Reviewed-by or Acked-by.
| Patch | Chandan Rajendra |
|---|---|
| Series | T-b |
| 1/42 | |
| 2/42 | |
| 3/42 | |
| 4/42 | |
| 5/42 | |
| 6/42 | |
| 7/42 | |
| 8/42 | |
| 9/42 | |
| 10/42 | |
| 11/42 | |
| 12/42 | |
| 13/42 | |
| 14/42 | |
| 15/42 | |
| 16/42 | |
| 17/42 | |
| 18/42 | |
| 19/42 | |
| 20/42 | |
| 21/42 | |
| 22/42 | |
| 23/42 | |
| 24/42 | |
| 25/42 | |
| 26/42 | |
| 27/42 | |
| 28/42 | |
| 29/42 | |
| 30/42 | |
| 31/42 | |
| 32/42 | |
| 33/42 | |
| 34/42 | |
| 35/42 | |
| 36/42 | |
| 37/42 | |
| 38/42 | |
| 39/42 | |
| 40/42 | |
| 41/42 | |
| 42/42 |
Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes.
Cover letter [PATCH 00/42] mkfs: factor the crap out of the code
Everyone who tries to modify mkfs quickly learns that it is a pile of spaghetti, the only difference in opinion is whether it is a steaming, cold or rotten pile. This patchset attempts to untangle the ball of pasta and turn it into a set of clear, obvious operations that lead to a filesystem being formatted correctly.
The patch series is really in three parts, splitting the code up into roughly three modules. The first part introduces a mkfs parameters structure and factors the on-disk formatting code to use only information in that structure. The second part introduces a command line input structure and factors the input parsing to use it. This requires a bunch of temporary code to keep the rest of the code working. The third part is factoring the input validation and geometry calculation code to use the input structure and put the output into the mkfs parameter structure and to remove all the temporary support code.
The result is three modules - input parsing, validation+calculations and formatting - with well defined data flow between them. This also paves the way to supporting config files to set defaults via a separate (new) module. The overall data flow now looks like this:
Build defaults --\
---> mkfs_default_params -> CLI -> mkfs_paramsconfig file -----/
It is not worth spending a lot of time reviewing the temporary code that is added - it gets removed before the end of the series. No attempt has been made to ensure that mkfs works 100% correctly after each patch is applied - the only guarantee is that it will build cleanly. It /should/ work if a bisect lands in the middle of the series, but trying to exhaustively test each patch is OK would take more effort than it is worth. As such, testing has only been performed on the whole series.
The new output from mkfs to indicate where it has sourced the defaults from causes xfstests to have conniptions. This requires some updates to the mkfs output filters that are already in place but it is a fairly trivial update. Test xfs/191 has a couple of new failures, but that is because the new code now correctly parses things like agsize so that block and sector size based specifications work with default mkfs values. This will require test updates.
Future work will be to split the xfs_mkfs.c file into a file per module (i.e. seperate files for CLI parsing, mkfs formating, validation+calculation and, finally, one for config file support), but otherwise the majority of the factoring work is now complete.
Comments, flames, etc all welcome.
-Dave.
Overall Diffstat:
include/libxfs.h | 2 mkfs/xfs_mkfs.c | 4615 ++++++++++++++++++++++++++++++------------------------- 2 files changed, 2578 insertions(+), 2039 deletions(-)