diff mbox

Btrfs: cleanup: assign path->nodes[0]to leaf after ret check in __btrfs_write_out_cache

Message ID 50b84c34.82c0320a.0e91.ffffe6bd@mx.google.com (mailing list archive)
State New, archived
Headers show

Commit Message

Wang Sheng-Hui Nov. 30, 2012, 6:02 a.m. UTC
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 mbox

Patch

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],