Re: [PATCH v2 1/3] fs: add infrastructure for multigrain inode i_m/ctime

From: NeilBrown
Date: Mon Apr 24 2023 - 18:40:34 EST


On Tue, 25 Apr 2023, Jeff Layton wrote:
> On Tue, 2023-04-25 at 07:47 +1000, NeilBrown wrote:
> > On Tue, 25 Apr 2023, Jeff Layton wrote:
> > > + /*
> > > + * Warn if someone sets SB_MULTIGRAIN_TS, but doesn't turn down the ts
> > > + * granularity.
> > > + */
> > > + return (sb->s_flags & SB_MULTIGRAIN_TS) &&
> > > + !WARN_ON_ONCE(sb->s_time_gran == 1);
> >
> > Maybe
> > !WARN_ON_ONCE(sb->s_time_gran & SB_MULTIGRAIN_TS);
> > ??
> >
>
> I'm not sure I understand what you mean here.

That's fair, as what I wrote didn't make any sense.
I meant to write:

!WARN_ON_ONCE(sb->s_time_gran & I_CTIME_QUERIED);

to make it explicit that s_time_gran must leave space for
I_CTIME_QUERIED to be set (as you write below). Specifically that
s_time_gran mustn't be odd.

> We want to check whether
> SB_MULTIGRAIN_TS is set in the flags, and that s_time_gran > 1. The
> latter is required so that we have space for the I_CTIME_QUERIED flag.
>
> If SB_MULTIGRAIN_TS is set, but the s_time_gran is too low, we want to
> throw a warning (since something is clearly wrong).
>

NeilBrown