Re: [PATCH 7/7] xfs: Extend attr extent counter to 32 bits

Chandan Babu R
2020-06-20T12:54:25Z

On Friday 19 June 2020 8:09:17 PM IST Christoph Hellwig wrote:
> On Sat, Jun 06, 2020 at 01:57:45PM +0530, Chandan Babu R wrote:
> > This commit extends the per-inode attr extent counter to 32 bits.
>
> And the reason for why this is needed or at least nice to have needs
> to go here.
>

Parent pointers are stored in xattrs of the corresponding inode. Dave had
informed me that there have been instances where we have more than 100 million
hardlinks associated with an inode. This will most likely cause the 16-bit
wide on-disk xattr extent counter to overflow as described below,

1. Insert 5 million xattrs (each having a value size of 255 bytes) and then
delete 50% of them in an alternating manner.
./benchmark-xattrs -l 255 -n 5000000 -s 50 -f $mntpnt/testfile-0

benchmark-xattrs.c and related sources can be obtained from
https://github.com/chandanr/xfs-xattr-benchmark/blob/master/src/

2. This causes 98511 extents to be created in the attr fork of the inode.
xfsaild/loop0 2035 [003] 9643.390490: probe:xfs_iflush_int: (ffffffffac6225c0) if_nextents=98511 inode=131

3. The incore inode fork extent counter is a signed 32-bit quantity. However
the on-disk extent counter is an unsigned 16-bit quantity and hence cannot
hold 98511 extents.

4. The following incorrect value is stored in the attr extent counter
# xfs_db -f -c 'inode 131' -c 'print core.naextents' /dev/loop0
core.naextents = -32561

I will add a generic description of the above sequence of events in the commit
message of this patch when posting the next version.

--
chandan