Commit 4c9e9883 authored by Jinoh Kang's avatar Jinoh Kang Committed by Mike Snitzer
Browse files

dm persistent data: fix return type of shadow_root()



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: default avatarJinoh Kang <jinoh.kang.kr@gmail.com>
Signed-off-by: default avatarMike Snitzer <snitzer@redhat.com>
parent 62f26317
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -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.
+1 −1
Original line number Diff line number Diff line
@@ -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;
}