mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH next] btrfs: fix error code in add_delayed_ref_head()
@ 2024-10-31  7:23 Dan Carpenter
  2024-10-31 11:59 ` Filipe Manana
  0 siblings, 1 reply; 2+ messages in thread
From: Dan Carpenter @ 2024-10-31  7:23 UTC (permalink / raw)
  To: Filipe Manana
  Cc: Chris Mason, Josef Bacik, David Sterba, Boris Burkov, Qu Wenruo,
	linux-btrfs, linux-kernel, kernel-janitors

xa_err errors are equivalent to "error_code * 4 + 2".  We want to return
error pointers here so we can't just cast them back and forth.  Use
xa_err() to do the conversion.

Fixes: 6d50990e6be2 ("btrfs: track delayed ref heads in an xarray")
Signed-off-by: Dan Carpenter <dan.carpenter@linaro.org>
---
 fs/btrfs/delayed-ref.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/fs/btrfs/delayed-ref.c b/fs/btrfs/delayed-ref.c
index 1f97e1e5c66c..012fce255866 100644
--- a/fs/btrfs/delayed-ref.c
+++ b/fs/btrfs/delayed-ref.c
@@ -848,7 +848,7 @@ add_delayed_ref_head(struct btrfs_trans_handle *trans,
 		if (xa_is_err(existing)) {
 			/* Memory was preallocated by the caller. */
 			ASSERT(xa_err(existing) != -ENOMEM);
-			return ERR_CAST(existing);
+			return ERR_PTR(xa_err(existing));
 		} else if (WARN_ON(existing)) {
 			/*
 			 * Shouldn't happen we just did a lookup before under
-- 
2.45.2


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

* Re: [PATCH next] btrfs: fix error code in add_delayed_ref_head()
  2024-10-31  7:23 [PATCH next] btrfs: fix error code in add_delayed_ref_head() Dan Carpenter
@ 2024-10-31 11:59 ` Filipe Manana
  0 siblings, 0 replies; 2+ messages in thread
From: Filipe Manana @ 2024-10-31 11:59 UTC (permalink / raw)
  To: Dan Carpenter
  Cc: Filipe Manana, Chris Mason, Josef Bacik, David Sterba,
	Boris Burkov, Qu Wenruo, linux-btrfs, linux-kernel,
	kernel-janitors

On Thu, Oct 31, 2024 at 7:23 AM Dan Carpenter <dan.carpenter@linaro.org> wrote:
>
> xa_err errors are equivalent to "error_code * 4 + 2".  We want to return
> error pointers here so we can't just cast them back and forth.  Use
> xa_err() to do the conversion.
>
> Fixes: 6d50990e6be2 ("btrfs: track delayed ref heads in an xarray")
> Signed-off-by: Dan Carpenter <dan.carpenter@linaro.org>

Thanks, since it's not yet in Linus' tree and we're on time, I'll fold
it to the original patch.

> ---
>  fs/btrfs/delayed-ref.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/fs/btrfs/delayed-ref.c b/fs/btrfs/delayed-ref.c
> index 1f97e1e5c66c..012fce255866 100644
> --- a/fs/btrfs/delayed-ref.c
> +++ b/fs/btrfs/delayed-ref.c
> @@ -848,7 +848,7 @@ add_delayed_ref_head(struct btrfs_trans_handle *trans,
>                 if (xa_is_err(existing)) {
>                         /* Memory was preallocated by the caller. */
>                         ASSERT(xa_err(existing) != -ENOMEM);
> -                       return ERR_CAST(existing);
> +                       return ERR_PTR(xa_err(existing));
>                 } else if (WARN_ON(existing)) {
>                         /*
>                          * Shouldn't happen we just did a lookup before under
> --
> 2.45.2
>
>

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

end of thread, other threads:[~2024-10-31 12:00 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-10-31  7:23 [PATCH next] btrfs: fix error code in add_delayed_ref_head() Dan Carpenter
2024-10-31 11:59 ` Filipe Manana

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

all inboxes | Powered by JetHome®