mirror of
https://github.com/kdave/btrfs-progs
synced 2025-01-13 17:21:05 +00:00
btrfs-progs: fix search tree v2 ioctl detection
The result of the test applies per-filesystem, so we can't simply cache it. The function hasn't been used yet. Signed-off-by: David Sterba <dsterba@suse.com>
This commit is contained in:
parent
92576929fb
commit
3934ba255d
17
utils.c
17
utils.c
@ -3825,6 +3825,10 @@ u64 get_partition_size(const char *dev)
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Check if the BTRFS_IOC_TREE_SEARCH_V2 ioctl is supported on a given
|
||||||
|
* filesystem, opened at fd
|
||||||
|
*/
|
||||||
int btrfs_tree_search2_ioctl_supported(int fd)
|
int btrfs_tree_search2_ioctl_supported(int fd)
|
||||||
{
|
{
|
||||||
struct btrfs_ioctl_search_args_v2 *args2;
|
struct btrfs_ioctl_search_args_v2 *args2;
|
||||||
@ -3832,10 +3836,6 @@ int btrfs_tree_search2_ioctl_supported(int fd)
|
|||||||
int args2_size = 1024;
|
int args2_size = 1024;
|
||||||
char args2_buf[args2_size];
|
char args2_buf[args2_size];
|
||||||
int ret;
|
int ret;
|
||||||
static int v2_supported = -1;
|
|
||||||
|
|
||||||
if (v2_supported != -1)
|
|
||||||
return v2_supported;
|
|
||||||
|
|
||||||
args2 = (struct btrfs_ioctl_search_args_v2 *)args2_buf;
|
args2 = (struct btrfs_ioctl_search_args_v2 *)args2_buf;
|
||||||
sk = &(args2->key);
|
sk = &(args2->key);
|
||||||
@ -3856,13 +3856,10 @@ int btrfs_tree_search2_ioctl_supported(int fd)
|
|||||||
args2->buf_size = args2_size - sizeof(struct btrfs_ioctl_search_args_v2);
|
args2->buf_size = args2_size - sizeof(struct btrfs_ioctl_search_args_v2);
|
||||||
ret = ioctl(fd, BTRFS_IOC_TREE_SEARCH_V2, args2);
|
ret = ioctl(fd, BTRFS_IOC_TREE_SEARCH_V2, args2);
|
||||||
if (ret == -EOPNOTSUPP)
|
if (ret == -EOPNOTSUPP)
|
||||||
v2_supported = 0;
|
return 0;
|
||||||
else if (ret == 0)
|
else if (ret == 0)
|
||||||
v2_supported = 1;
|
return 1;
|
||||||
else
|
return ret;
|
||||||
return ret;
|
|
||||||
|
|
||||||
return v2_supported;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
int btrfs_check_nodesize(u32 nodesize, u32 sectorsize, u64 features)
|
int btrfs_check_nodesize(u32 nodesize, u32 sectorsize, u64 features)
|
||||||
|
Loading…
Reference in New Issue
Block a user