linux-btrfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/4] btrfs-progs: cleanup duplicate assignment of variable leaf for btrfs-image
@ 2014-06-19  1:46 Gui Hecheng
  2014-06-19  1:46 ` [PATCH 2/4] btrfs-progs: deal with invalid option combinations " Gui Hecheng
                   ` (2 more replies)
  0 siblings, 3 replies; 15+ messages in thread
From: Gui Hecheng @ 2014-06-19  1:46 UTC (permalink / raw)
  To: linux-btrfs; +Cc: Gui Hecheng

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@cn.fujitsu.com>
---
 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


^ permalink raw reply related	[flat|nested] 15+ messages in thread

end of thread, other threads:[~2014-06-24  8:47 UTC | newest]

Thread overview: 15+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-06-19  1:46 [PATCH 1/4] btrfs-progs: cleanup duplicate assignment of variable leaf for btrfs-image Gui Hecheng
2014-06-19  1:46 ` [PATCH 2/4] btrfs-progs: deal with invalid option combinations " Gui Hecheng
2014-06-23 14:12   ` David Sterba
2014-06-24  1:43     ` Gui Hecheng
2014-06-24  2:36     ` [PATCH v2 " Gui Hecheng
2014-06-24  2:51       ` Gui Hecheng
2014-06-24  3:16     ` [PATCH v3 " Gui Hecheng
2014-06-19  1:46 ` [PATCH 3/4] btrfs-progs: delete invalid output file when btrfs-image failed Gui Hecheng
2014-06-23 14:15   ` David Sterba
2014-06-24  1:41     ` Gui Hecheng
2014-06-24  2:38     ` [PATCH v2 " Gui Hecheng
2014-06-24  3:05       ` Gui Hecheng
2014-06-24  3:16     ` [PATCH v3 " Gui Hecheng
2014-06-24  8:47       ` David Sterba
2014-06-19  1:46 ` [PATCH 4/4] btrfs-progs: update manpage for btrfs-image with -m option added Gui Hecheng

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).