Re: [GIT PULL] vfs dio

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Mon, 20 Jan 2025 at 11:24, Linus Torvalds
<torvalds@xxxxxxxxxxxxxxxxxxxx> wrote:
>
> And that field was added in a way that causes the struct to grow due
> to alignment issues.  For no good reason, because there were existing
> holes in there.
>
> So please just fix it.

Side note: for extra bonus points, just make those fields be 'u8' or
even smaller, knowing that the values

 (a) have to be powers of two anyway because nobody can deal with anything else

 (b) the powers are already limited to 31 on the top end (by the
existing use of 'u32') and 9 on the low end (by SECTOR_SIZE)

And yeah, maybe somebody wants to have a "no alignment possible"
value, so that would make it a total of 24 different values.

You really don't need 32 bits to encode 24 values.

So wasting three 32-bit words for this all - and an extra one for the
bad alignment - is just a crime, and only makes kstat bigger on stack.

It also just adds extra code, since most *sources* have the size in
bits anyway: it typically comes from things i_blocksize(), which just
does

        return (1 << node->i_blkbits);

and it would be better to just give the bit number.

(XFS uses a special XFS_FSB_TO_B() thing to turn its bit-numbers to
byte sizes - I'm not claiming that everybody uses i_blkbits, I'm just
claiming that all sane users already are in terms of bits)

               Linus




[Index of Archives]     [Linux Ext4 Filesystem]     [Union Filesystem]     [Filesystem Testing]     [Ceph Users]     [Ecryptfs]     [NTFS 3]     [AutoFS]     [Kernel Newbies]     [Share Photos]     [Security]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux Cachefs]     [Reiser Filesystem]     [Linux RAID]     [NTFS 3]     [Samba]     [Device Mapper]     [CEPH Development]

  Powered by Linux