mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Matthew Wilcox <willy@infradead.org>
To: Kemeng Shi <shikemeng@huaweicloud.com>
Cc: akpm@linux-foundation.org, linux-kernel@vger.kernel.org,
	linux-fsdevel@vger.kernel.org
Subject: Re: [PATCH 4/6] Xarray: skip unneeded xas_store() and xas_clear_mark() in __xa_alloc()
Date: Fri, 1 Nov 2024 16:02:49 +0000	[thread overview]
Message-ID: <ZyT7qRhtqGDe_AuO@casper.infradead.org> (raw)
In-Reply-To: <20241101155028.11702-5-shikemeng@huaweicloud.com>

On Fri, Nov 01, 2024 at 11:50:26PM +0800, Kemeng Shi wrote:
> If xas_find_marked() failed, there is no need to call xas_store() and
> xas_clear_mark(). Just call xas_store() and xas_clear_mark() if
> xas_find_marked() succeed.

No.  The point of the xas interfaces is that they turn into no-ops once
an error has occurred.

> -		else
> +		else {
>  			*id = xas.xa_index;
> -		xas_store(&xas, entry);
> -		xas_clear_mark(&xas, XA_FREE_MARK);
> +			xas_store(&xas, entry);
> +			xas_clear_mark(&xas, XA_FREE_MARK);
> +		}
>  	} while (__xas_nomem(&xas, gfp));
>  
>  	return xas_error(&xas);
> -- 
> 2.30.0
> 

  reply	other threads:[~2024-11-01 16:02 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-11-01 15:50 [PATCH 0/6] Fixes and cleanups to xarray Kemeng Shi
2024-11-01 15:50 ` [PATCH 1/6] Xarray: Do not return sibling entries from xas_find_marked() Kemeng Shi
2024-11-01 15:50 ` [PATCH 2/6] Xarray: distinguish large entries correctly in xas_split_alloc() Kemeng Shi
2024-11-01 15:50 ` [PATCH 3/6] Xarray: move forward index correctly in xas_pause() Kemeng Shi
2024-11-01 15:50 ` [PATCH 4/6] Xarray: skip unneeded xas_store() and xas_clear_mark() in __xa_alloc() Kemeng Shi
2024-11-01 16:02   ` Matthew Wilcox [this message]
2024-11-04  1:55     ` Kemeng Shi
2024-11-04 13:34       ` Matthew Wilcox
2024-11-01 15:50 ` [PATCH 5/6] Xarray: remove repeat check in xas_squash_marks() Kemeng Shi
2024-11-01 15:50 ` [PATCH 6/6] Xarray: use xa_mark_t in xas_squash_marks() to keep code consistent Kemeng Shi

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=ZyT7qRhtqGDe_AuO@casper.infradead.org \
    --to=willy@infradead.org \
    --cc=akpm@linux-foundation.org \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=shikemeng@huaweicloud.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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®