Skip to content

mkfs: use BTRFS_IOC_GET_CSUMS if available#1096

Open
maharmstone wants to merge 1 commit intokdave:develfrom
maharmstone:mkfs-csums-ioctl
Open

mkfs: use BTRFS_IOC_GET_CSUMS if available#1096
maharmstone wants to merge 1 commit intokdave:develfrom
maharmstone:mkfs-csums-ioctl

Conversation

@maharmstone
Copy link
Contributor

Use the new BTRFS_IOC_GET_CSUMS ioctl when doing mkfs.btrfs --rootdir if it's available and the csum algorithms match, so we can use the values on disk rather than spending time recomputing them.

For the case when we're also using --reflink, this means that we can now forgo reading the data entirely.

Use the new BTRFS_IOC_GET_CSUMS ioctl when doing mkfs.btrfs --rootdir if
it's available and the csum algorithms match, so we can use the values
on disk rather than spending time recomputing them.

For the case when we're also using --reflink, this means that we can now
forgo reading the data entirely.

Signed-off-by: Mark Harmstone <mark@harmstone.com>
fi.flags = BTRFS_FS_INFO_FLAG_CSUM_INFO;

if (ioctl(source->fd, BTRFS_IOC_FS_INFO, &fi) == 0 &&
fi.csum_type == root->fs_info->csum_type)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We need to check not only the csum type but also the block size.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants