mirror of
https://github.com/versity/scoutfs.git
synced 2026-07-29 19:43:13 +00:00
Fix mkfs btree item offset calculation
mkfs was miscalculating the offset of the start of the free region in the center of blocks as it populated blocks with items. It was using the length of the free region as its offset in the block. To find the offset of the end of the free region in the block it has to be taken relative to the end of the item array. Signed-off-by: Zach Brown <zab@versity.com>
This commit is contained in:
+1
-1
@@ -40,7 +40,7 @@ static void *alloc_val(struct scoutfs_btree_block *bt, int len)
|
||||
{
|
||||
le16_add_cpu(&bt->mid_free_len, -len);
|
||||
le16_add_cpu(&bt->total_item_bytes, len);
|
||||
return (void *)bt + le16_to_cpu(bt->mid_free_len);
|
||||
return (void *)&bt->items[le16_to_cpu(bt->nr_items)] + le16_to_cpu(bt->mid_free_len);
|
||||
}
|
||||
|
||||
/*
|
||||
|
||||
Reference in New Issue
Block a user