summaryrefslogtreecommitdiffstats
path: root/fs/btrfs
diff options
context:
space:
mode:
authorChris Mason <chris.mason@oracle.com>2007-04-10 12:13:09 -0400
committerDavid Woodhouse <dwmw2@hera.kernel.org>2007-04-10 12:13:09 -0400
commit1b05da2ee6217e7d55460d04335813fec25be4ca (patch)
tree250a3e789777c7a6d17dccf0bf5a57b00ef1bdac /fs/btrfs
parentc5739bba5260a59cebd20a51a55080592c8d3b07 (diff)
downloadop-kernel-dev-1b05da2ee6217e7d55460d04335813fec25be4ca.zip
op-kernel-dev-1b05da2ee6217e7d55460d04335813fec25be4ca.tar.gz
Btrfs: drop the inode map tree
Signed-off-by: Chris Mason <chris.mason@oracle.com>
Diffstat (limited to 'fs/btrfs')
-rw-r--r--fs/btrfs/btrfs_inode.h2
-rw-r--r--fs/btrfs/ctree.h39
-rw-r--r--fs/btrfs/disk-io.c25
-rw-r--r--fs/btrfs/inode-item.c2
-rw-r--r--fs/btrfs/inode-map.c65
-rw-r--r--fs/btrfs/print-tree.c8
-rw-r--r--fs/btrfs/super.c89
-rw-r--r--fs/btrfs/transaction.c7
8 files changed, 33 insertions, 204 deletions
diff --git a/fs/btrfs/btrfs_inode.h b/fs/btrfs/btrfs_inode.h
index 3439ffb..43a4f1dd 100644
--- a/fs/btrfs/btrfs_inode.h
+++ b/fs/btrfs/btrfs_inode.h
@@ -2,11 +2,9 @@
#define __BTRFS_I__
struct btrfs_inode {
- u32 magic;
struct btrfs_root *root;
struct btrfs_key location;
struct inode vfs_inode;
- u32 magic2;
};
static inline struct btrfs_inode *BTRFS_I(struct inode *inode)
{
diff --git a/fs/btrfs/ctree.h b/fs/btrfs/ctree.h
index 2cbcaae..5103709 100644
--- a/fs/btrfs/ctree.h
+++ b/fs/btrfs/ctree.h
@@ -14,9 +14,8 @@ extern struct kmem_cache *btrfs_path_cachep;
#define BTRFS_ROOT_TREE_OBJECTID 1ULL
#define BTRFS_EXTENT_TREE_OBJECTID 2ULL
-#define BTRFS_INODE_MAP_OBJECTID 3ULL
-#define BTRFS_FS_TREE_OBJECTID 4ULL
-#define BTRFS_FIRST_FREE_OBJECTID 5ULL
+#define BTRFS_FS_TREE_OBJECTID 3ULL
+#define BTRFS_FIRST_FREE_OBJECTID 4ULL
/*
* we can actually store much bigger names, but lets not confuse the rest
@@ -62,7 +61,6 @@ struct btrfs_header {
__le64 blocknr; /* which block this node is supposed to live in */
__le64 generation;
__le64 parentid; /* objectid of the tree root */
- __le32 ham;
__le16 nritems;
__le16 flags;
u8 level;
@@ -226,23 +224,16 @@ struct btrfs_csum_item {
u8 csum[BTRFS_CSUM_SIZE];
} __attribute__ ((__packed__));
-struct btrfs_inode_map_item {
- u32 refs;
-} __attribute__ ((__packed__));
-
struct crypto_hash;
struct btrfs_fs_info {
struct btrfs_root *extent_root;
struct btrfs_root *tree_root;
- struct btrfs_root *inode_root;
struct btrfs_key current_insert;
struct btrfs_key last_insert;
struct radix_tree_root fs_roots_radix;
struct radix_tree_root pending_del_radix;
struct radix_tree_root pinned_radix;
- u64 last_inode_alloc;
u64 generation;
- u64 highest_inode;
struct btrfs_transaction *running_transaction;
struct btrfs_super_block *disk_super;
struct buffer_head *sb_buffer;
@@ -272,6 +263,8 @@ struct btrfs_root {
u32 blocksize;
int ref_cows;
u32 type;
+ u64 highest_inode;
+ u64 last_inode_alloc;
};
/* the lower bits in the key flags defines the item type */
@@ -321,15 +314,10 @@ struct btrfs_root {
#define BTRFS_EXTENT_ITEM_KEY 8
/*
- * the inode map records which inode numbers are in use and where
- * they actually live on disk
- */
-#define BTRFS_INODE_MAP_ITEM_KEY 9
-/*
* string items are for debugging. They just store a short string of
* data in the FS
*/
-#define BTRFS_STRING_ITEM_KEY 10
+#define BTRFS_STRING_ITEM_KEY 9
static inline u64 btrfs_inode_generation(struct btrfs_inode_item *i)
{
@@ -883,17 +871,6 @@ static inline void btrfs_set_file_extent_num_blocks(struct
e->num_blocks = cpu_to_le64(val);
}
-static inline u32 btrfs_inode_map_refs(struct btrfs_inode_map_item *m)
-{
- return le32_to_cpu(m->refs);
-}
-
-static inline void btrfs_set_inode_map_refs(struct btrfs_inode_map_item *m,
- u32 val)
-{
- m->refs = cpu_to_le32(val);
-}
-
static inline struct btrfs_root *btrfs_sb(struct super_block *sb)
{
return sb->s_fs_info;
@@ -996,12 +973,6 @@ int btrfs_match_dir_item_name(struct btrfs_root *root, struct btrfs_path *path,
int btrfs_find_free_objectid(struct btrfs_trans_handle *trans,
struct btrfs_root *fs_root,
u64 dirid, u64 *objectid);
-int btrfs_insert_inode_map(struct btrfs_trans_handle *trans,
- struct btrfs_root *root,
- u64 objectid, struct btrfs_key *location);
-int btrfs_lookup_inode_map(struct btrfs_trans_handle *trans,
- struct btrfs_root *root, struct btrfs_path *path,
- u64 objectid, int mod);
int btrfs_find_highest_inode(struct btrfs_root *fs_root, u64 *objectid);
/* inode-item.c */
diff --git a/fs/btrfs/disk-io.c b/fs/btrfs/disk-io.c
index 6b097ed..760fdc9 100644
--- a/fs/btrfs/disk-io.c
+++ b/fs/btrfs/disk-io.c
@@ -264,6 +264,8 @@ static int __setup_root(int blocksize,
root->fs_info = fs_info;
root->objectid = objectid;
root->last_trans = 0;
+ root->highest_inode = 0;
+ root->last_inode_alloc = 0;
memset(&root->root_key, 0, sizeof(root->root_key));
memset(&root->root_item, 0, sizeof(root->root_item));
return 0;
@@ -295,6 +297,7 @@ struct btrfs_root *btrfs_read_fs_root(struct btrfs_fs_info *fs_info,
struct btrfs_root *tree_root = fs_info->tree_root;
struct btrfs_path *path;
struct btrfs_leaf *l;
+ u64 highest_inode;
int ret = 0;
printk("read_fs_root looking for %Lu %Lu %u\n", location->objectid, location->offset, location->flags);
@@ -354,6 +357,12 @@ printk("radix_tree_insert gives us %d\n", ret);
kfree(root);
return ERR_PTR(ret);
}
+ ret = btrfs_find_highest_inode(root, &highest_inode);
+ if (ret == 0) {
+ root->highest_inode = highest_inode;
+ root->last_inode_alloc = highest_inode;
+printk("highest inode is %Lu\n", highest_inode);
+ }
printk("all worked\n");
return root;
}
@@ -364,8 +373,6 @@ struct btrfs_root *open_ctree(struct super_block *sb)
GFP_NOFS);
struct btrfs_root *tree_root = kmalloc(sizeof(struct btrfs_root),
GFP_NOFS);
- struct btrfs_root *inode_root = kmalloc(sizeof(struct btrfs_root),
- GFP_NOFS);
struct btrfs_fs_info *fs_info = kmalloc(sizeof(*fs_info),
GFP_NOFS);
int ret;
@@ -378,9 +385,6 @@ struct btrfs_root *open_ctree(struct super_block *sb)
fs_info->running_transaction = NULL;
fs_info->tree_root = tree_root;
fs_info->extent_root = extent_root;
- fs_info->inode_root = inode_root;
- fs_info->last_inode_alloc = 0;
- fs_info->highest_inode = 0;
fs_info->sb = sb;
fs_info->btree_inode = new_inode(sb);
fs_info->btree_inode->i_ino = 1;
@@ -425,14 +429,7 @@ struct btrfs_root *open_ctree(struct super_block *sb)
BTRFS_EXTENT_TREE_OBJECTID, extent_root);
BUG_ON(ret);
- ret = find_and_setup_root(sb->s_blocksize, tree_root, fs_info,
- BTRFS_INODE_MAP_OBJECTID, inode_root);
- BUG_ON(ret);
-
fs_info->generation = btrfs_super_generation(disk_super) + 1;
- ret = btrfs_find_highest_inode(tree_root, &fs_info->last_inode_alloc);
- if (ret == 0)
- fs_info->highest_inode = fs_info->last_inode_alloc;
memset(&fs_info->kobj, 0, sizeof(fs_info->kobj));
kobj_set_kset_s(fs_info, btrfs_subsys);
kobject_set_name(&fs_info->kobj, "%s", sb->s_id);
@@ -512,9 +509,6 @@ int close_ctree(struct btrfs_root *root)
if (fs_info->extent_root->node)
btrfs_block_release(fs_info->extent_root,
fs_info->extent_root->node);
- if (fs_info->inode_root->node)
- btrfs_block_release(fs_info->inode_root,
- fs_info->inode_root->node);
if (fs_info->tree_root->node)
btrfs_block_release(fs_info->tree_root,
fs_info->tree_root->node);
@@ -524,7 +518,6 @@ int close_ctree(struct btrfs_root *root)
iput(fs_info->btree_inode);
del_fs_roots(fs_info);
kfree(fs_info->extent_root);
- kfree(fs_info->inode_root);
kfree(fs_info->tree_root);
kobject_unregister(&fs_info->kobj);
return 0;
diff --git a/fs/btrfs/inode-item.c b/fs/btrfs/inode-item.c
index b276a3b..c3b990b 100644
--- a/fs/btrfs/inode-item.c
+++ b/fs/btrfs/inode-item.c
@@ -22,6 +22,8 @@ int btrfs_insert_inode(struct btrfs_trans_handle *trans, struct btrfs_root
sizeof(*inode_item));
btrfs_release_path(root, path);
btrfs_free_path(path);
+ if (ret == 0 && objectid > root->highest_inode)
+ root->highest_inode = objectid;
return ret;
}
diff --git a/fs/btrfs/inode-map.c b/fs/btrfs/inode-map.c
index f665221..318e27a 100644
--- a/fs/btrfs/inode-map.c
+++ b/fs/btrfs/inode-map.c
@@ -3,12 +3,11 @@
#include "disk-io.h"
#include "transaction.h"
-int btrfs_find_highest_inode(struct btrfs_root *fs_root, u64 *objectid)
+int btrfs_find_highest_inode(struct btrfs_root *root, u64 *objectid)
{
struct btrfs_path *path;
int ret;
struct btrfs_leaf *l;
- struct btrfs_root *root = fs_root->fs_info->inode_root;
struct btrfs_key search_key;
int slot;
@@ -38,7 +37,7 @@ error:
* walks the btree of allocated inodes and find a hole.
*/
int btrfs_find_free_objectid(struct btrfs_trans_handle *trans,
- struct btrfs_root *fs_root,
+ struct btrfs_root *root,
u64 dirid, u64 *objectid)
{
struct btrfs_path *path;
@@ -49,16 +48,13 @@ int btrfs_find_free_objectid(struct btrfs_trans_handle *trans,
u64 last_ino = 0;
int start_found;
struct btrfs_leaf *l;
- struct btrfs_root *root = fs_root->fs_info->inode_root;
struct btrfs_key search_key;
u64 search_start = dirid;
path = btrfs_alloc_path();
BUG_ON(!path);
search_key.flags = 0;
- btrfs_set_key_type(&search_key, BTRFS_INODE_MAP_ITEM_KEY);
-
- search_start = fs_root->fs_info->last_inode_alloc;
+ search_start = root->last_inode_alloc;
search_start = max(search_start, BTRFS_FIRST_FREE_OBJECTID);
search_key.objectid = search_start;
search_key.offset = 0;
@@ -108,7 +104,7 @@ int btrfs_find_free_objectid(struct btrfs_trans_handle *trans,
}
// FIXME -ENOSPC
found:
- root->fs_info->last_inode_alloc = *objectid;
+ root->last_inode_alloc = *objectid;
btrfs_release_path(root, path);
btrfs_free_path(path);
BUG_ON(*objectid < search_start);
@@ -118,56 +114,3 @@ error:
btrfs_free_path(path);
return ret;
}
-
-int btrfs_insert_inode_map(struct btrfs_trans_handle *trans,
- struct btrfs_root *fs_root,
- u64 objectid, struct btrfs_key *location)
-{
- int ret = 0;
- struct btrfs_path *path;
- struct btrfs_inode_map_item *inode_item;
- struct btrfs_key key;
- struct btrfs_root *inode_root = fs_root->fs_info->inode_root;
-
- key.objectid = objectid;
- key.flags = 0;
- btrfs_set_key_type(&key, BTRFS_INODE_MAP_ITEM_KEY);
- key.offset = 0;
- path = btrfs_alloc_path();
- BUG_ON(!path);
- btrfs_init_path(path);
- ret = btrfs_insert_empty_item(trans, inode_root, path, &key,
- sizeof(struct btrfs_inode_map_item));
- if (ret)
- goto out;
-
- inode_item = btrfs_item_ptr(btrfs_buffer_leaf(path->nodes[0]),
- path->slots[0], struct btrfs_inode_map_item);
- btrfs_cpu_key_to_disk(&inode_item->key, location);
- btrfs_mark_buffer_dirty(path->nodes[0]);
- if (objectid > fs_root->fs_info->highest_inode)
- fs_root->fs_info->highest_inode = objectid;
-out:
- btrfs_release_path(inode_root, path);
- btrfs_free_path(path);
- return ret;
-}
-
-int btrfs_lookup_inode_map(struct btrfs_trans_handle *trans,
- struct btrfs_root *fs_root, struct btrfs_path *path,
- u64 objectid, int mod)
-{
- int ret;
- struct btrfs_key key;
- int ins_len = mod < 0 ? -1 : 0;
- int cow = mod != 0;
- struct btrfs_root *inode_root = fs_root->fs_info->inode_root;
-
- key.objectid = objectid;
- key.flags = 0;
- key.offset = 0;
- btrfs_set_key_type(&key, BTRFS_INODE_MAP_ITEM_KEY);
- ret = btrfs_search_slot(trans, inode_root, &key, path, ins_len, cow);
- return ret;
-}
-
diff --git a/fs/btrfs/print-tree.c b/fs/btrfs/print-tree.c
index f0da65c..854d47d 100644
--- a/fs/btrfs/print-tree.c
+++ b/fs/btrfs/print-tree.c
@@ -10,7 +10,6 @@ void btrfs_print_leaf(struct btrfs_root *root, struct btrfs_leaf *l)
struct btrfs_extent_item *ei;
struct btrfs_root_item *ri;
struct btrfs_dir_item *di;
- struct btrfs_inode_map_item *mi;
struct btrfs_inode_item *ii;
u32 type;
@@ -54,13 +53,6 @@ void btrfs_print_leaf(struct btrfs_root *root, struct btrfs_leaf *l)
printk("\t\textent data refs %u owner %Lu\n",
btrfs_extent_refs(ei), btrfs_extent_owner(ei));
break;
- case BTRFS_INODE_MAP_ITEM_KEY:
- mi = btrfs_item_ptr(l, i, struct btrfs_inode_map_item);
- printk("\t\tinode map key %Lu %u %Lu\n",
- btrfs_disk_key_objectid(&mi->key),
- btrfs_disk_key_flags(&mi->key),
- btrfs_disk_key_offset(&mi->key));
- break;
case BTRFS_STRING_ITEM_KEY:
printk("\t\titem data %.*s\n", btrfs_item_size(item),
btrfs_leaf_data(l) + btrfs_item_offset(item));
diff --git a/fs/btrfs/super.c b/fs/btrfs/super.c
index bbe5cab..3e8bfb0 100644
--- a/fs/btrfs/super.c
+++ b/fs/btrfs/super.c
@@ -45,14 +45,6 @@ static struct inode_operations btrfs_file_inode_operations;
static struct address_space_operations btrfs_aops;
static struct file_operations btrfs_file_operations;
-static int check_inode(struct inode *inode)
-{
- struct btrfs_inode *ei = BTRFS_I(inode);
- WARN_ON(ei->magic != 0xDEADBEEF);
- WARN_ON(ei->magic2 != 0xDEADBEAF);
- return 0;
-}
-
static void btrfs_read_locked_inode(struct inode *inode)
{
struct btrfs_path *path;
@@ -66,15 +58,12 @@ static void btrfs_read_locked_inode(struct inode *inode)
btrfs_init_path(path);
mutex_lock(&root->fs_info->fs_mutex);
- check_inode(inode);
-
memcpy(&location, &BTRFS_I(inode)->location, sizeof(location));
ret = btrfs_lookup_inode(NULL, root, path, &location, 0);
if (ret) {
btrfs_free_path(path);
goto make_bad;
}
- check_inode(inode);
inode_item = btrfs_item_ptr(btrfs_buffer_leaf(path->nodes[0]),
path->slots[0],
struct btrfs_inode_item);
@@ -97,7 +86,7 @@ static void btrfs_read_locked_inode(struct inode *inode)
inode_item = NULL;
mutex_unlock(&root->fs_info->fs_mutex);
- check_inode(inode);
+
switch (inode->i_mode & S_IFMT) {
#if 0
default:
@@ -121,7 +110,6 @@ static void btrfs_read_locked_inode(struct inode *inode)
// inode->i_op = &page_symlink_inode_operations;
break;
}
- check_inode(inode);
return;
make_bad:
@@ -272,10 +260,7 @@ static int btrfs_free_inode(struct btrfs_trans_handle *trans,
struct btrfs_root *root,
struct inode *inode)
{
- u64 objectid = inode->i_ino;
struct btrfs_path *path;
- struct btrfs_inode_map_item *map;
- struct btrfs_key stat_data_key;
int ret;
clear_inode(inode);
@@ -283,26 +268,11 @@ static int btrfs_free_inode(struct btrfs_trans_handle *trans,
path = btrfs_alloc_path();
BUG_ON(!path);
btrfs_init_path(path);
- ret = btrfs_lookup_inode_map(trans, root, path, objectid, -1);
- if (ret) {
- if (ret > 0)
- ret = -ENOENT;
- goto error;
- }
- map = btrfs_item_ptr(btrfs_buffer_leaf(path->nodes[0]), path->slots[0],
- struct btrfs_inode_map_item);
- btrfs_disk_key_to_cpu(&stat_data_key, &map->key);
- ret = btrfs_del_item(trans, root->fs_info->inode_root, path);
- BUG_ON(ret);
- btrfs_release_path(root, path);
-
ret = btrfs_lookup_inode(trans, root, path,
&BTRFS_I(inode)->location, -1);
BUG_ON(ret);
ret = btrfs_del_item(trans, root, path);
BUG_ON(ret);
-error:
- btrfs_release_path(root, path);
btrfs_free_path(path);
return ret;
}
@@ -432,7 +402,6 @@ static int btrfs_inode_by_name(struct inode *dir, struct dentry *dentry,
out:
btrfs_release_path(root, path);
btrfs_free_path(path);
- check_inode(dir);
return ret;
}
@@ -540,9 +509,7 @@ printk("adding new root for inode %lu root %p (found %p)\n", inode->i_ino, sub_r
btrfs_read_locked_inode(inode);
unlock_new_inode(inode);
}
- check_inode(inode);
}
- check_inode(dir);
return d_splice_alias(inode, dentry);
}
@@ -566,7 +533,6 @@ static int btrfs_readdir(struct file *filp, void *dirent, filldir_t filldir)
/* FIXME, use a real flag for deciding about the key type */
if (root->fs_info->tree_root == root)
key_type = BTRFS_DIR_ITEM_KEY;
-
mutex_lock(&root->fs_info->fs_mutex);
key.objectid = inode->i_ino;
key.flags = 0;
@@ -575,9 +541,8 @@ static int btrfs_readdir(struct file *filp, void *dirent, filldir_t filldir)
path = btrfs_alloc_path();
btrfs_init_path(path);
ret = btrfs_search_slot(NULL, root, &key, path, 0, 0);
- if (ret < 0) {
+ if (ret < 0)
goto err;
- }
advance = 0;
while(1) {
leaf = btrfs_buffer_leaf(path->nodes[0]);
@@ -601,8 +566,7 @@ static int btrfs_readdir(struct file *filp, void *dirent, filldir_t filldir)
if (btrfs_disk_key_objectid(&item->key) != key.objectid)
break;
if (key_type == BTRFS_DIR_INDEX_KEY &&
- btrfs_disk_key_offset(&item->key) >
- root->fs_info->highest_inode)
+ btrfs_disk_key_offset(&item->key) > root->highest_inode)
break;
if (btrfs_disk_key_type(&item->key) != key_type)
continue;
@@ -707,7 +671,6 @@ static void fill_inode_item(struct btrfs_inode_item *item,
btrfs_set_timespec_nsec(&item->ctime, inode->i_ctime.tv_nsec);
btrfs_set_inode_nblocks(item, inode->i_blocks);
btrfs_set_inode_generation(item, inode->i_generation);
- check_inode(inode);
}
static int btrfs_update_inode(struct btrfs_trans_handle *trans,
@@ -721,7 +684,6 @@ static int btrfs_update_inode(struct btrfs_trans_handle *trans,
path = btrfs_alloc_path();
BUG_ON(!path);
btrfs_init_path(path);
-
ret = btrfs_lookup_inode(trans, root, path,
&BTRFS_I(inode)->location, 1);
if (ret) {
@@ -736,11 +698,11 @@ static int btrfs_update_inode(struct btrfs_trans_handle *trans,
fill_inode_item(inode_item, inode);
btrfs_mark_buffer_dirty(path->nodes[0]);
+ ret = 0;
failed:
btrfs_release_path(root, path);
btrfs_free_path(path);
- check_inode(inode);
- return 0;
+ return ret;
}
static int btrfs_write_inode(struct inode *inode, int wait)
@@ -757,7 +719,6 @@ static int btrfs_write_inode(struct inode *inode, int wait)
else
btrfs_end_transaction(trans, root);
mutex_unlock(&root->fs_info->fs_mutex);
- check_inode(inode);
return ret;
}
@@ -767,7 +728,7 @@ static struct inode *btrfs_new_inode(struct btrfs_trans_handle *trans,
struct inode *inode;
struct btrfs_inode_item inode_item;
struct btrfs_root *root = BTRFS_I(dir)->root;
- struct btrfs_key *key;
+ struct btrfs_key *location;
int ret;
u64 objectid;
@@ -776,8 +737,6 @@ static struct inode *btrfs_new_inode(struct btrfs_trans_handle *trans,
return ERR_PTR(-ENOMEM);
BTRFS_I(inode)->root = BTRFS_I(dir)->root;
- key = &BTRFS_I(inode)->location;
- check_inode(inode);
ret = btrfs_find_free_objectid(trans, root, dir->i_ino, &objectid);
BUG_ON(ret);
@@ -788,20 +747,16 @@ static struct inode *btrfs_new_inode(struct btrfs_trans_handle *trans,
inode->i_blocks = 0;
inode->i_mtime = inode->i_atime = inode->i_ctime = CURRENT_TIME;
fill_inode_item(&inode_item, inode);
-
- key->objectid = objectid;
- key->flags = 0;
- key->offset = 0;
- btrfs_set_key_type(key, BTRFS_INODE_ITEM_KEY);
- ret = btrfs_insert_inode_map(trans, root, objectid, key);
- BUG_ON(ret);
+ location = &BTRFS_I(inode)->location;
+ location->objectid = objectid;
+ location->flags = 0;
+ location->offset = 0;
+ btrfs_set_key_type(location, BTRFS_INODE_ITEM_KEY);
ret = btrfs_insert_inode(trans, root, objectid, &inode_item);
BUG_ON(ret);
insert_inode_hash(inode);
- check_inode(inode);
- check_inode(dir);
return inode;
}
@@ -825,8 +780,6 @@ static int btrfs_add_link(struct btrfs_trans_handle *trans,
ret = btrfs_update_inode(trans, root,
dentry->d_parent->d_inode);
}
- check_inode(inode);
- check_inode(dentry->d_parent->d_inode);
return ret;
}
@@ -840,7 +793,6 @@ static int btrfs_add_nondir(struct btrfs_trans_handle *trans,
}
if (err > 0)
err = -EEXIST;
- check_inode(inode);
return err;
}
@@ -872,8 +824,6 @@ static int btrfs_create(struct inode *dir, struct dentry *dentry,
out_unlock:
btrfs_end_transaction(trans, root);
mutex_unlock(&root->fs_info->fs_mutex);
- check_inode(inode);
- check_inode(dir);
if (drop_inode) {
inode_dec_link_count(inode);
@@ -1701,7 +1651,8 @@ static int create_snapshot(struct btrfs_root *root, char *name, int namelen)
ret = btrfs_update_inode(trans, root, root->inode);
BUG_ON(ret);
- ret = btrfs_find_free_objectid(trans, root, 0, &objectid);
+ ret = btrfs_find_free_objectid(trans, root->fs_info->tree_root,
+ 0, &objectid);
BUG_ON(ret);
memset(&new_root_item, 0, sizeof(new_root_item));
@@ -1709,13 +1660,6 @@ static int create_snapshot(struct btrfs_root *root, char *name, int namelen)
sizeof(new_root_item));
key.objectid = objectid;
- key.flags = 0;
- key.offset = 0;
- btrfs_set_key_type(&key, BTRFS_INODE_ITEM_KEY);
- ret = btrfs_insert_inode_map(trans, root, objectid, &key);
- BUG_ON(ret);
-
- key.objectid = objectid;
key.offset = 1;
key.flags = 0;
btrfs_set_key_type(&key, BTRFS_ROOT_ITEM_KEY);
@@ -1791,21 +1735,14 @@ static struct inode *btrfs_alloc_inode(struct super_block *sb)
ei = kmem_cache_alloc(btrfs_inode_cachep, GFP_NOFS);
if (!ei)
return NULL;
- ei->magic = 0xDEADBEEF;
- ei->magic2 = 0xDEADBEAF;
return &ei->vfs_inode;
}
static void btrfs_destroy_inode(struct inode *inode)
{
- struct btrfs_inode *ei = BTRFS_I(inode);
- WARN_ON(ei->magic != 0xDEADBEEF);
- WARN_ON(ei->magic2 != 0xDEADBEAF);
WARN_ON(!list_empty(&inode->i_dentry));
WARN_ON(inode->i_data.nrpages);
- ei->magic = 0;
- ei->magic2 = 0;
kmem_cache_free(btrfs_inode_cachep, BTRFS_I(inode));
}
diff --git a/fs/btrfs/transaction.c b/fs/btrfs/transaction.c
index 83a0194..54978d1 100644
--- a/fs/btrfs/transaction.c
+++ b/fs/btrfs/transaction.c
@@ -115,14 +115,7 @@ int btrfs_commit_tree_roots(struct btrfs_trans_handle *trans,
struct btrfs_fs_info *fs_info = root->fs_info;
struct btrfs_root *tree_root = fs_info->tree_root;
struct btrfs_root *extent_root = fs_info->extent_root;
- struct btrfs_root *inode_root = fs_info->inode_root;
- btrfs_set_root_blocknr(&inode_root->root_item,
- inode_root->node->b_blocknr);
- ret = btrfs_update_root(trans, tree_root,
- &inode_root->root_key,
- &inode_root->root_item);
- BUG_ON(ret);
while(1) {
old_extent_block = btrfs_root_blocknr(&extent_root->root_item);
if (old_extent_block == extent_root->node->b_blocknr)
OpenPOWER on IntegriCloud