]> git.proxmox.com Git - mirror_ubuntu-jammy-kernel.git/commitdiff
dm persistent data: fix return type of shadow_root()
authorJinoh Kang <jinoh.kang.kr@gmail.com>
Sun, 17 Jan 2021 11:49:33 +0000 (11:49 +0000)
committerMike Snitzer <snitzer@redhat.com>
Wed, 3 Feb 2021 15:10:05 +0000 (10:10 -0500)
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>
drivers/md/persistent-data/dm-btree-internal.h
drivers/md/persistent-data/dm-btree-spine.c

index 564896659dd44609e679162aff1e948a0e00d4d0..fe073d92f01e66392f7bf7d20deef66541fe0200 100644 (file)
@@ -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.
index e03cb9e4877381c4bb6fc17da2b7e73890073793..8a2bfbfb218b4e7ca194a621564b082af68b6224 100644 (file)
@@ -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;
 }