forked from Mirrors/btrfs-progs
btrfs-progs: check: use on-stack path buffer in check_fs_first_inode
We don't need to conserve stack space too much unlike kernel, also remove one error condition. Signed-off-by: David Sterba <dsterba@suse.com>master
parent
b625650933
commit
f73c5e075e
12
cmds-check.c
12
cmds-check.c
|
@ -4934,19 +4934,17 @@ out:
|
||||||
|
|
||||||
static int check_fs_first_inode(struct btrfs_root *root, unsigned int ext_ref)
|
static int check_fs_first_inode(struct btrfs_root *root, unsigned int ext_ref)
|
||||||
{
|
{
|
||||||
struct btrfs_path *path;
|
struct btrfs_path path;
|
||||||
struct btrfs_key key;
|
struct btrfs_key key;
|
||||||
int err = 0;
|
int err = 0;
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
path = btrfs_alloc_path();
|
btrfs_init_path(&path);
|
||||||
if (!path)
|
|
||||||
return -ENOMEM;
|
|
||||||
key.objectid = BTRFS_FIRST_FREE_OBJECTID;
|
key.objectid = BTRFS_FIRST_FREE_OBJECTID;
|
||||||
key.type = BTRFS_INODE_ITEM_KEY;
|
key.type = BTRFS_INODE_ITEM_KEY;
|
||||||
key.offset = 0;
|
key.offset = 0;
|
||||||
|
|
||||||
ret = btrfs_search_slot(NULL, root, &key, path, 0, 0);
|
ret = btrfs_search_slot(NULL, root, &key, &path, 0, 0);
|
||||||
if (ret < 0)
|
if (ret < 0)
|
||||||
goto out;
|
goto out;
|
||||||
if (ret > 0) {
|
if (ret > 0) {
|
||||||
|
@ -4954,12 +4952,12 @@ static int check_fs_first_inode(struct btrfs_root *root, unsigned int ext_ref)
|
||||||
err |= INODE_ITEM_MISSING;
|
err |= INODE_ITEM_MISSING;
|
||||||
}
|
}
|
||||||
|
|
||||||
err |= check_inode_item(root, path, ext_ref);
|
err |= check_inode_item(root, &path, ext_ref);
|
||||||
err &= ~LAST_ITEM;
|
err &= ~LAST_ITEM;
|
||||||
if (err && !ret)
|
if (err && !ret)
|
||||||
ret = -EIO;
|
ret = -EIO;
|
||||||
out:
|
out:
|
||||||
btrfs_free_path(path);
|
btrfs_release_path(&path);
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue