Re: [PATCH] btrfs: Remove redundant nowait check in lock_extent_direct

From: Filipe Manana

Date: Mon Feb 23 2026 - 07:56:39 EST


On Sun, Feb 22, 2026 at 12:48 PM Alexey Velichayshiy
<a.velichayshiy@xxxxxxxxx> wrote:
>
> The nowait flag is always false in this context, making the conditional
> check unnecessary. Simplify the code by directly assigning -ENOTBLK.
>
> Found by Linux Verification Center (linuxtesting.org) with SVACE.
>
> Signed-off-by: Alexey Velichayshiy <a.velichayshiy@xxxxxxxxx>

Reviewed-by: Filipe Manana <fdmanana@xxxxxxxx>

Pushed into the for-next branch [1] with minor changes to the subject
(uncapitalize first word and add () to function name).

[1] https://github.com/btrfs/linux/commits/for-next/

> ---
> fs/btrfs/direct-io.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/fs/btrfs/direct-io.c b/fs/btrfs/direct-io.c
> index 07e19e88ba4b..72a229c44833 100644
> --- a/fs/btrfs/direct-io.c
> +++ b/fs/btrfs/direct-io.c
> @@ -107,7 +107,7 @@ static int lock_extent_direct(struct inode *inode, u64 lockstart, u64 lockend,
> test_bit(BTRFS_ORDERED_DIRECT, &ordered->flags))
> btrfs_start_ordered_extent(ordered);
> else
> - ret = nowait ? -EAGAIN : -ENOTBLK;
> + ret = -ENOTBLK;
> btrfs_put_ordered_extent(ordered);
> } else {
> /*
> --
> 2.43.0
>
>