[PATCH] btrfs: Remove redundant nowait check in lock_extent_direct

Alexey Velichayshiy posted 1 patch 1 month, 3 weeks ago
fs/btrfs/direct-io.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
[PATCH] btrfs: Remove redundant nowait check in lock_extent_direct
Posted by Alexey Velichayshiy 1 month, 3 weeks ago
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@ispras.ru>
---
 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
Re: [PATCH] btrfs: Remove redundant nowait check in lock_extent_direct
Posted by Filipe Manana 1 month, 3 weeks ago
On Sun, Feb 22, 2026 at 12:48 PM Alexey Velichayshiy
<a.velichayshiy@ispras.ru> 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@ispras.ru>

Reviewed-by: Filipe Manana <fdmanana@suse.com>

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