[Devel] [PATCH RH9] ploop: Print more error information on resize

Kirill Tkhai ktkhai at virtuozzo.com
Wed Jan 26 15:08:05 MSK 2022


Add more debug messages.

https://jira.sw.ru/browse/PSBM-137646
Signed-off-by: Kirill Tkhai <ktkhai at virtuozzo.com>
---
 drivers/md/dm-ploop-cmd.c |   17 ++++++++++++++---
 drivers/md/dm-ploop-map.c |   13 +++++++++----
 2 files changed, 23 insertions(+), 7 deletions(-)

diff --git a/drivers/md/dm-ploop-cmd.c b/drivers/md/dm-ploop-cmd.c
index 92878d5477b1..429a03cce392 100644
--- a/drivers/md/dm-ploop-cmd.c
+++ b/drivers/md/dm-ploop-cmd.c
@@ -304,17 +304,22 @@ static int ploop_grow_relocate_cluster(struct ploop *ploop,
 
 	/* Read full clu sync */
 	ret = ploop_read_cluster_sync(ploop, pio, dst_clu);
-	if (ret < 0)
+	if (ret < 0) {
+		pr_err("ploop: reloc: failed read: %d\n", ret);
 		goto out;
+	}
 
 	ret = ploop_prepare_reloc_index_wb(ploop, &md, clu, &new_dst);
-	if (ret < 0)
+	if (ret < 0) {
+		pr_err("ploop: reloc: can't prepare it: %d\n", ret);
 		goto out;
+	}
 	piwb = md->piwb;
 
 	/* Write clu to new destination */
 	ret = ploop_write_cluster_sync(ploop, pio, new_dst);
 	if (ret) {
+		pr_err("ploop: reloc: failed write: %d\n", ret);
 		ploop_break_bat_update(ploop, md);
 		goto out;
 	}
@@ -328,8 +333,10 @@ static int ploop_grow_relocate_cluster(struct ploop *ploop,
 	wait_for_completion(&comp);
 
 	ret = blk_status_to_errno(bi_status);
-	if (ret)
+	if (ret) {
+		pr_err("ploop: reloc: failed md page write: %d\n", ret);
 		goto out;
+	}
 
 	/* Update local BAT copy */
 	write_lock_irq(&ploop->bat_rwlock);
@@ -345,6 +352,8 @@ static int ploop_grow_relocate_cluster(struct ploop *ploop,
 
 	/* Zero new BAT entries on disk. */
 	ret = ploop_write_zero_cluster_sync(ploop, pio, dst_clu);
+	if (ret)
+		pr_err("ploop: reloc: failed zero: %d\n", ret);
 out:
 	return ret;
 }
@@ -395,6 +404,8 @@ static int ploop_grow_update_header(struct ploop *ploop,
 		hdr->m_SizeInSectors_v2 = sectors;
 		hdr->m_FirstBlockOffset = offset;
 		kunmap_atomic(hdr);
+	} else {
+		pr_err("ploop: Failed to update hdr: %d\n", ret);
 	}
 
 	return ret;
diff --git a/drivers/md/dm-ploop-map.c b/drivers/md/dm-ploop-map.c
index 251ac03198fd..e3ef1b49aad8 100644
--- a/drivers/md/dm-ploop-map.c
+++ b/drivers/md/dm-ploop-map.c
@@ -1052,8 +1052,10 @@ static int allocate_cluster(struct ploop *ploop, u32 *dst_clu)
 		 * in background.
 		 */
 		ret = vfs_fsync(file, 0);
-		if (ret)
+		if (ret) {
+			pr_err("ploop: fsync: %d\n", ret);
 			return ret;
+		}
 	}
 
 	if (end > top->file_preallocated_area_start)
@@ -1884,11 +1886,14 @@ int ploop_prepare_reloc_index_wb(struct ploop *ploop,
 	if (dst_clu)
 		type = PIWB_TYPE_RELOC;
 
-	if ((md->status & (MD_DIRTY|MD_WRITEBACK)) ||
-	    ploop_prepare_bat_update(ploop, md, type)) {
-		err = -EIO;
+	err = -EIO;
+	if ((md->status & (MD_DIRTY|MD_WRITEBACK))) {
+		pr_err("ploop: Unexpected md status: %x\n", md->status);
 		goto out_error;
 	}
+	err = ploop_prepare_bat_update(ploop, md, type);
+	if (err)
+		goto out_error;
 
 	piwb = md->piwb;
 




More information about the Devel mailing list