#include "ctree.h"
#include "disk-io.h"
#include "transaction.h"
+#include "internal.h"
/*
* walks the btree of allocated inodes and find a hole.
u64 search_start = dirid;
path = btrfs_alloc_path();
- BUG_ON(!path);
+ if (!path)
+ return -ENOMEM;
+
search_start = root->last_inode_alloc;
search_start = max((unsigned long long)search_start,
BTRFS_FIRST_FREE_OBJECTID);
search_key.objectid = search_start;
search_key.offset = 0;
+ search_key.type = 0;
btrfs_init_path(path);
start_found = 0;
// FIXME -ENOSPC
found:
root->last_inode_alloc = *objectid;
- btrfs_release_path(path);
btrfs_free_path(path);
BUG_ON(*objectid < search_start);
return 0;
error:
- btrfs_release_path(path);
btrfs_free_path(path);
return ret;
}