Compare commits

..

1 Commits

Author SHA1 Message Date
Tom Marshall 6e92d5071a Fix variable pblk len, cleanup, rearrange
This is tested with the performance profile and works.

Lots of cleanup and rearranging also.
2019-11-13 15:36:33 -08:00
1 changed files with 6 additions and 0 deletions

View File

@ -112,6 +112,12 @@ cbd_format(const char* dev,
((psize / pblk_size) <= 0xffff ? 2 :
((psize / pblk_size) <= 0xffffffff ? 4 : 6));
header.params.pbat_shift = pbatshift;
if (pbat_len(&header.params) * pblk_size > PAGE_SIZE) {
error("Physical block allocation table too large\n");
}
if (lba_len(&header.params) > pblk_size) {
error("lba element size too large\n");
}
/* XXX: Initial estimate */
header.params.lblk_per_zone = zone_data_len(&header.params) * (lsize / lblk_size) / (psize / pblk_size);
printf(" initial estimate for lblk_per_zone: %lu\n", (unsigned long)header.params.lblk_per_zone);