Skip to contentSkip to conversation

Btrfs: check inode allocaton earlier in btrfs_fill_super

PATCH New Shen Feng 1 participant 1 message Jan 7, 2009 Btrfs file system

lore
Share & tools
lore

Shen Feng

author
#0 lore raw

PATCH 1/1 Btrfs: check inode allocaton earlier in btrfs_fill_super

Just after it's allocation.

---
 fs/btrfs/super.c |    9 +++++----
 1 files changed, 5 insertions(+), 4 deletions(-)
fs/btrfs/super.c +5 -4
index b4c101d..4c31c4f 100644
@@ -322,6 +322,11 @@ static int btrfs_fill_super(struct super_block *sb,
 	disk_super = &tree_root->fs_info->super_copy;
 	inode = btrfs_iget_locked(sb, BTRFS_FIRST_FREE_OBJECTID,
 				  tree_root->fs_info->fs_root);
+	if (!inode) {
+		err = -ENOMEM;
+		goto fail_close;
+	}
+
 	bi = BTRFS_I(inode);
 	bi->location.objectid = inode->i_ino;
 	bi->location.offset = 0;
@@ -329,10 +334,6 @@ static int btrfs_fill_super(struct super_block *sb,
 
 	btrfs_set_key_type(&bi->location, BTRFS_INODE_ITEM_KEY);
 
-	if (!inode) {
-		err = -ENOMEM;
-		goto fail_close;
-	}
 	if (inode->i_state & I_NEW) {
 		btrfs_read_locked_inode(inode);
 		unlock_new_inode(inode);
Signature · 1 line
1.6.0.6