X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=inode-item.c;h=1cc106670cd4bfd1ebadb30b6c254b68fee8dd08;hb=591e44db21a2feb61d179630eaeb8ccc46e56d25;hp=d563d4eeb7ae74ef3f7ae2a6a3214e4e1f0c6c89;hpb=555743075b5cc924021dd1e1a4a4697ee91441d8;p=platform%2Fupstream%2Fbtrfs-progs.git diff --git a/inode-item.c b/inode-item.c index d563d4e..1cc1066 100644 --- a/inode-item.c +++ b/inode-item.c @@ -19,7 +19,7 @@ #include "ctree.h" #include "disk-io.h" #include "transaction.h" -#include "crc32c.h" +#include "hash.h" static int find_name_in_backref(struct btrfs_path *path, const char * name, int name_len, struct btrfs_inode_ref **ref_ret) @@ -79,7 +79,7 @@ int btrfs_insert_inode_ref(struct btrfs_trans_handle *trans, goto out; old_size = btrfs_item_size_nr(path->nodes[0], path->slots[0]); - ret = btrfs_extend_item(trans, root, path, ins_len); + ret = btrfs_extend_item(root, path, ins_len); BUG_ON(ret); ref = btrfs_item_ptr(path->nodes[0], path->slots[0], struct btrfs_inode_ref); @@ -106,8 +106,7 @@ out: btrfs_free_path(path); if (ret == -EMLINK) { - if (btrfs_fs_incompat(root->fs_info, - BTRFS_FEATURE_INCOMPAT_EXTENDED_IREF)) + if (btrfs_fs_incompat(root->fs_info, EXTENDED_IREF)) ret = btrfs_insert_inode_extref(trans, root, name, name_len, inode_objectid, @@ -128,13 +127,13 @@ int btrfs_lookup_inode(struct btrfs_trans_handle *trans, struct btrfs_root struct btrfs_key found_key; ret = btrfs_search_slot(trans, root, location, path, ins_len, cow); - if (ret > 0 && btrfs_key_type(location) == BTRFS_ROOT_ITEM_KEY && + if (ret > 0 && location->type == BTRFS_ROOT_ITEM_KEY && location->offset == (u64)-1 && path->slots[0] != 0) { slot = path->slots[0] - 1; leaf = path->nodes[0]; btrfs_item_key_to_cpu(leaf, &found_key, slot); if (found_key.objectid == location->objectid && - btrfs_key_type(&found_key) == btrfs_key_type(location)) { + found_key.type == location->type) { path->slots[0]--; return 0; } @@ -161,7 +160,7 @@ int btrfs_insert_inode(struct btrfs_trans_handle *trans, struct btrfs_root struct btrfs_inode_ref *btrfs_lookup_inode_ref(struct btrfs_trans_handle *trans, struct btrfs_root *root, struct btrfs_path *path, const char *name, int namelen, u64 ino, u64 parent_ino, - u64 index, int ins_len) + int ins_len) { struct btrfs_key key; struct btrfs_inode_ref *ret_inode_ref = NULL; @@ -184,12 +183,6 @@ out: return ret_inode_ref; } -static inline u64 btrfs_extref_hash(u64 parent_ino, const char *name, - int namelen) -{ - return (u64)btrfs_crc32c(parent_ino, name, namelen); -} - static int btrfs_find_name_in_ext_backref(struct btrfs_path *path, u64 parent_ino, const char *name, int namelen, struct btrfs_inode_extref **extref_ret) @@ -319,7 +312,7 @@ int btrfs_del_inode_extref(struct btrfs_trans_handle *trans, memmove_extent_buffer(leaf, ptr, ptr + del_len, item_size - (ptr + del_len - item_start)); - btrfs_truncate_item(trans, root, path, item_size - del_len, 1); + btrfs_truncate_item(root, path, item_size - del_len, 1); out: btrfs_free_path(path); @@ -361,7 +354,7 @@ int btrfs_insert_inode_extref(struct btrfs_trans_handle *trans, name, name_len, NULL)) goto out; - btrfs_extend_item(trans, root, path, ins_len); + btrfs_extend_item(root, path, ins_len); ret = 0; } @@ -440,14 +433,13 @@ int btrfs_del_inode_ref(struct btrfs_trans_handle *trans, 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)); - btrfs_truncate_item(trans, root, path, item_size - sub_item_len, 1); + btrfs_truncate_item(root, path, item_size - sub_item_len, 1); btrfs_mark_buffer_dirty(path->nodes[0]); out: btrfs_free_path(path); if (search_ext_refs && - btrfs_fs_incompat(root->fs_info, - BTRFS_FEATURE_INCOMPAT_EXTENDED_IREF)) { + btrfs_fs_incompat(root->fs_info, EXTENDED_IREF)) { /* * No refs were found, or we could not find the name in our ref * array. Find and remove the extended inode ref then.