Skip to content

Commit

Permalink
dm persistent data: fix return type of shadow_root()
Browse files Browse the repository at this point in the history
shadow_root() truncates 64-bit dm_block_t into 32-bit int.  This is
not an issue in practice, since dm metadata as of v5.11 can only hold at
most 4161600 blocks (255 index entries * ~16k metadata blocks).

Nevertheless, this can confuse users debugging some specific data
corruption scenarios.  Also, DM_SM_METADATA_MAX_BLOCKS may be bumped in
the future, or persistent-data may find its use in other places.

Therefore, switch the return type of shadow_root from int to dm_block_t.

Signed-off-by: Jinoh Kang <jinoh.kang.kr@gmail.com>
Signed-off-by: Mike Snitzer <snitzer@redhat.com>
  • Loading branch information
Jinoh Kang authored and Mike Snitzer committed Feb 3, 2021
1 parent 62f2631 commit 4c9e988
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion drivers/md/persistent-data/dm-btree-internal.h
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ struct dm_block *shadow_parent(struct shadow_spine *s);

int shadow_has_parent(struct shadow_spine *s);

int shadow_root(struct shadow_spine *s);
dm_block_t shadow_root(struct shadow_spine *s);

/*
* Some inlines.
Expand Down
2 changes: 1 addition & 1 deletion drivers/md/persistent-data/dm-btree-spine.c
Original file line number Diff line number Diff line change
Expand Up @@ -235,7 +235,7 @@ int shadow_has_parent(struct shadow_spine *s)
return s->count >= 2;
}

int shadow_root(struct shadow_spine *s)
dm_block_t shadow_root(struct shadow_spine *s)
{
return s->root;
}
Expand Down

0 comments on commit 4c9e988

Please sign in to comment.