summaryrefslogtreecommitdiff
path: root/dir-item.c
diff options
context:
space:
mode:
authorEric Sandeen <sandeen@redhat.com>2013-08-06 20:03:33 -0500
committerDavid Sterba <dsterba@suse.cz>2013-09-03 19:40:53 +0200
commit989ca65a11c4c537127207eaa019ac4149599017 (patch)
treeb798a8113b8dbf4f5541653046cd8fa53540cde1 /dir-item.c
parent6a0af4e57b58e9756e246db6967423ea6fa83265 (diff)
btrfs-progs: mark static & remove unused from shared kernel code
In files copied from the kernel, mark many functions as static, and remove any resulting dead code. Some functions are left unmarked if they aren't static in the kernel tree. Signed-off-by: Eric Sandeen <sandeen@redhat.com> Signed-off-by: Chris Mason <chris.mason@fusionio.com>
Diffstat (limited to 'dir-item.c')
-rw-r--r--dir-item.c97
1 files changed, 5 insertions, 92 deletions
diff --git a/dir-item.c b/dir-item.c
index beb308de..4d012d46 100644
--- a/dir-item.c
+++ b/dir-item.c
@@ -21,6 +21,10 @@
#include "hash.h"
#include "transaction.h"
+static struct btrfs_dir_item *btrfs_match_dir_item_name(struct btrfs_root *root,
+ struct btrfs_path *path,
+ const char *name, int name_len);
+
static struct btrfs_dir_item *insert_with_overflow(struct btrfs_trans_handle
*trans,
struct btrfs_root *root,
@@ -215,67 +219,7 @@ struct btrfs_dir_item *btrfs_lookup_dir_item(struct btrfs_trans_handle *trans,
return btrfs_match_dir_item_name(root, path, name, name_len);
}
-struct btrfs_dir_item *
-btrfs_lookup_dir_index_item(struct btrfs_trans_handle *trans,
- struct btrfs_root *root,
- struct btrfs_path *path, u64 dir,
- u64 objectid, const char *name, int name_len,
- int mod)
-{
- int ret;
- struct btrfs_key key;
- int ins_len = mod < 0 ? -1 : 0;
- int cow = mod != 0;
-
- key.objectid = dir;
- btrfs_set_key_type(&key, BTRFS_DIR_INDEX_KEY);
- key.offset = objectid;
-
- ret = btrfs_search_slot(trans, root, &key, path, ins_len, cow);
- if (ret < 0)
- return ERR_PTR(ret);
- if (ret > 0)
- return ERR_PTR(-ENOENT);
- return btrfs_match_dir_item_name(root, path, name, name_len);
-}
-
-struct btrfs_dir_item *btrfs_lookup_xattr(struct btrfs_trans_handle *trans,
- struct btrfs_root *root,
- struct btrfs_path *path, u64 dir,
- const char *name, u16 name_len,
- int mod)
-{
- int ret;
- struct btrfs_key key;
- int ins_len = mod < 0 ? -1 : 0;
- int cow = mod != 0;
- struct btrfs_key found_key;
- struct extent_buffer *leaf;
-
- key.objectid = dir;
- btrfs_set_key_type(&key, BTRFS_XATTR_ITEM_KEY);
- key.offset = btrfs_name_hash(name, name_len);
- ret = btrfs_search_slot(trans, root, &key, path, ins_len, cow);
- if (ret < 0)
- return ERR_PTR(ret);
- if (ret > 0) {
- if (path->slots[0] == 0)
- return NULL;
- path->slots[0]--;
- }
-
- leaf = path->nodes[0];
- btrfs_item_key_to_cpu(leaf, &found_key, path->slots[0]);
-
- if (found_key.objectid != dir ||
- btrfs_key_type(&found_key) != BTRFS_XATTR_ITEM_KEY ||
- found_key.offset != key.offset)
- return NULL;
-
- return btrfs_match_dir_item_name(root, path, name, name_len);
-}
-
-struct btrfs_dir_item *btrfs_match_dir_item_name(struct btrfs_root *root,
+static struct btrfs_dir_item *btrfs_match_dir_item_name(struct btrfs_root *root,
struct btrfs_path *path,
const char *name, int name_len)
{
@@ -305,34 +249,3 @@ struct btrfs_dir_item *btrfs_match_dir_item_name(struct btrfs_root *root,
}
return NULL;
}
-
-int btrfs_delete_one_dir_name(struct btrfs_trans_handle *trans,
- struct btrfs_root *root,
- struct btrfs_path *path,
- struct btrfs_dir_item *di)
-{
-
- struct extent_buffer *leaf;
- u32 sub_item_len;
- u32 item_len;
- int ret = 0;
-
- leaf = path->nodes[0];
- sub_item_len = sizeof(*di) + btrfs_dir_name_len(leaf, di) +
- btrfs_dir_data_len(leaf, di);
- item_len = btrfs_item_size_nr(leaf, path->slots[0]);
- if (sub_item_len == item_len) {
- ret = btrfs_del_item(trans, root, path);
- } else {
- /* MARKER */
- unsigned long ptr = (unsigned long)di;
- unsigned long start;
-
- start = btrfs_item_ptr_offset(leaf, path->slots[0]);
- memmove_extent_buffer(leaf, ptr, ptr + sub_item_len,
- item_len - (ptr + sub_item_len - start));
- ret = btrfs_truncate_item(trans, root, path,
- item_len - sub_item_len, 1);
- }
- return ret;
-}