[PATCH 1/4] btrfs-progs: cleanup duplicate assignment of variable leaf for btrfs-image

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



The value of variable leaf in while loop don't have to be set
for every round. Just move it outside.

Signed-off-by: Gui Hecheng <guihc.fnst@xxxxxxxxxxxxxx>
---
 btrfs-image.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/btrfs-image.c b/btrfs-image.c
index cf1fe2d..db5d193 100644
--- a/btrfs-image.c
+++ b/btrfs-image.c
@@ -1090,8 +1090,9 @@ static int copy_space_cache(struct btrfs_root *root,
 		return ret;
 	}
 
+	leaf = path->nodes[0];
+
 	while (1) {
-		leaf = path->nodes[0];
 		if (path->slots[0] >= btrfs_header_nritems(leaf)) {
 			ret = btrfs_next_leaf(root, path);
 			if (ret < 0) {
@@ -1157,8 +1158,9 @@ static int copy_from_extent_tree(struct metadump_struct *metadump,
 	}
 	ret = 0;
 
+	leaf = path->nodes[0];
+
 	while (1) {
-		leaf = path->nodes[0];
 		if (path->slots[0] >= btrfs_header_nritems(leaf)) {
 			ret = btrfs_next_leaf(extent_root, path);
 			if (ret < 0) {
-- 
1.8.1.4

--
To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Index of Archives]     [Linux Filesystem Development]     [Linux NFS]     [Linux NILFS]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux