summaryrefslogtreecommitdiff
path: root/inode-item.c
diff options
context:
space:
mode:
Diffstat (limited to 'inode-item.c')
-rw-r--r--inode-item.c73
1 files changed, 1 insertions, 72 deletions
diff --git a/inode-item.c b/inode-item.c
index 28865f7..8cc98c6 100644
--- a/inode-item.c
+++ b/inode-item.c
@@ -20,7 +20,7 @@
#include "disk-io.h"
#include "transaction.h"
-int find_name_in_backref(struct btrfs_path *path, const char * name,
+static int find_name_in_backref(struct btrfs_path *path, const char * name,
int name_len, struct btrfs_inode_ref **ref_ret)
{
struct extent_buffer *leaf;
@@ -49,60 +49,6 @@ int find_name_in_backref(struct btrfs_path *path, const char * name,
return 0;
}
-int btrfs_del_inode_ref(struct btrfs_trans_handle *trans,
- struct btrfs_root *root,
- const char *name, int name_len,
- u64 inode_objectid, u64 ref_objectid)
-{
- struct btrfs_path *path;
- struct btrfs_key key;
- struct btrfs_inode_ref *ref;
- struct extent_buffer *leaf;
- unsigned long ptr;
- unsigned long item_start;
- u32 item_size;
- u32 sub_item_len;
- int ret;
- int del_len = name_len + sizeof(*ref);
-
- key.objectid = inode_objectid;
- key.offset = ref_objectid;
- btrfs_set_key_type(&key, BTRFS_INODE_REF_KEY);
-
- path = btrfs_alloc_path();
- if (!path)
- return -ENOMEM;
-
- ret = btrfs_search_slot(trans, root, &key, path, -1, 1);
- if (ret > 0) {
- ret = -ENOENT;
- goto out;
- } else if (ret < 0) {
- goto out;
- }
- if (!find_name_in_backref(path, name, name_len, &ref)) {
- ret = -ENOENT;
- goto out;
- }
- leaf = path->nodes[0];
- item_size = btrfs_item_size_nr(leaf, path->slots[0]);
- if (del_len == item_size) {
- ret = btrfs_del_item(trans, root, path);
- goto out;
- }
- ptr = (unsigned long)ref;
- sub_item_len = name_len + sizeof(*ref);
- item_start = btrfs_item_ptr_offset(leaf, path->slots[0]);
- memmove_extent_buffer(leaf, ptr, ptr + sub_item_len,
- item_size - (ptr + sub_item_len - item_start));
- ret = btrfs_truncate_item(trans, root, path,
- item_size - sub_item_len, 1);
- BUG_ON(ret);
-out:
- btrfs_free_path(path);
- return ret;
-}
-
int btrfs_insert_inode_ref(struct btrfs_trans_handle *trans,
struct btrfs_root *root,
const char *name, int name_len,
@@ -158,23 +104,6 @@ out:
return ret;
}
-int btrfs_insert_empty_inode(struct btrfs_trans_handle *trans,
- struct btrfs_root *root,
- struct btrfs_path *path, u64 objectid)
-{
- struct btrfs_key key;
- int ret;
- key.objectid = objectid;
- btrfs_set_key_type(&key, BTRFS_INODE_ITEM_KEY);
- key.offset = 0;
-
- ret = btrfs_insert_empty_item(trans, root, path, &key,
- sizeof(struct btrfs_inode_item));
- if (ret == 0 && objectid > root->highest_inode)
- root->highest_inode = objectid;
- return ret;
-}
-
int btrfs_lookup_inode(struct btrfs_trans_handle *trans, struct btrfs_root
*root, struct btrfs_path *path,
struct btrfs_key *location, int mod)