diff mbox series

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

Message ID 20241106012918.1395878-1-dominique.martinet@atmark-techno.com (mailing list archive)
State New
Headers show
Series [u-boot] fs: btrfs: hide 'Cannot lookup file' errors on 'load' | expand

Commit Message

'Dominique MARTINET' Nov. 6, 2024, 1:29 a.m. UTC
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@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(-)

Comments

Qu Wenruo Nov. 6, 2024, 4:23 a.m. UTC | #1
在 2024/11/6 11:59, Dominique Martinet 写道:
> 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@atmark-techno.com>

Reviewed-by: Qu Wenruo <wqu@suse.com>

Since other fses are already not output that error message, we have no
extra reason not to follow them.

Thanks for the fix,
Qu

> ---
> 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) {
diff mbox series

Patch

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) {