public inbox for linux-btrfs@vger.kernel.org
 help / color / mirror / Atom feed
* [u-boot PATCH] fs: btrfs: hide 'Cannot lookup file' errors on 'load'
@ 2024-11-06  1:29 Dominique Martinet
  2024-11-06  4:23 ` Qu Wenruo
  0 siblings, 1 reply; 4+ messages in thread
From: Dominique Martinet @ 2024-11-06  1:29 UTC (permalink / raw)
  To: Marek Behún, Qu Wenruo, Tom Rini
  Cc: Dominique Martinet, linux-btrfs, u-boot

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

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



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

* Re: [u-boot PATCH] fs: btrfs: hide 'Cannot lookup file' errors on 'load'
  2024-11-06  1:29 Dominique Martinet
@ 2024-11-06  4:23 ` Qu Wenruo
  0 siblings, 0 replies; 4+ messages in thread
From: Qu Wenruo @ 2024-11-06  4:23 UTC (permalink / raw)
  To: Dominique Martinet, Marek Behún, Qu Wenruo, Tom Rini
  Cc: linux-btrfs, u-boot



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


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

* Re: [u-boot PATCH] fs: btrfs: hide 'Cannot lookup file' errors on 'load'
@ 2024-11-13  5:58 Dominique Martinet
  2024-11-13 14:14 ` Tom Rini
  0 siblings, 1 reply; 4+ messages in thread
From: Dominique Martinet @ 2024-11-13  5:58 UTC (permalink / raw)
  To: Marek Behún, Qu Wenruo, Tom Rini
  Cc: Dominique Martinet, linux-btrfs, u-boot

Dominique Martinet wrote on Wed, Nov 06, 2024 at 09:56:42AM +0900:
> 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)

Ugh, sorry, I was a bit quick on checking with an updated u-boot on
this... our tree is *cough* slightly *cough* old and that was the case
at the time, but since somewhere in 2020 there is a warning in fs/fs.c
in case load fails.

That doesn't change the fact that this patch is useful to avoid the
message being printed twice, but I'll need to update my scripts anyway
to use `size` first instead (as a first approximation of `test -e`)

Please let me know if you want me to resend this with an updated commit
message; otherwise I'll let this sleep.

-- 
Dominique

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

* Re: [u-boot PATCH] fs: btrfs: hide 'Cannot lookup file' errors on 'load'
  2024-11-13  5:58 [u-boot PATCH] fs: btrfs: hide 'Cannot lookup file' errors on 'load' Dominique Martinet
@ 2024-11-13 14:14 ` Tom Rini
  0 siblings, 0 replies; 4+ messages in thread
From: Tom Rini @ 2024-11-13 14:14 UTC (permalink / raw)
  To: Dominique Martinet
  Cc: Marek Behún, Qu Wenruo, Dominique Martinet, linux-btrfs,
	u-boot

[-- Attachment #1: Type: text/plain, Size: 1258 bytes --]

On Wed, Nov 13, 2024 at 02:58:42PM +0900, Dominique Martinet wrote:
> Dominique Martinet wrote on Wed, Nov 06, 2024 at 09:56:42AM +0900:
> > 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)
> 
> Ugh, sorry, I was a bit quick on checking with an updated u-boot on
> this... our tree is *cough* slightly *cough* old and that was the case
> at the time, but since somewhere in 2020 there is a warning in fs/fs.c
> in case load fails.
> 
> That doesn't change the fact that this patch is useful to avoid the
> message being printed twice, but I'll need to update my scripts anyway
> to use `size` first instead (as a first approximation of `test -e`)
> 
> Please let me know if you want me to resend this with an updated commit
> message; otherwise I'll let this sleep.

Yes, please reword the commit message based on current overall behavior,
thanks!

-- 
Tom

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 659 bytes --]

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

end of thread, other threads:[~2024-11-13 14:14 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-11-13  5:58 [u-boot PATCH] fs: btrfs: hide 'Cannot lookup file' errors on 'load' Dominique Martinet
2024-11-13 14:14 ` Tom Rini
  -- strict thread matches above, loose matches on Subject: below --
2024-11-06  1:29 Dominique Martinet
2024-11-06  4:23 ` Qu Wenruo

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox