Re: [PATCH] dax: use assign_bit() where applicable

From: Alison Schofield

Date: Wed Oct 07 2026 - 22:00:13 EST


On Tue, Sep 22, 2026 at 12:08:13AM +0100, Jonathan Cameron wrote:
> On Mon, 21 Sep 2026 10:24:51 +0200
> "Gupta, Pankaj" <pankaj.gupta@xxxxxxx> wrote:
>
> > > [You don't often get email from peng.fan@xxxxxxxxxxx. Learn why this is important at https://aka.ms/LearnAboutSenderIdentification ]
> > >
> > > From: Peng Fan <peng.fan@xxxxxxx>
> > >
> > > Convert open-coded if/else with set_bit/clear_bit to the assign_bit API.
> > >
> > > Signed-off-by: Peng Fan <peng.fan@xxxxxxx>
> >
> > Reviewed-by: Pankaj Gupta <pankaj.gupta@xxxxxxx>
>
> A bit marginal wrt to churn but a good change in general.
> Up to DAX maintainers on whether they want this type of small
> focused improvement.

I didn't see the improvement. When I peruse the file I see set_bit and
clear_bit, and now I see a couple of those obfuscated by a new
assign_bit, needlessly.

If Peng wants to come back around with a 'why' then I'd take another
look. I shared my NAK story here:

https://lore.kernel.org/lkml/asb3hGpSWVQk93cX@xxxxxxxxxxxxxxxxxx/


>
> Reviewed-by: Jonathan Cameron <jonathan.cameron@xxxxxxxxxxxxxxxx>
>
> >
> > > ---
> > > drivers/dax/super.c | 5 +----
> > > 1 file changed, 1 insertion(+), 4 deletions(-)
> > >
> > > diff --git a/drivers/dax/super.c b/drivers/dax/super.c
> > > index 45f84b0eb909..60c4aec52ae1 100644
> > > --- a/drivers/dax/super.c
> > > +++ b/drivers/dax/super.c
> > > @@ -385,10 +385,7 @@ EXPORT_SYMBOL_GPL(dax_flush);
> > >
> > > void dax_write_cache(struct dax_device *dax_dev, bool wc)
> > > {
> > > - if (wc)
> > > - set_bit(DAXDEV_WRITE_CACHE, &dax_dev->flags);
> > > - else
> > > - clear_bit(DAXDEV_WRITE_CACHE, &dax_dev->flags);
> > > + assign_bit(DAXDEV_WRITE_CACHE, &dax_dev->flags, wc);
> > > }
> > > EXPORT_SYMBOL_GPL(dax_write_cache);
> > >
> > > --
> > > 2.51.0
> > >
> > >
> >
>