Blame SOURCES/0483-btrfs-Move-logging-code-in-grub_btrfs_read_logical.patch

d18179
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
d18179
From: Goffredo Baroncelli <kreijack@inwind.it>
d18179
Date: Mon, 22 Oct 2018 19:29:35 +0200
d18179
Subject: [PATCH] btrfs: Move logging code in grub_btrfs_read_logical()
d18179
d18179
A portion of the logging code is moved outside of internal for(;;). The part
d18179
that is left inside is the one which depends on the internal for(;;) index.
d18179
d18179
This is a preparatory patch. The next one will refactor the code inside
d18179
the for(;;) into an another function.
d18179
d18179
Signed-off-by: Goffredo Baroncelli <kreijack@inwind.it>
d18179
Reviewed-by: Daniel Kiper <daniel.kiper@oracle.com>
d18179
(cherry picked from commit c6f79aca8030689ab2087686654ac431db411fa3)
d18179
---
d18179
 grub-core/fs/btrfs.c | 27 +++++++++++++++------------
d18179
 1 file changed, 15 insertions(+), 12 deletions(-)
d18179
d18179
diff --git a/grub-core/fs/btrfs.c b/grub-core/fs/btrfs.c
d18179
index 2d92d9c1b2..671dbd8918 100644
d18179
--- a/grub-core/fs/btrfs.c
d18179
+++ b/grub-core/fs/btrfs.c
d18179
@@ -881,6 +881,18 @@ grub_btrfs_read_logical (struct grub_btrfs_data *data, grub_disk_addr_t addr,
d18179
 
d18179
 	for (j = 0; j < 2; j++)
d18179
 	  {
d18179
+	    grub_dprintf ("btrfs", "chunk 0x%" PRIxGRUB_UINT64_T
d18179
+			  "+0x%" PRIxGRUB_UINT64_T
d18179
+			  " (%d stripes (%d substripes) of %"
d18179
+			  PRIxGRUB_UINT64_T ")\n",
d18179
+			  grub_le_to_cpu64 (key->offset),
d18179
+			  grub_le_to_cpu64 (chunk->size),
d18179
+			  grub_le_to_cpu16 (chunk->nstripes),
d18179
+			  grub_le_to_cpu16 (chunk->nsubstripes),
d18179
+			  grub_le_to_cpu64 (chunk->stripe_length));
d18179
+	    grub_dprintf ("btrfs", "reading laddr 0x%" PRIxGRUB_UINT64_T "\n",
d18179
+			  addr);
d18179
+
d18179
 	    for (i = 0; i < redundancy; i++)
d18179
 	      {
d18179
 		struct grub_btrfs_chunk_stripe *stripe;
d18179
@@ -893,20 +905,11 @@ grub_btrfs_read_logical (struct grub_btrfs_data *data, grub_disk_addr_t addr,
d18179
 
d18179
 		paddr = grub_le_to_cpu64 (stripe->offset) + stripe_offset;
d18179
 
d18179
-		grub_dprintf ("btrfs", "chunk 0x%" PRIxGRUB_UINT64_T
d18179
-			      "+0x%" PRIxGRUB_UINT64_T
d18179
-			      " (%d stripes (%d substripes) of %"
d18179
-			      PRIxGRUB_UINT64_T ") stripe %" PRIxGRUB_UINT64_T
d18179
+		grub_dprintf ("btrfs", "stripe %" PRIxGRUB_UINT64_T
d18179
 			      " maps to 0x%" PRIxGRUB_UINT64_T "\n",
d18179
-			      grub_le_to_cpu64 (key->offset),
d18179
-			      grub_le_to_cpu64 (chunk->size),
d18179
-			      grub_le_to_cpu16 (chunk->nstripes),
d18179
-			      grub_le_to_cpu16 (chunk->nsubstripes),
d18179
-			      grub_le_to_cpu64 (chunk->stripe_length),
d18179
 			      stripen, stripe->offset);
d18179
-		grub_dprintf ("btrfs", "reading paddr 0x%" PRIxGRUB_UINT64_T
d18179
-			      " for laddr 0x%" PRIxGRUB_UINT64_T "\n", paddr,
d18179
-			      addr);
d18179
+		grub_dprintf ("btrfs", "reading paddr 0x%" PRIxGRUB_UINT64_T "\n",
d18179
+			      paddr);
d18179
 
d18179
 		dev = find_device (data, stripe->device_id, j);
d18179
 		if (!dev)