diff --git a/utils/src/crc.c b/utils/src/crc.c index 38640fbc..0562e580 100644 --- a/utils/src/crc.c +++ b/utils/src/crc.c @@ -32,8 +32,8 @@ u64 crc32c_64(u32 crc, const void *data, unsigned int len) crc32c(~crc, data + len - half, half); } -u32 crc_block(struct scoutfs_block_header *hdr) +u32 crc_block(struct scoutfs_block_header *hdr, u32 size) { return crc32c(~0, (char *)hdr + sizeof(hdr->crc), - SCOUTFS_BLOCK_SIZE - sizeof(hdr->crc)); + size - sizeof(hdr->crc)); } diff --git a/utils/src/crc.h b/utils/src/crc.h index 6878bf2f..a6e85ae0 100644 --- a/utils/src/crc.h +++ b/utils/src/crc.h @@ -7,6 +7,6 @@ u32 crc32c(u32 crc, const void *data, unsigned int len); u64 crc32c_64(u32 crc, const void *data, unsigned int len); -u32 crc_block(struct scoutfs_block_header *hdr); +u32 crc_block(struct scoutfs_block_header *hdr, u32 size); #endif diff --git a/utils/src/format.h b/utils/src/format.h index 822675e6..6c667c97 100644 --- a/utils/src/format.h +++ b/utils/src/format.h @@ -11,24 +11,42 @@ #define SCOUTFS_BLOCK_MAGIC_RADIX 0xebeb5e65 /* - * The super block and btree blocks are fixed 4k. + * The super block, quorum block, and file data allocation granularity + * use the smaller 4KB block. */ -#define SCOUTFS_BLOCK_SHIFT 12 -#define SCOUTFS_BLOCK_SIZE (1 << SCOUTFS_BLOCK_SHIFT) -#define SCOUTFS_BLOCK_MASK (SCOUTFS_BLOCK_SIZE - 1) -#define SCOUTFS_BLOCKS_PER_PAGE (PAGE_SIZE / SCOUTFS_BLOCK_SIZE) -#define SCOUTFS_BLOCK_SECTOR_SHIFT (SCOUTFS_BLOCK_SHIFT - 9) -#define SCOUTFS_BLOCK_SECTORS (1 << SCOUTFS_BLOCK_SECTOR_SHIFT) -#define SCOUTFS_BLOCK_MAX (U64_MAX >> SCOUTFS_BLOCK_SHIFT) +#define SCOUTFS_BLOCK_SM_SHIFT 12 +#define SCOUTFS_BLOCK_SM_SIZE (1 << SCOUTFS_BLOCK_SM_SHIFT) +#define SCOUTFS_BLOCK_SM_MASK (SCOUTFS_BLOCK_SM_SIZE - 1) +#define SCOUTFS_BLOCK_SM_PER_PAGE (PAGE_SIZE / SCOUTFS_BLOCK_SM_SIZE) +#define SCOUTFS_BLOCK_SM_SECTOR_SHIFT (SCOUTFS_BLOCK_SM_SHIFT - 9) +#define SCOUTFS_BLOCK_SM_SECTORS (1 << SCOUTFS_BLOCK_SM_SECTOR_SHIFT) +#define SCOUTFS_BLOCK_SM_MAX (U64_MAX >> SCOUTFS_BLOCK_SM_SHIFT) +#define SCOUTFS_BLOCK_SM_PAGES_PER (SCOUTFS_BLOCK_SM_SIZE / PAGE_SIZE) +#define SCOUTFS_BLOCK_SM_PAGE_ORDER (SCOUTFS_BLOCK_SM_SHIFT - PAGE_SHIFT) + +/* + * The radix and btree structures, and the forest bloom block, use the + * larger 64KB metadata block size. + */ +#define SCOUTFS_BLOCK_LG_SHIFT 16 +#define SCOUTFS_BLOCK_LG_SIZE (1 << SCOUTFS_BLOCK_LG_SHIFT) +#define SCOUTFS_BLOCK_LG_MASK (SCOUTFS_BLOCK_LG_SIZE - 1) +#define SCOUTFS_BLOCK_LG_PER_PAGE (PAGE_SIZE / SCOUTFS_BLOCK_LG_SIZE) +#define SCOUTFS_BLOCK_LG_SECTOR_SHIFT (SCOUTFS_BLOCK_LG_SHIFT - 9) +#define SCOUTFS_BLOCK_LG_SECTORS (1 << SCOUTFS_BLOCK_LG_SECTOR_SHIFT) +#define SCOUTFS_BLOCK_LG_MAX (U64_MAX >> SCOUTFS_BLOCK_LG_SHIFT) +#define SCOUTFS_BLOCK_LG_PAGES_PER (SCOUTFS_BLOCK_LG_SIZE / PAGE_SIZE) +#define SCOUTFS_BLOCK_LG_PAGE_ORDER (SCOUTFS_BLOCK_LG_SHIFT - PAGE_SHIFT) + +#define SCOUTFS_BLOCK_SM_LG_SHIFT (SCOUTFS_BLOCK_LG_SHIFT - \ + SCOUTFS_BLOCK_SM_SHIFT) -#define SCOUTFS_PAGES_PER_BLOCK (SCOUTFS_BLOCK_SIZE / PAGE_SIZE) -#define SCOUTFS_BLOCK_PAGE_ORDER (SCOUTFS_BLOCK_SHIFT - PAGE_SHIFT) /* * The super block leaves some room before the first block for platform * structures like boot loaders. */ -#define SCOUTFS_SUPER_BLKNO ((64ULL * 1024) >> SCOUTFS_BLOCK_SHIFT) +#define SCOUTFS_SUPER_BLKNO ((64ULL * 1024) >> SCOUTFS_BLOCK_SM_SHIFT) /* * A reasonably large region of aligned quorum blocks follow the super @@ -38,8 +56,8 @@ * mounts that have a reasonable probability of not overwriting each * other's random block locations. */ -#define SCOUTFS_QUORUM_BLKNO ((256ULL * 1024) >> SCOUTFS_BLOCK_SHIFT) -#define SCOUTFS_QUORUM_BLOCKS ((256ULL * 1024) >> SCOUTFS_BLOCK_SHIFT) +#define SCOUTFS_QUORUM_BLKNO ((256ULL * 1024) >> SCOUTFS_BLOCK_SM_SHIFT) +#define SCOUTFS_QUORUM_BLOCKS ((256ULL * 1024) >> SCOUTFS_BLOCK_SM_SHIFT) #define SCOUTFS_UNIQUE_NAME_MAX_BYTES 64 /* includes null */ @@ -168,8 +186,9 @@ struct scoutfs_radix_root { struct scoutfs_radix_ref ref; } __packed; -#define SCOUTFS_RADIX_REFS \ - ((SCOUTFS_BLOCK_SIZE - offsetof(struct scoutfs_radix_block, refs[0])) /\ +#define SCOUTFS_RADIX_REFS \ + ((SCOUTFS_BLOCK_LG_SIZE - \ + offsetof(struct scoutfs_radix_block, refs[0])) / \ sizeof(struct scoutfs_radix_ref)) /* 8 meg regions with 4k data blocks */ @@ -178,8 +197,8 @@ struct scoutfs_radix_root { #define SCOUTFS_RADIX_LG_MASK (SCOUTFS_RADIX_LG_BITS - 1) /* round block bits down to a multiple of large ranges */ -#define SCOUTFS_RADIX_BITS \ - (((SCOUTFS_BLOCK_SIZE - \ +#define SCOUTFS_RADIX_BITS \ + (((SCOUTFS_BLOCK_LG_SIZE - \ offsetof(struct scoutfs_radix_block, bits[0])) * 8) & \ ~(__u64)SCOUTFS_RADIX_LG_MASK) #define SCOUTFS_RADIX_BITS_BYTES (SCOUTFS_RADIX_BITS / 8) @@ -247,7 +266,7 @@ struct scoutfs_btree_block { * blocks aren't full. */ #define SCOUTFS_BTREE_LEAF_ITEM_HASH_NR \ - ((SCOUTFS_BLOCK_SIZE - sizeof(struct scoutfs_btree_block)) / \ + ((SCOUTFS_BLOCK_LG_SIZE - sizeof(struct scoutfs_btree_block)) / \ (sizeof(struct scoutfs_btree_item) + (sizeof(__le16))) * 100 / 75) #define SCOUTFS_BTREE_LEAF_ITEM_HASH_BYTES \ (SCOUTFS_BTREE_LEAF_ITEM_HASH_NR * sizeof(__le16)) @@ -313,9 +332,9 @@ struct scoutfs_bloom_block { */ #define SCOUTFS_FOREST_BLOOM_NRS 7 #define SCOUTFS_FOREST_BLOOM_BITS \ - (((SCOUTFS_BLOCK_SIZE - sizeof(struct scoutfs_bloom_block)) / \ - member_sizeof(struct scoutfs_bloom_block, bits[0])) * \ - member_sizeof(struct scoutfs_bloom_block, bits[0]) * 8) \ + (((SCOUTFS_BLOCK_LG_SIZE - sizeof(struct scoutfs_bloom_block)) / \ + member_sizeof(struct scoutfs_bloom_block, bits[0])) * \ + member_sizeof(struct scoutfs_bloom_block, bits[0]) * 8) \ /* * Keys are first sorted by major key zones. @@ -380,10 +399,10 @@ struct scoutfs_packed_extent { __u8 le_blkno_diff[0]; } __packed; -#define SCOUTFS_PACKEXT_BLOCKS (8 * 1024 * 1024 / SCOUTFS_BLOCK_SIZE) -#define SCOUTFS_PACKEXT_BASE_SHIFT (ilog2(SCOUTFS_PACKEXT_BLOCKS)) -#define SCOUTFS_PACKEXT_BASE_MASK (~((__u64)SCOUTFS_PACKEXT_BLOCKS - 1)) -#define SCOUTFS_PACKEXT_MAX_BYTES SCOUTFS_MAX_VAL_SIZE +#define SCOUTFS_PACKEXT_BLOCKS (8 * 1024 * 1024 / SCOUTFS_BLOCK_SM_SIZE) +#define SCOUTFS_PACKEXT_BASE_SHIFT (ilog2(SCOUTFS_PACKEXT_BLOCKS)) +#define SCOUTFS_PACKEXT_BASE_MASK (~((__u64)SCOUTFS_PACKEXT_BLOCKS - 1)) +#define SCOUTFS_PACKEXT_MAX_BYTES SCOUTFS_MAX_VAL_SIZE #define SEF_OFFLINE (1 << 0) #define SEF_UNWRITTEN (1 << 1) @@ -445,8 +464,8 @@ struct scoutfs_quorum_block { } __packed log[0]; } __packed; -#define SCOUTFS_QUORUM_LOG_MAX \ - ((SCOUTFS_BLOCK_SIZE - sizeof(struct scoutfs_quorum_block)) / \ +#define SCOUTFS_QUORUM_LOG_MAX \ + ((SCOUTFS_BLOCK_SM_SIZE - sizeof(struct scoutfs_quorum_block)) / \ sizeof(struct scoutfs_quorum_log)) struct scoutfs_super_block { diff --git a/utils/src/leaf_item_hash.c b/utils/src/leaf_item_hash.c index 32dca525..4955b1b2 100644 --- a/utils/src/leaf_item_hash.c +++ b/utils/src/leaf_item_hash.c @@ -16,7 +16,7 @@ int leaf_item_hash_ind(struct scoutfs_key *key) __le16 *leaf_item_hash_buckets(struct scoutfs_btree_block *bt) { - return (void *)bt + SCOUTFS_BLOCK_SIZE - + return (void *)bt + SCOUTFS_BLOCK_LG_SIZE - SCOUTFS_BTREE_LEAF_ITEM_HASH_BYTES; } diff --git a/utils/src/mkfs.c b/utils/src/mkfs.c index 7b9650f4..1aa46700 100644 --- a/utils/src/mkfs.c +++ b/utils/src/mkfs.c @@ -29,12 +29,13 @@ #include "radix.h" #include "leaf_item_hash.h" -static int write_raw_block(int fd, u64 blkno, void *blk) +static int write_raw_block(int fd, u64 blkno, int shift, void *blk) { + size_t size = 1ULL << shift; ssize_t ret; - ret = pwrite(fd, blk, SCOUTFS_BLOCK_SIZE, blkno << SCOUTFS_BLOCK_SHIFT); - if (ret != SCOUTFS_BLOCK_SIZE) { + ret = pwrite(fd, blk, size, blkno << shift); + if (ret != size) { fprintf(stderr, "write to blkno %llu returned %zd: %s (%d)\n", blkno, ret, strerror(errno), errno); return -errno; @@ -46,15 +47,18 @@ static int write_raw_block(int fd, u64 blkno, void *blk) /* * Update the block's header and write it out. */ -static int write_block(int fd, u64 blkno, struct scoutfs_super_block *super, +static int write_block(int fd, u64 blkno, int shift, + struct scoutfs_super_block *super, struct scoutfs_block_header *hdr) { + size_t size = 1ULL << shift; + if (super) *hdr = super->hdr; hdr->blkno = cpu_to_le64(blkno); - hdr->crc = cpu_to_le32(crc_block(hdr)); + hdr->crc = cpu_to_le32(crc_block(hdr, size)); - return write_raw_block(fd, blkno, hdr); + return write_raw_block(fd, blkno, shift, hdr); } static float size_flt(u64 nr, unsigned size) @@ -231,7 +235,7 @@ static int write_radix_blocks(struct scoutfs_super_block *super, int fd, return -ENOMEM; for (i = 0; i < alloced; i++) { - blocks[i] = calloc(1, SCOUTFS_BLOCK_SIZE); + blocks[i] = calloc(1, SCOUTFS_BLOCK_LG_SIZE); if (blocks[i] == NULL) { ret = -ENOMEM; goto out; @@ -262,8 +266,10 @@ static int write_radix_blocks(struct scoutfs_super_block *super, int fd, rdx->hdr.fsid = super->hdr.fsid; rdx->hdr.seq = cpu_to_le64(1); rdx->hdr.blkno = cpu_to_le64(blkno + i); - rdx->hdr.crc = cpu_to_le32(crc_block(&rdx->hdr)); - ret = write_raw_block(fd, blkno + i, rdx); + rdx->hdr.crc = cpu_to_le32(crc_block(&rdx->hdr, + SCOUTFS_BLOCK_LG_SIZE)); + ret = write_raw_block(fd, blkno + i, SCOUTFS_BLOCK_LG_SHIFT, + rdx); if (ret < 0) goto out; } @@ -300,20 +306,19 @@ static int write_new_fs(char *path, int fd, u8 quorum_count) u64 blkno; u64 limit; u64 size; - u64 total_blocks; u64 meta_alloc_blocks; u64 next_meta; u64 last_meta; - u64 next_data; + u64 first_data; u64 last_data; int ret; int i; gettimeofday(&tv, NULL); - super = calloc(1, SCOUTFS_BLOCK_SIZE); - bt = calloc(1, SCOUTFS_BLOCK_SIZE); - zeros = calloc(1, SCOUTFS_BLOCK_SIZE); + super = calloc(1, SCOUTFS_BLOCK_SM_SIZE); + bt = calloc(1, SCOUTFS_BLOCK_LG_SIZE); + zeros = calloc(1, SCOUTFS_BLOCK_SM_SIZE); if (!super || !bt || !zeros) { ret = -errno; fprintf(stderr, "failed to allocate block mem: %s (%d)\n", @@ -336,17 +341,17 @@ static int write_new_fs(char *path, int fd, u8 quorum_count) goto out; } - total_blocks = size / SCOUTFS_BLOCK_SIZE; /* metadata blocks start after the quorum blocks */ - next_meta = SCOUTFS_QUORUM_BLKNO + SCOUTFS_QUORUM_BLOCKS; - /* data blocks are after metadata, we'll say 1:4 for now */ - next_data = round_up(next_meta + ((total_blocks - next_meta) / 5), - SCOUTFS_RADIX_BITS); - last_meta = next_data - 1; - last_data = total_blocks - 1; + next_meta = (SCOUTFS_QUORUM_BLKNO + SCOUTFS_QUORUM_BLOCKS) >> + SCOUTFS_BLOCK_SM_LG_SHIFT; + /* use about 1/5 of the device for metadata blocks */ + 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; /* partially initialize the super so we can use it to init others */ - memset(super, 0, SCOUTFS_BLOCK_SIZE); + memset(super, 0, SCOUTFS_BLOCK_SM_SIZE); pseudo_random_bytes(&super->hdr.fsid, sizeof(super->hdr.fsid)); super->hdr.magic = cpu_to_le32(SCOUTFS_BLOCK_MAGIC_SUPER); super->hdr.seq = cpu_to_le64(1); @@ -357,8 +362,8 @@ static int write_new_fs(char *path, int fd, u8 quorum_count) super->total_meta_blocks = cpu_to_le64(last_meta + 1); super->first_meta_blkno = cpu_to_le64(next_meta); super->last_meta_blkno = cpu_to_le64(last_meta); - super->total_data_blocks = cpu_to_le64(last_data - next_data + 1); - super->first_data_blkno = cpu_to_le64(next_data); + super->total_data_blocks = cpu_to_le64(last_data - first_data + 1); + super->first_data_blkno = cpu_to_le64(first_data); super->last_data_blkno = cpu_to_le64(last_data); super->quorum_count = quorum_count; @@ -369,7 +374,7 @@ static int write_new_fs(char *path, int fd, u8 quorum_count) super->fs_root.ref.seq = cpu_to_le64(1); super->fs_root.height = 1; - memset(bt, 0, SCOUTFS_BLOCK_SIZE); + memset(bt, 0, SCOUTFS_BLOCK_LG_SIZE); bt->hdr.fsid = super->hdr.fsid; bt->hdr.blkno = cpu_to_le64(blkno); bt->hdr.seq = cpu_to_le64(1); @@ -396,7 +401,7 @@ static int write_new_fs(char *path, int fd, u8 quorum_count) btitem = &bt->items[le16_to_cpu(bt->nr_items)]; le16_add_cpu(&bt->nr_items, 1); key = &btitem->key; - own = (void *)bt + SCOUTFS_BLOCK_SIZE - + own = (void *)bt + SCOUTFS_BLOCK_LG_SIZE - SCOUTFS_BTREE_LEAF_ITEM_HASH_BYTES - SCOUTFS_BTREE_VAL_OWNER_BYTES; inode = (void *)own - sizeof(*inode); @@ -433,15 +438,16 @@ static int write_new_fs(char *path, int fd, u8 quorum_count) bt->mid_free_len = cpu_to_le16((void *)inode - (void *)&bt->items[le16_to_cpu(bt->nr_items)]); bt->hdr.magic = cpu_to_le32(SCOUTFS_BLOCK_MAGIC_BTREE); - bt->hdr.crc = cpu_to_le32(crc_block(&bt->hdr)); + bt->hdr.crc = cpu_to_le32(crc_block(&bt->hdr, + SCOUTFS_BLOCK_LG_SIZE)); - ret = write_raw_block(fd, blkno, bt); + ret = write_raw_block(fd, blkno, SCOUTFS_BLOCK_LG_SHIFT, bt); if (ret) goto out; /* write out radix allocator blocks for data */ ret = write_radix_blocks(super, fd, &super->core_data_avail, next_meta, - next_data, last_data); + first_data, last_data); if (ret < 0) goto out; next_meta += ret; @@ -467,7 +473,8 @@ static int write_new_fs(char *path, int fd, u8 quorum_count) /* zero out quorum blocks */ for (i = 0; i < SCOUTFS_QUORUM_BLOCKS; i++) { - ret = write_raw_block(fd, SCOUTFS_QUORUM_BLKNO + i, zeros); + ret = write_raw_block(fd, SCOUTFS_QUORUM_BLKNO + i, + SCOUTFS_BLOCK_SM_SHIFT, zeros); if (ret < 0) { fprintf(stderr, "error zeroing quorum block: %s (%d)\n", strerror(-errno), -errno); @@ -477,11 +484,12 @@ static int write_new_fs(char *path, int fd, u8 quorum_count) /* fill out allocator fields now that we've written our blocks */ super->free_meta_blocks = cpu_to_le64(last_meta - next_meta + 1); - super->free_data_blocks = cpu_to_le64(last_data - next_data + 1); + super->free_data_blocks = cpu_to_le64(last_data - first_data + 1); /* write the super block */ super->hdr.seq = cpu_to_le64(1); - ret = write_block(fd, SCOUTFS_SUPER_BLKNO, NULL, &super->hdr); + ret = write_block(fd, SCOUTFS_SUPER_BLKNO, SCOUTFS_BLOCK_SM_SHIFT, + NULL, &super->hdr); if (ret) goto out; @@ -499,19 +507,17 @@ static int write_new_fs(char *path, int fd, u8 quorum_count) " fsid: %llx\n" " format hash: %llx\n" " uuid: %s\n" - " device blocks: "SIZE_FMT"\n" - " metadata blocks: "SIZE_FMT"\n" - " data blocks: "SIZE_FMT"\n" + " 64KB metadata blocks: "SIZE_FMT"\n" + " 4KB data blocks: "SIZE_FMT"\n" " quorum count: %u\n", path, le64_to_cpu(super->hdr.fsid), le64_to_cpu(super->format_hash), uuid_str, - SIZE_ARGS(total_blocks, SCOUTFS_BLOCK_SIZE), SIZE_ARGS(le64_to_cpu(super->total_meta_blocks), - SCOUTFS_BLOCK_SIZE), + SCOUTFS_BLOCK_LG_SIZE), SIZE_ARGS(le64_to_cpu(super->total_data_blocks), - SCOUTFS_BLOCK_SIZE), + SCOUTFS_BLOCK_SM_SIZE), super->quorum_count); ret = 0; diff --git a/utils/src/print.c b/utils/src/print.c index 4dff2c28..9040611c 100644 --- a/utils/src/print.c +++ b/utils/src/print.c @@ -24,17 +24,18 @@ #include "avl.h" #include "leaf_item_hash.h" -static void *read_block(int fd, u64 blkno) +static void *read_block(int fd, u64 blkno, int shift) { + size_t size = 1ULL << shift; ssize_t ret; void *buf; - buf = malloc(SCOUTFS_BLOCK_SIZE); + buf = malloc(size); if (!buf) return NULL; - ret = pread(fd, buf, SCOUTFS_BLOCK_SIZE, blkno << SCOUTFS_BLOCK_SHIFT); - if (ret != SCOUTFS_BLOCK_SIZE) { + ret = pread(fd, buf, size, blkno << shift); + if (ret != size) { fprintf(stderr, "read blkno %llu returned %zd: %s (%d)\n", blkno, ret, strerror(errno), errno); free(buf); @@ -44,9 +45,9 @@ static void *read_block(int fd, u64 blkno) return buf; } -static void print_block_header(struct scoutfs_block_header *hdr) +static void print_block_header(struct scoutfs_block_header *hdr, int size) { - u32 crc = crc_block(hdr); + u32 crc = crc_block(hdr, size); char valid_str[40]; if (crc != le32_to_cpu(hdr->crc)) @@ -443,7 +444,7 @@ static int print_btree_block(int fd, struct scoutfs_super_block *super, int ret; int i; - bt = read_block(fd, le64_to_cpu(ref->blkno)); + bt = read_block(fd, le64_to_cpu(ref->blkno), SCOUTFS_BLOCK_LG_SHIFT); if (!bt) return -ENOMEM; @@ -545,14 +546,14 @@ static int print_radix_block(int fd, struct scoutfs_radix_ref *par, int level) if (blkno == 0 || blkno == U64_MAX || level == 0) return 0; - rdx = read_block(fd, le64_to_cpu(par->blkno)); + rdx = read_block(fd, le64_to_cpu(par->blkno) , SCOUTFS_BLOCK_LG_SHIFT); if (!rdx) { ret = -ENOMEM; goto out; } printf("radix parent block blkno %llu\n", le64_to_cpu(par->blkno)); - print_block_header(&rdx->hdr); + print_block_header(&rdx->hdr, SCOUTFS_BLOCK_LG_SIZE); printf(" sm_first %u lg_first %u\n", le32_to_cpu(rdx->sm_first), le32_to_cpu(rdx->lg_first)); @@ -652,7 +653,7 @@ static int print_btree_leaf_items(int fd, struct scoutfs_super_block *super, if (ref->blkno == 0) return 0; - bt = read_block(fd, le64_to_cpu(ref->blkno)); + bt = read_block(fd, le64_to_cpu(ref->blkno), SCOUTFS_BLOCK_LG_SHIFT); if (!bt) return -ENOMEM; @@ -717,7 +718,7 @@ static int print_quorum_blocks(int fd, struct scoutfs_super_block *super) for (i = 0; i < SCOUTFS_QUORUM_BLOCKS; i++) { blkno = SCOUTFS_QUORUM_BLKNO + i; free(blk); - blk = read_block(fd, blkno); + blk = read_block(fd, blkno, SCOUTFS_BLOCK_SM_SHIFT); if (!blk) { ret = -ENOMEM; goto out; @@ -766,7 +767,7 @@ static void print_super_block(struct scoutfs_super_block *super, u64 blkno) uuid_unparse(super->uuid, uuid_str); printf("super blkno %llu\n", blkno); - print_block_header(&super->hdr); + print_block_header(&super->hdr, SCOUTFS_BLOCK_SM_SIZE); printf(" format_hash %llx uuid %s\n", le64_to_cpu(super->format_hash), uuid_str); @@ -830,7 +831,7 @@ static int print_volume(int fd) int ret = 0; int err; - super = read_block(fd, SCOUTFS_SUPER_BLKNO); + super = read_block(fd, SCOUTFS_SUPER_BLKNO, SCOUTFS_BLOCK_SM_SHIFT); if (!super) return -ENOMEM;