diff options
author | Jinoh Kang <jinoh.kang.kr@gmail.com> | 2021-01-17 12:49:33 +0100 |
---|---|---|
committer | Mike Snitzer <snitzer@redhat.com> | 2021-02-03 16:10:05 +0100 |
commit | 4c9e9883c20a3ad5384e689bdbb1d0677da4094c (patch) | |
tree | 89cadff58cb47d9b266138b57a17f867a23a5f8f /drivers/md | |
parent | dm: cleanup of front padding calculation (diff) | |
download | linux-4c9e9883c20a3ad5384e689bdbb1d0677da4094c.tar.xz linux-4c9e9883c20a3ad5384e689bdbb1d0677da4094c.zip |
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: Jinoh Kang <jinoh.kang.kr@gmail.com>
Signed-off-by: Mike Snitzer <snitzer@redhat.com>
Diffstat (limited to 'drivers/md')
-rw-r--r-- | drivers/md/persistent-data/dm-btree-internal.h | 2 | ||||
-rw-r--r-- | drivers/md/persistent-data/dm-btree-spine.c | 2 |
2 files changed, 2 insertions, 2 deletions
diff --git a/drivers/md/persistent-data/dm-btree-internal.h b/drivers/md/persistent-data/dm-btree-internal.h index 564896659dd4..fe073d92f01e 100644 --- a/drivers/md/persistent-data/dm-btree-internal.h +++ b/drivers/md/persistent-data/dm-btree-internal.h @@ -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. diff --git a/drivers/md/persistent-data/dm-btree-spine.c b/drivers/md/persistent-data/dm-btree-spine.c index e03cb9e48773..8a2bfbfb218b 100644 --- a/drivers/md/persistent-data/dm-btree-spine.c +++ b/drivers/md/persistent-data/dm-btree-spine.c @@ -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; } |