linux-btrfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: shhuiw@gmail.com
To: chris.mason@fusionio.com, jbacik@fusionio.com
Cc: linux-btrfs@vger.kernel.org
Subject: [PATCH] Btrfs: cleanup: assign path->nodes[0]to leaf after ret check in __btrfs_write_out_cache
Date: Fri, 30 Nov 2012 14:02:28 +0800	[thread overview]
Message-ID: <50b84c34.82c0320a.0e91.ffffe6bd@mx.google.com> (raw)
In-Reply-To: <1354255348-5011-1-git-send-email-y>

From: Wang Sheng-Hui <shhuiw@gmail.com>

If the ret check fails, the assignment is useless.
Move the assignment after the check.

Signed-off-by: Wang Sheng-Hui <shhuiw@gmail.com>
---
 fs/btrfs/free-space-cache.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/fs/btrfs/free-space-cache.c b/fs/btrfs/free-space-cache.c
index 058fc9b..d7b3286 100644
--- a/fs/btrfs/free-space-cache.c
+++ b/fs/btrfs/free-space-cache.c
@@ -1033,7 +1033,6 @@ int __btrfs_write_out_cache(struct btrfs_root *root, struct inode *inode,
 				 GFP_NOFS);
 		goto out;
 	}
-	leaf = path->nodes[0];
 	if (ret > 0) {
 		struct btrfs_key found_key;
 		BUG_ON(!path->slots[0]);
@@ -1049,6 +1048,7 @@ int __btrfs_write_out_cache(struct btrfs_root *root, struct inode *inode,
 			goto out;
 		}
 	}
+	leaf = path->nodes[0];
 
 	BTRFS_I(inode)->generation = trans->transid;
 	header = btrfs_item_ptr(leaf, path->slots[0],
-- 
1.6.0.2


      parent reply	other threads:[~2012-11-30  6:03 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <1354255348-5011-1-git-send-email-y>
2012-11-30  6:02 ` [PATCH] Btrfs: remove warning check in io_ctl_map_page shhuiw
2012-11-30  9:02   ` Liu Bo
2012-11-30 11:18     ` Wang Sheng-Hui
2012-11-30  6:02 ` [PATCH] Btrfs: check crc area early in io_ctl_init shhuiw
2012-11-30  6:02 ` shhuiw [this message]

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=50b84c34.82c0320a.0e91.ffffe6bd@mx.google.com \
    --to=shhuiw@gmail.com \
    --cc=chris.mason@fusionio.com \
    --cc=jbacik@fusionio.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).