Skip to content

Commit ca785f2

Browse files
committed
btrfs-progs: check: update error bit definitions
Bit shifts should be done on unsigned types as we're approaching 32, also update some missing descriptions. Signed-off-by: David Sterba <dsterba@suse.com>
1 parent 4126a42 commit ca785f2

File tree

2 files changed

+74
-74
lines changed

2 files changed

+74
-74
lines changed

check/mode-lowmem.h

Lines changed: 38 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -20,51 +20,51 @@
2020
#ifndef __BTRFS_CHECK_MODE_LOWMEM_H__
2121
#define __BTRFS_CHECK_MODE_LOWMEM_H__
2222

23-
#define ROOT_DIR_ERROR (1<<1) /* bad ROOT_DIR */
24-
#define DIR_ITEM_MISSING (1<<2) /* DIR_ITEM not found */
25-
#define DIR_ITEM_MISMATCH (1<<3) /* DIR_ITEM found but not match */
26-
#define INODE_REF_MISSING (1<<4) /* INODE_REF/INODE_EXTREF not found */
27-
#define INODE_ITEM_MISSING (1<<5) /* INODE_ITEM not found */
28-
#define INODE_ITEM_MISMATCH (1<<6) /* INODE_ITEM found but not match */
29-
#define FILE_EXTENT_ERROR (1<<7) /* bad FILE_EXTENT */
30-
#define ODD_CSUM_ITEM (1<<8) /* CSUM_ITEM error */
31-
#define CSUM_ITEM_MISSING (1<<9) /* CSUM_ITEM not found */
32-
#define LINK_COUNT_ERROR (1<<10) /* INODE_ITEM nlink count error */
33-
#define NBYTES_ERROR (1<<11) /* INODE_ITEM nbytes count error */
34-
#define ISIZE_ERROR (1<<12) /* INODE_ITEM size count error */
35-
#define ORPHAN_ITEM (1<<13) /* INODE_ITEM no reference */
36-
#define NO_INODE_ITEM (1<<14) /* no inode_item */
37-
#define LAST_ITEM (1<<15) /* Complete this tree traversal */
38-
#define ROOT_REF_MISSING (1<<16) /* ROOT_REF not found */
39-
#define ROOT_REF_MISMATCH (1<<17) /* ROOT_REF found but not match */
40-
#define DIR_INDEX_MISSING (1<<18) /* INODE_INDEX not found */
41-
#define DIR_INDEX_MISMATCH (1<<19) /* INODE_INDEX found but not match */
42-
#define DIR_COUNT_AGAIN (1<<20) /* DIR isize should be recalculated */
43-
#define BG_ACCOUNTING_ERROR (1<<21) /* Block group accounting error */
44-
#define FATAL_ERROR (1<<22) /* Fatal bit for errno */
45-
#define INODE_FLAGS_ERROR (1<<23) /* Invalid inode flags */
46-
#define DIR_ITEM_HASH_MISMATCH (1<<24) /* Dir item hash mismatch */
47-
#define INODE_MODE_ERROR (1<<25) /* Bad inode mode */
48-
#define INVALID_GENERATION (1<<26) /* Generation is too new */
49-
#define SUPER_BYTES_USED_ERROR (1<<27) /* Super bytes_used is invalid */
23+
#define ROOT_DIR_ERROR (1U << 1) /* bad ROOT_DIR */
24+
#define DIR_ITEM_MISSING (1U << 2) /* DIR_ITEM not found */
25+
#define DIR_ITEM_MISMATCH (1U << 3) /* DIR_ITEM found but not match */
26+
#define INODE_REF_MISSING (1U << 4) /* INODE_REF/INODE_EXTREF not found */
27+
#define INODE_ITEM_MISSING (1U << 5) /* INODE_ITEM not found */
28+
#define INODE_ITEM_MISMATCH (1U << 6) /* INODE_ITEM found but not match */
29+
#define FILE_EXTENT_ERROR (1U << 7) /* bad FILE_EXTENT */
30+
#define ODD_CSUM_ITEM (1U << 8) /* CSUM_ITEM error */
31+
#define CSUM_ITEM_MISSING (1U << 9) /* CSUM_ITEM not found */
32+
#define LINK_COUNT_ERROR (1U << 10) /* INODE_ITEM nlink count error */
33+
#define NBYTES_ERROR (1U << 11) /* INODE_ITEM nbytes count error */
34+
#define ISIZE_ERROR (1U << 12) /* INODE_ITEM size count error */
35+
#define ORPHAN_ITEM (1U << 13) /* INODE_ITEM no reference */
36+
#define NO_INODE_ITEM (1U << 14) /* no inode_item */
37+
#define LAST_ITEM (1U << 15) /* Complete this tree traversal */
38+
#define ROOT_REF_MISSING (1U << 16) /* ROOT_REF not found */
39+
#define ROOT_REF_MISMATCH (1U << 17) /* ROOT_REF found but not match */
40+
#define DIR_INDEX_MISSING (1U << 18) /* INODE_INDEX not found */
41+
#define DIR_INDEX_MISMATCH (1U << 19) /* INODE_INDEX found but not match */
42+
#define DIR_COUNT_AGAIN (1U << 20) /* DIR isize should be recalculated */
43+
#define BG_ACCOUNTING_ERROR (1U << 21) /* Block group accounting error */
44+
#define FATAL_ERROR (1U << 22) /* Fatal bit for errno */
45+
#define INODE_FLAGS_ERROR (1U << 23) /* Invalid inode flags */
46+
#define DIR_ITEM_HASH_MISMATCH (1U << 24) /* Dir item hash mismatch */
47+
#define INODE_MODE_ERROR (1U << 25) /* Bad inode mode */
48+
#define INVALID_GENERATION (1U << 26) /* Generation is too new */
49+
#define SUPER_BYTES_USED_ERROR (1U << 27) /* Super bytes_used is invalid */
5050

