On Thu, Nov 26, 2015 at 04:15:55PM +0800, Qu Wenruo wrote:
> For make_btrfs(), it's setting wrong buf size for last super block write
> out.
> The superblock size is always BTRFS_SUPER_INFO_SIZE, not
> cfg->sectorsize.
> 
> And this makes mkfs.btrfs -f -s 8K fails.
> 
> Fix it to BTRFS_SUPER_INFO_SIZE.
> 
> Signed-off-by: Qu Wenruo <[email protected]>

Already fixed in current devel (bf1ac8305ab3f191d9).

> --- a/utils.c
> +++ b/utils.c
> @@ -554,7 +554,7 @@ int make_btrfs(int fd, struct btrfs_mkfs_config *cfg)
>       BUG_ON(sizeof(super) > cfg->sectorsize);
>       memset(buf->data, 0, cfg->sectorsize);
>       memcpy(buf->data, &super, sizeof(super));
> -     buf->len = cfg->sectorsize;
> +     buf->len = BTRFS_SUPER_INFO_SIZE;
>       csum_tree_block_size(buf, BTRFS_CRC32_SIZE, 0);
>       ret = pwrite(fd, buf->data, cfg->sectorsize, cfg->blocks[0]);

Also, this overwrites more bytes than necessary so my fix uses
BTRFS_SUPER_INFO_SIZE everywhere.

>       if (ret != cfg->sectorsize) {
--
To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to