[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAL3q7H7A_OnTQviZpCgzrGUFe1K=VfMiWXaba56E3ucPHnVkNg@mail.gmail.com>
Date: Wed, 23 Apr 2025 10:03:44 +0100
From: Filipe Manana <fdmanana@...nel.org>
To: Daniel Vacek <neelx@...e.com>
Cc: Chris Mason <clm@...com>, Josef Bacik <josef@...icpanda.com>, David Sterba <dsterba@...e.com>,
linux-btrfs@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH] btrfs: fiemap: make the assert more explicit after
handling the error cases
On Wed, Apr 23, 2025 at 9:10 AM Daniel Vacek <neelx@...e.com> wrote:
>
> Let's not assert the errors and clearly state the expected result only
> after eventual error handling. It makes a bit more sense this way.
It doesn't make more sense to me...
I prefer to assert expected results right after the function call.
Thanks.
>
> Signed-off-by: Daniel Vacek <neelx@...e.com>
> ---
> fs/btrfs/fiemap.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/fs/btrfs/fiemap.c b/fs/btrfs/fiemap.c
> index b80c07ad8c5e7..034f832e10c1a 100644
> --- a/fs/btrfs/fiemap.c
> +++ b/fs/btrfs/fiemap.c
> @@ -568,10 +568,10 @@ static int fiemap_find_last_extent_offset(struct btrfs_inode *inode,
> * there might be preallocation past i_size.
> */
> ret = btrfs_lookup_file_extent(NULL, root, path, ino, (u64)-1, 0);
> - /* There can't be a file extent item at offset (u64)-1 */
> - ASSERT(ret != 0);
> if (ret < 0)
> return ret;
> + /* There can't be a file extent item at offset (u64)-1 */
> + ASSERT(ret == 1);
>
> /*
> * For a non-existing key, btrfs_search_slot() always leaves us at a
> --
> 2.47.2
>
>
Powered by blists - more mailing lists