Re: [PATCH -v2] ext4: enable scoped NOFS when starting a handle in nojournal mode

"Theodore Tso" <[email protected]>
Newsgroups org.kernel.vger.linux-ext4
Message-ID <[email protected]>
On Thu, Jul 16, 2026 at 01:45:51PM -0500, Andreas Dilger wrote:
> If you wanted to avoid an allocation for each nojournal handle on 64-bit
> systems, you could put a magic number in the high 32 bits of the handle
> pointer (which is unlikely to conflict with real memory addresses),
> and the PF_* flags in the low 32 bits.

That's an optimization we could do later, if we think the complexity
overhead is worth it.

> > @@ -513,6 +513,7 @@ struct jbd2_journal_handle
> >  	unsigned int h_sync: 1;
> >  	unsigned int h_reserved: 1;
> >  	unsigned int h_aborted: 1;
> > +	unsigned int h_invalid: 1;
> >  	unsigned int h_type: 8;
> >  	unsigned int h_line_no: 16;
> 
> Not sure if it makes much difference, but should h_line_no be aligned on a
> 16-bit offset and h_type aligned on an 8-bit offset by adding an
> "unsigned int h_unused:4" field before h_type, or reorder them so the 1-bit
> fields are at the end?  That would allow the integer fields to be accessed
> directly rather than also having to shift them.

Both gcc and clang support the extension of supporting bitfields on
char and shorts, so we can do this:

-       unsigned int    h_sync:         1;
-       unsigned int    h_reserved:     1;
-       unsigned int    h_aborted:      1;
-       unsigned int    h_invalid:      1;
-       unsigned int    h_type:         8;
-       unsigned int    h_line_no:      16;
+       unsigned char   h_sync:         1;
+       unsigned char   h_reserved:     1;
+       unsigned char   h_aborted:      1;
+       unsigned char   h_invalid:      1;
+       unsigned char   h_type;
+       unsigned short  h_line_no;

						- Ted
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.