Skip to contentSkip to conversation

Fix break before assignment

PATCH In review Daniel J Blueman 2 participants 3 messages May 3, 2012 Btrfs file system

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Fix break before assignment

Fix control flow to store count before breaking loop.

---
 fs/btrfs/ctree.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
fs/btrfs/ctree.c +1 -1
index e801f22..2227420 100644
@@ -3465,8 +3465,8 @@ int btrfs_insert_some_items(struct btrfs_trans_handle *trans,
 	for (i = 0; i < nr; i++) {
 		if (total_size + data_size[i] + sizeof(struct btrfs_item) >
 		    BTRFS_LEAF_DATA_SIZE(root)) {
-			break;
 			nr = i;
+			break;
 		}
 		total_data += data_size[i];
 		total_size += data_size[i] + sizeof(struct btrfs_item);
Signature · 1 line
1.7.9.5
#2 lore raw
Quoted 5 lines · David Sterba
Quoted 1 line · Daniel J Blueman

Fix control flow to store count before breaking loop.

http://www.mail-archive.com/[email protected]/msg10483.html
but it's a dead code anyway.

Noted.

Chris, is it a good time to take out btrfs_insert_some_items or, if keeping it, apply David's patch to avoid related surprises?

Thanks,
Daniel

Signature · 1 line
Daniel J Blueman