Skip to content

Commit

Permalink
Fix bp_embedded_type enum definition
Browse files Browse the repository at this point in the history
With the addition of BP_EMBEDDED_TYPE_REDACTED in 30af21b a couple of
codepaths make wrong assumptions and could potentially result in errors.

Reviewed-by: Brian Behlendorf <[email protected]>
Reviewed-by: Chris Dunlop <[email protected]>
Reviewed-by: Paul Dagnelie <[email protected]>
Signed-off-by: loli10K <[email protected]>
Closes openzfs#8951
Conflicts:
	include/sys/spa.h
  • Loading branch information
loli10K authored and tonyhutter committed Dec 27, 2019
1 parent 0701572 commit 320dad7
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions include/sys/spa.h
Original file line number Diff line number Diff line change
Expand Up @@ -401,8 +401,8 @@ _NOTE(CONSTCOND) } while (0)

typedef enum bp_embedded_type {
BP_EMBEDDED_TYPE_DATA,
BP_EMBEDDED_TYPE_RESERVED, /* Reserved for an unintegrated feature. */
NUM_BP_EMBEDDED_TYPES = BP_EMBEDDED_TYPE_RESERVED
BP_EMBEDDED_TYPE_RESERVED, /* Reserved for Delphix byteswap feature. */
NUM_BP_EMBEDDED_TYPES
} bp_embedded_type_t;

#define BPE_NUM_WORDS 14
Expand Down
2 changes: 1 addition & 1 deletion module/zfs/zio.c
Original file line number Diff line number Diff line change
Expand Up @@ -908,7 +908,7 @@ zfs_blkptr_verify(spa_t *spa, const blkptr_t *bp)
}

if (BP_IS_EMBEDDED(bp)) {
if (BPE_GET_ETYPE(bp) > NUM_BP_EMBEDDED_TYPES) {
if (BPE_GET_ETYPE(bp) >= NUM_BP_EMBEDDED_TYPES) {
zfs_panic_recover("blkptr at %p has invalid ETYPE %llu",
bp, (longlong_t)BPE_GET_ETYPE(bp));
}
Expand Down

0 comments on commit 320dad7

Please sign in to comment.