From 9bb32b80037c351281f294ce97bfc9729e260f80 Mon Sep 17 00:00:00 2001 From: Zach Brown Date: Mon, 1 Jun 2020 16:18:59 -0700 Subject: [PATCH] scoutfs-utils: fix last data blkno The calculation of the last valid data blkno was off by one. It was calculating the total number of small blocks that fit in the device size. Signed-off-by: Zach Brown --- utils/src/mkfs.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/utils/src/mkfs.c b/utils/src/mkfs.c index d6932b61..eddf01e5 100644 --- a/utils/src/mkfs.c +++ b/utils/src/mkfs.c @@ -335,7 +335,7 @@ static int write_new_fs(char *path, int fd, u8 quorum_count) last_meta = next_meta + ((size / 5) >> SCOUTFS_BLOCK_LG_SHIFT); /* The rest of the device is data blocks */ first_data = (last_meta + 1) << SCOUTFS_BLOCK_SM_LG_SHIFT; - last_data = size >> SCOUTFS_BLOCK_SM_SHIFT; + last_data = (size >> SCOUTFS_BLOCK_SM_SHIFT) - 1; /* partially initialize the super so we can use it to init others */ memset(super, 0, SCOUTFS_BLOCK_SM_SIZE);