On Mon, Dec 10, 2018 at 07:37:57PM +0800, Qu Wenruo wrote:
> >>> Also please use explicit bool type:
> >>>
> >>> bool xxxx:1
> >>
> >> Is this valid? Haven't seen such usage in kernel code IIRC.
> > 
> > git grep 'bool .*:1' | wc -l
> > 417
> 
> grep -IR 'bool .*:1' fs/btrfs/ | wc -l
> 0
> 
> So I guess another cleanup?

No bool bitfields unless there's a space saved in the structure, please.
If there are less than 4 bool types in a structure, it's same as 4 bits
in u32 and is ok. The bit manipulation needs more instructions, checking
zero/non-zero of a byte is typically cheaper.

Looking at the structure, the 'int action' can be reduced and the hole
to the next u64 has enough bytes to squeeze a number of bools if needed.

Reply via email to