ck: Merged FSCK+CK -> CK flag namespace
Unintentionally arriving at the infamous "fsck" name is a bit funny. But it's probably something we don't want to conflict with if we can help it, on the off chance we want a sort of lfs3_fsck function in the future. (This is all hypothetical, but lfs3_fsck may expect an unmounted filesystem, and have a much larger scope than lfs3_fs_ck. Though typing this out now I'm realizing how confusing that might be...) Since lfs3_file_ck and lfs3_fs_ck share a subset of flags, it's not _entirely_ unreasonable for lfs3_file_ck and lfs3_fs_ck to share the same namespace. There's a risk of confusing users around what flags lfs3_file_ck accepts, but we have asserts, and said flags (LFS3_CK_MKCONSISTENT, LFS3_CK_LOOKAHEAD, etc) just don't really make sense in lfs3_file_ck: fs file y LFS3_CK_MKCONSISTENT 0x00000800 Make the filesystem consistent y LFS3_CK_LOOKAHEAD 0x00001000 Repopulate lookahead buffer y LFS3_CK_LOOKGBMAP 0x00002000 Repopulate the gbmap y LFS3_CK_PREERASE* 0x00004000 Pre-erase unused blocks y LFS3_CK_COMPACTMETA 0x00008000 Compact metadata logs y y LFS3_CK_CKMETA 0x00010000 Check metadata checksums y y LFS3_CK_CKDATA 0x00020000 Check metadata + data checksums y y LFS3_CK_REPAIRMETA* 0x00040000 Repair data blocks y y LFS3_CK_REPAIRDATA* 0x00080000 Repair metadata + data blocks * Planned Another option would be to document that lfs3_fs_ck accepts both LFS3_CK_* _and_ LFS3_GC_* flags, but I worry that would be more confusing. It would also lock us into supporting all LFs3_GC_* flags in lfs3_fs_ck, which may not always be the case. Though this is an argument for doing away with the whole LFS3_M/F/CK/GC/I_* duplication... (tbh another reason for this is to reduce the number of namespaces by at least one). No code changes.
This commit is contained in:
@@ -362,46 +362,25 @@ enum lfs3_btype {
|
||||
#define LFS3_t_DIRTY 0x02000000 // Filesystem ckpointed outside traversal
|
||||
#define LFS3_t_STALE 0x01000000 // Block queue probably out-of-date
|
||||
|
||||
// File check flags
|
||||
#define LFS3_CK_CKMETA 0x00010000 // Check metadata checksums
|
||||
#define LFS3_CK_CKDATA 0x00020000 // Check metadata + data checksums
|
||||
|
||||
// an alias for all possible file check work
|
||||
#define LFS3_CK_ALL ( \
|
||||
LFS3_GC_CKMETA \
|
||||
| LFS3_GC_CKDATA)
|
||||
|
||||
// Filesystem check flags
|
||||
// File/filesystem check flags
|
||||
#ifndef LFS3_RDONLY
|
||||
#define LFS3_FSCK_MKCONSISTENT \
|
||||
#define LFS3_CK_MKCONSISTENT \
|
||||
0x00000800 // Make the filesystem consistent
|
||||
#endif
|
||||
#ifndef LFS3_RDONLY
|
||||
#define LFS3_FSCK_LOOKAHEAD \
|
||||
#define LFS3_CK_LOOKAHEAD \
|
||||
0x00001000 // Repopulate lookahead buffer
|
||||
#endif
|
||||
#if !defined(LFS3_RDONLY) && defined(LFS3_GBMAP)
|
||||
#define LFS3_FSCK_LOOKGBMAP \
|
||||
#define LFS3_CK_LOOKGBMAP \
|
||||
0x00002000 // Repopulate the gbmap
|
||||
#endif
|
||||
#ifndef LFS3_RDONLY
|
||||
#define LFS3_FSCK_COMPACTMETA \
|
||||
#define LFS3_CK_COMPACTMETA \
|
||||
0x00008000 // Compact metadata logs
|
||||
#endif
|
||||
#define LFS3_FSCK_CKMETA \
|
||||
0x00010000 // Check metadata checksums
|
||||
#define LFS3_FSCK_CKDATA \
|
||||
0x00020000 // Check metadata + data checksums
|
||||
|
||||
// an alias for all possible filesystem check work
|
||||
#define LFS3_FSCK_ALL ( \
|
||||
LFS3_IFDEF_RDONLY(0, LFS3_FSCK_MKCONSISTENT) \
|
||||
| LFS3_IFDEF_RDONLY(0, LFS3_FSCK_LOOKAHEAD) \
|
||||
| LFS3_IFDEF_RDONLY(0, \
|
||||
LFS3_IFDEF_GBMAP(LFS3_FSCK_LOOKGBMAP, 0)) \
|
||||
| LFS3_IFDEF_RDONLY(0, LFS3_FSCK_COMPACTMETA) \
|
||||
| LFS3_FSCK_CKMETA \
|
||||
| LFS3_FSCK_CKDATA)
|
||||
#define LFS3_CK_CKMETA 0x00010000 // Check metadata checksums
|
||||
#define LFS3_CK_CKDATA 0x00020000 // Check metadata + data checksums
|
||||
|
||||
// GC flags
|
||||
#ifndef LFS3_RDONLY
|
||||
|
||||
Reference in New Issue
Block a user