5151
/*
5252
* Error bit for low memory mode check.
5353
*
5454
* Currently no caller cares about it yet. Just internal use for error
5555
* classification.
5656
*/
57-
#define BACKREF_MISSING (1 << 0) /* Backref missing in extent tree */
58-
#define BACKREF_MISMATCH (1 << 1) /* Backref exists but does not match */
59-
#define BYTES_UNALIGNED (1 << 2) /* Some bytes are not aligned */
60-
#define REFERENCER_MISSING (1 << 3) /* Referencer not found */
61-
#define REFERENCER_MISMATCH (1 << 4) /* Referencer found but does not match */
62-
#define CROSSING_STRIPE_BOUNDARY (1 << 4) /* For kernel scrub workaround */
63-
#define ITEM_SIZE_MISMATCH (1 << 5) /* Bad item size */
64-
#define UNKNOWN_TYPE (1 << 6) /* Unknown type */
65-
#define ACCOUNTING_MISMATCH (1 << 7) /* Used space accounting error */
66-
#define CHUNK_TYPE_MISMATCH (1 << 8)
67-
#define BACKREF_OUT_OF_ORDER (1 << 9)
57+
#define BACKREF_MISSING (1U << 0) /* Backref missing in extent tree */
58+
#define BACKREF_MISMATCH (1U << 1) /* Backref exists but does not match */
59+
#define BYTES_UNALIGNED (1U << 2) /* Some bytes are not aligned */
60+
#define REFERENCER_MISSING (1U << 3) /* Referencer not found */
61+
#define REFERENCER_MISMATCH (1U << 4) /* Referencer found but does not match */
62+
#define CROSSING_STRIPE_BOUNDARY (1U << 4) /* For kernel scrub workaround */
63+
#define ITEM_SIZE_MISMATCH (1U << 5) /* Bad item size */
64+
#define UNKNOWN_TYPE (1U << 6) /* Unknown type */
65+
#define ACCOUNTING_MISMATCH (1U << 7) /* Used space accounting error */
66+
#define CHUNK_TYPE_MISMATCH (1U << 8) /* Extent type and chunk type don't match */
67+
#define BACKREF_OUT_OF_ORDER (1U << 9) /* Inline backrefs out of order */
6868

6969
int check_fs_roots_lowmem(void);
7070
int check_chunks_and_extents_lowmem(void);

check/mode-original.h

Lines changed: 36 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -136,19 +136,19 @@ struct root_item_record {
136136
struct btrfs_key drop_key;
137137
};
138138

139-
#define REF_ERR_NO_DIR_ITEM (1 << 0)
140-
#define REF_ERR_NO_DIR_INDEX (1 << 1)
141-
#define REF_ERR_NO_INODE_REF (1 << 2)
142-
#define REF_ERR_DUP_DIR_ITEM (1 << 3)
143-
#define REF_ERR_DUP_DIR_INDEX (1 << 4)
144-
#define REF_ERR_DUP_INODE_REF (1 << 5)
145-
#define REF_ERR_INDEX_UNMATCH (1 << 6)
146-
#define REF_ERR_FILETYPE_UNMATCH (1 << 7)
147-
#define REF_ERR_NAME_TOO_LONG (1 << 8) // 100
148-
#define REF_ERR_NO_ROOT_REF (1 << 9)
149-
#define REF_ERR_NO_ROOT_BACKREF (1 << 10)
150-
#define REF_ERR_DUP_ROOT_REF (1 << 11)
151-
#define REF_ERR_DUP_ROOT_BACKREF (1 << 12)
139+
#define REF_ERR_NO_DIR_ITEM (1U << 0)
140+
#define REF_ERR_NO_DIR_INDEX (1U << 1)
141+
#define REF_ERR_NO_INODE_REF (1U << 2)
142+
#define REF_ERR_DUP_DIR_ITEM (1U << 3)
143+
#define REF_ERR_DUP_DIR_INDEX (1U << 4)
144+
#define REF_ERR_DUP_INODE_REF (1U << 5)
145+
#define REF_ERR_INDEX_UNMATCH (1U << 6)
146+
#define REF_ERR_FILETYPE_UNMATCH (1U << 7)
147+
#define REF_ERR_NAME_TOO_LONG (1U << 8) // 100
148+
#define REF_ERR_NO_ROOT_REF (1U << 9)
149+
#define REF_ERR_NO_ROOT_BACKREF (1U << 10)
150+
#define REF_ERR_DUP_ROOT_REF (1U << 11)
151+
#define REF_ERR_DUP_ROOT_BACKREF (1U << 12)
152152

