All of lore.kernel.org
 help / color / mirror / Atom feed
From: Shen Feng <shen@cn.fujitsu.com>
To: linux-btrfs@vger.kernel.org
Subject: [PATCH] Btrfs: check inode allocaton earlier in btrfs_fill_super
Date: Wed, 07 Jan 2009 14:56:48 +0800	[thread overview]
Message-ID: <49645230.9050403@cn.fujitsu.com> (raw)


Just after it's allocation.

Signed-off-by: Shen Feng <shen@cn.fujitsu.com>
---
 fs/btrfs/super.c |    9 +++++----
 1 files changed, 5 insertions(+), 4 deletions(-)

diff --git a/fs/btrfs/super.c b/fs/btrfs/super.c
index b4c101d..4c31c4f 100644
--- a/fs/btrfs/super.c
+++ b/fs/btrfs/super.c
@@ -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);
-- 
1.6.0.6



                 reply	other threads:[~2009-01-07  6:56 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=49645230.9050403@cn.fujitsu.com \
    --to=shen@cn.fujitsu.com \
    --cc=linux-btrfs@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.