All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] erofs: print error code in erofs_err() of erofs_readdir
@ 2026-11-27  2:56 Zhiguo Niu
  2026-11-27  4:08 ` Gao Xiang
  0 siblings, 1 reply; 6+ messages in thread
From: Zhiguo Niu @ 2026-11-27  2:56 UTC (permalink / raw)
  To: xiang, chao
  Cc: niuzhiguo84, zhiguo.niu, ke.wang, zbestahu, jefflexu, dhavale,
	hongbohbli, guochunhai, linux-erofs

Under system stress tests, the following log frequently shows up:
erofs: (device dm-8): erofs_readdir: failed to readdir of logical
block 0 of nid 124

Without the err value, it is hard to tell whether the failure was
caused by an interrupted read (e.g. -EINTR) or a real I/O problem.
Print the error code so that we can get more clues to the problem.

Also fix the similar codes in other erofs_err() call sites where a
real error code is available but not printed:
- erofs_read_superblock: "cannot read erofs superblock"
- z_erofs_init_pcpu_workers: per-cpu workers allocation and CPU
  hotplug init
- z_erofs_readahead: "readahead error at folio ... @ nid ..."

Signed-off-by: Zhiguo Niu <zhiguo.niu@unisoc.com>
---
 fs/erofs/dir.c   | 4 ++--
 fs/erofs/super.c | 2 +-
 fs/erofs/zdata.c | 8 ++++----
 3 files changed, 7 insertions(+), 7 deletions(-)

diff --git a/fs/erofs/dir.c b/fs/erofs/dir.c
index 4aa52a5f204a..69aea8a7c3dc 100644
--- a/fs/erofs/dir.c
+++ b/fs/erofs/dir.c
@@ -83,9 +83,9 @@ static int erofs_readdir(struct file *f, struct dir_context *ctx)
 
 		de = erofs_bread(&buf, dbstart, true);
 		if (IS_ERR(de)) {
-			erofs_err(sb, "failed to readdir of logical block %llu of nid %llu",
-				  erofs_blknr(sb, dbstart), EROFS_I(dir)->nid);
 			err = PTR_ERR(de);
+			erofs_err(sb, "failed to readdir of logical block %llu of nid %llu: %d",
+				  erofs_blknr(sb, dbstart), EROFS_I(dir)->nid, err);
 			break;
 		}
 
diff --git a/fs/erofs/super.c b/fs/erofs/super.c
index e92a7fa90ae3..39f195e6d10b 100644
--- a/fs/erofs/super.c
+++ b/fs/erofs/super.c
@@ -273,7 +273,7 @@ static int erofs_read_superblock(struct super_block *sb)
 
 	data = erofs_read_metabuf(&buf, sb, 0, false);
 	if (IS_ERR(data)) {
-		erofs_err(sb, "cannot read erofs superblock");
+		erofs_err(sb, "cannot read erofs superblock: %ld", PTR_ERR(data));
 		return PTR_ERR(data);
 	}
 
diff --git a/fs/erofs/zdata.c b/fs/erofs/zdata.c
index e981e371d6c2..02a5342cec9d 100644
--- a/fs/erofs/zdata.c
+++ b/fs/erofs/zdata.c
@@ -416,13 +416,13 @@ static int z_erofs_init_pcpu_workers(struct super_block *sb)
 
 	err = erofs_init_percpu_workers();
 	if (err) {
-		erofs_err(sb, "per-cpu workers: failed to allocate.");
+		erofs_err(sb, "per-cpu workers: failed to allocate: %d", err);
 		goto err_init_percpu_workers;
 	}
 
 	err = erofs_cpu_hotplug_init();
 	if (err < 0) {
-		erofs_err(sb, "per-cpu workers: failed CPU hotplug init.");
+		erofs_err(sb, "per-cpu workers: failed CPU hotplug init: %d", err);
 		goto err_cpuhp_init;
 	}
 	erofs_info(sb, "initialized per-cpu workers successfully.");
@@ -1896,8 +1896,8 @@ static void z_erofs_readahead(struct readahead_control *rac)
 	while ((folio = readahead_folio_last(rac))) {
 		err = z_erofs_scan_folio(&f, folio, true);
 		if (err && err != -EINTR)
-			erofs_err(realinode->i_sb, "readahead error at folio %lu @ nid %llu",
-				  folio->index, EROFS_I(realinode)->nid);
+			erofs_err(realinode->i_sb, "readahead error at folio %lu @ nid %llu: %d",
+				  folio->index, EROFS_I(realinode)->nid, err);
 	}
 	z_erofs_pcluster_readmore(&f, rac, false);
 	z_erofs_pcluster_end(&f);
-- 
2.43.0



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

end of thread, other threads:[~2026-12-01  1:20 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-11-27  2:56 [PATCH] erofs: print error code in erofs_err() of erofs_readdir Zhiguo Niu
2026-11-27  4:08 ` Gao Xiang
2026-11-27  7:49   ` Zhiguo Niu
2026-11-30  2:05   ` Zhiguo Niu
2026-11-30 20:12     ` Gao Xiang
2026-12-01  1:19       ` Zhiguo Niu

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.