153153
struct file_extent_hole {
154154
struct rb_node node;
@@ -166,29 +166,29 @@ struct unaligned_extent_rec_t {
166166
u64 bytenr;
167167
};
168168

169-
#define I_ERR_NO_INODE_ITEM (1 << 0)
170-
#define I_ERR_NO_ORPHAN_ITEM (1 << 1)
171-
#define I_ERR_DUP_INODE_ITEM (1 << 2)
172-
#define I_ERR_DUP_DIR_INDEX (1 << 3)
173-
#define I_ERR_ODD_DIR_ITEM (1 << 4)
174-
#define I_ERR_ODD_FILE_EXTENT (1 << 5)
175-
#define I_ERR_BAD_FILE_EXTENT (1 << 6)
176-
#define I_ERR_FILE_EXTENT_OVERLAP (1 << 7)
177-
#define I_ERR_FILE_EXTENT_DISCOUNT (1 << 8) // 100
178-
#define I_ERR_DIR_ISIZE_WRONG (1 << 9)
179-
#define I_ERR_FILE_NBYTES_WRONG (1 << 10) // 400
180-
#define I_ERR_ODD_CSUM_ITEM (1 << 11)
181-
#define I_ERR_SOME_CSUM_MISSING (1 << 12)
182-
#define I_ERR_LINK_COUNT_WRONG (1 << 13)
183-
#define I_ERR_UNALIGNED_EXTENT_REC (1 << 14)
184-
#define I_ERR_FILE_EXTENT_TOO_LARGE (1 << 15)
185-
#define I_ERR_ODD_INODE_FLAGS (1 << 16)
186-
#define I_ERR_INLINE_RAM_BYTES_WRONG (1 << 17)
187-
#define I_ERR_MISMATCH_DIR_HASH (1 << 18)
188-
#define I_ERR_INVALID_IMODE (1 << 19)
189-
#define I_ERR_INVALID_GEN (1 << 20)
190-
#define I_ERR_INVALID_NLINK (1 << 21)
191-
#define I_ERR_INVALID_XATTR (1 << 22)
169+
#define I_ERR_NO_INODE_ITEM (1U << 0)
170+
#define I_ERR_NO_ORPHAN_ITEM (1U << 1)
171+
#define I_ERR_DUP_INODE_ITEM (1U << 2)
172+
#define I_ERR_DUP_DIR_INDEX (1U << 3)
173+
#define I_ERR_ODD_DIR_ITEM (1U << 4)
174+
#define I_ERR_ODD_FILE_EXTENT (1U << 5)
175+
#define I_ERR_BAD_FILE_EXTENT (1U << 6)
176+
#define I_ERR_FILE_EXTENT_OVERLAP (1U << 7)
177+
#define I_ERR_FILE_EXTENT_DISCOUNT (1U << 8) // 100
178+
#define I_ERR_DIR_ISIZE_WRONG (1U << 9)
179+
#define I_ERR_FILE_NBYTES_WRONG (1U << 10) // 400
180+
#define I_ERR_ODD_CSUM_ITEM (1U << 11)
181+
#define I_ERR_SOME_CSUM_MISSING (1U << 12)
182+
#define I_ERR_LINK_COUNT_WRONG (1U << 13)
183+
#define I_ERR_UNALIGNED_EXTENT_REC (1U << 14)
184+
#define I_ERR_FILE_EXTENT_TOO_LARGE (1U << 15)
185+
#define I_ERR_ODD_INODE_FLAGS (1U << 16)
186+
#define I_ERR_INLINE_RAM_BYTES_WRONG (1U << 17)
187+
#define I_ERR_MISMATCH_DIR_HASH (1U << 18)
188+
#define I_ERR_INVALID_IMODE (1U << 19)
189+
#define I_ERR_INVALID_GEN (1U << 20)
190+
#define I_ERR_INVALID_NLINK (1U << 21)
191+
#define I_ERR_INVALID_XATTR (1U << 22)
192192

193193
struct inode_record {
194194
struct list_head backrefs;

0 commit comments

Comments
 (0)