On 13/02/2024 17:22, Darrick J. Wong wrote:
I am not sure what bdev_validate_atomic_write() would even do. If
sb_rextsize exceeded the bdev atomic write unit max, then we just cap
reported atomic write unit max in statx to that which the bdev reports and
vice-versa.
And didn't we previously have a concern that it is possible to change the
geometry of the device?
The thing is, I don't want this logic:
if (!is_power_of_2(mp->m_sb.sb_rextsize))
/* fail */
This is really specific to XFS. Let's see where all this alignment stuff
goes before trying to unify all these checks.
to be open-coded inside xfs. I'd rather have a standard bdev_* helper
that every filesystem can call, so we don't end up with more generic
code copy-pasted all over the codebase.
The awkward part (for me) is the naming, since filesystems usually don't
have to check with the block layer about their units of space allocation.
/*
* Ensure that a file space allocation unit is congruent with the atomic
* write unit capabilities of supported block devices.
*/
static inline bool bdev_validate_atomic_write_allocunit(unsigned au)
{
return is_power_of_2(au);
}
if (!bdev_validate_atomic_write_allocunit(mp->m-sb.sb_rextsize))
return -EINVAL;
As above, I can try to unify, but this alignment stuff is a bit up in
the air at the moment.
Thanks,
John