Re: [PATCHSET RFC v1.0 0/7] xfs: clean up realtime type usage

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

 



On Thu, Oct 12, 2023 at 03:30:00PM -0700, Darrick J. Wong wrote:
> The primary advantage that I can think of is code readability -- all the
> xfs_*rtb_ functions take xfs_rtblock_t types, and you can follow them
> all the way through the rt allocator/rmap/refcount code.  xfs_rtblock_t
> is a linear quantity even with rtgroups turned on.
> 
> The gross part is that one still has to know that br_startblock can be
> either xfs_fsblock_t or xfs_rtblock_t depending on inode and whichfork.

Yeah.

> That said, I don't think gcc actually warns about silent casts from
> xfs_fsblock_t to xfs_rtblock_t.


typedefs in C are syntactix shugar.  You will never get a warning about
mixing typedefs for the same underlying type (and often also not for
mixing with other integer types).  Having an annotation for a strong
typedef that can only do arithmetic on itself without casts or special
annotations would be really handy, though.



[Index of Archives]     [XFS Filesystem Development (older mail)]     [Linux Filesystem Development]     [Linux Audio Users]     [Yosemite Trails]     [Linux Kernel]     [Linux RAID]     [Linux SCSI]


  Powered by Linux