Re: [PATCH 2/4] xfs: inode fork allocation depends on XFS_IFEXTENT flag

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

 



On Wed, Mar 31, 2021 at 08:40:07AM +1100, Dave Chinner wrote:
> ifp->if_flags is set to XFS_IFINLINE for local format forks,
> XFS_IFEXTENTS for extent format forks, and XFS_IFBROOT for btree
> roots in the inode fork.

No.  All the above are flags, not alternatives.  (and reading futher
you actually properly document it below).

> The problem is that we've overloaded XFS_IFEXTENTS to -also- mean
> "extents loaded in memory".

I would not call this an overload.  It is a somewhat quirky encoding
that actually works pretty well for the use case.

> What we used to have is another flag - XFS_IFEXTIREC - to indicate
> that the XFS_IFBROOT format root was read into the incore memory
> tree. This was removed in commit 6bdcf26ade88 ("xfs: use a b+tree
> for the in-core extent list") when the btree was added for both
> extent format and btree format forks, and it's use to indicate that
> the btree had been read was replaced with the XFS_IFEXTENTS flag.
> 
> That's when XFS_IFEXTENTS gained it's dual meaning.

No. The XFS_IFEXTENTS meaning did not change at all in that commit.
Even before a lot of code looked at XFS_IFEXTENTS and if it wasn't
set called xfs_iread_extents, XFS_IFEXTIREC was only used internally
for the in-memory indirection array and was completely unrelated to the
on-disk format.

> - XFS_IFINLINE means inode fork data is inode type specific data
> - XFS_IFEXTENTS means the inode fork data is in extent format and
>   that the in-core extent btree has been populated
> - XFS_IFBROOT means the inode fork data is a btree root
> - XFS_IFBROOT|XFS_IFEXTENTS mean the inode data fork is a btree root
>   and that the in-core extent btree has been populated
> 
> Historically, that last case was XFS_IFBROOT|XFS_IFEXTIREC. 

No, that was not the case, even historically.  btree based inodes
already existed for more than 10 years when commit 0293ce3a9fd1
added XFS_IFEXTIREC to singinify the in-memory indirect extent
array.

> What
> should have been done in 6bdcf26ade88 is the XFS_IFEXTENTS format
> fork should have become XFS_IFEXTENTS|XFS_IFEXTIREC to indicate
> "extent format, extent tree populated", rather than eliding
> XFS_IFEXTIREC and redefining XFS_IFEXTENTS to mean "extent tree
> populated".  i.e. the separate flag to indicate the difference
> between fork format and in-memory state should have been
> retained....

I strongly disagree.  If we want to clean this up the right thing is
to remove XFS_IFINLINE and XFS_IFBROOT entirely, and just look at the
if_format field for the extent format.



[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