[u-boot PATCH] fs: btrfs: hide 'Cannot lookup file' errors on 'load'

Dominique Martinet asmadeus at codewreck.org
Wed Nov 6 02:29:17 CET 2024


From: Dominique Martinet <dominique.martinet at atmark-techno.com>

Running commands such as 'load mmc 2:1 $addr $path' when path does not
exists historically do not print any error on filesystems such as ext4
or fat.
Changing the root filesystem to btrfs would make existing boot script
print 'Cannot lookup file xxx' errors, confusing customers wondering if
there is a problem when the mmc load command was used in a if (for
example to load boot.scr conditionally)

Make that printf a debug message so it is not displayed by default, like
it is on other filesystems

Signed-off-by: Dominique Martinet <dominique.martinet at atmark-techno.com>
---
iirc this also used to trip up some test in test/fs but I don't recall
what.

It might make sense to print that error but I think we ought to be
coherent and either print it for all fs or none; but if we print it
we'll need to prepare a new command to test file existence before
loading it.

Thanks!

 fs/btrfs/btrfs.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/fs/btrfs/btrfs.c b/fs/btrfs/btrfs.c
index 350cff0cbca0..f3087f690fa4 100644
--- a/fs/btrfs/btrfs.c
+++ b/fs/btrfs/btrfs.c
@@ -193,7 +193,7 @@ int btrfs_size(const char *file, loff_t *size)
 	ret = btrfs_lookup_path(fs_info->fs_root, BTRFS_FIRST_FREE_OBJECTID,
 				file, &root, &ino, &type, 40);
 	if (ret < 0) {
-		printf("Cannot lookup file %s\n", file);
+		debug("Cannot lookup file %s\n", file);
 		return ret;
 	}
 	if (type != BTRFS_FT_REG_FILE) {
-- 
2.39.5



More information about the U-Boot mailing list