Extent size hints exist to nudge the behavior of the file data block
allocator towards trying to make aligned allocations. Therefore, it
doesn't make sense to allow a hint that isn't a multiple of the
fundamental allocation unit for a given file.
This means that if the sysadmin is formatting with rtinherit set on the
root dir, validate_extsize_hint needs to check the hint value on a
simulated realtime file to make sure that it's correct. Unfortunately,
the gate check here was for a nonzero rt extent size, which is wrong
since we never format with rtextsize==0. This leads to absurd failures
such as:
# mkfs.xfs -f /dev/sdf -r extsize=7b -d rtinherit=0,extszinherit=13
illegal extent size hint 13, must be less than 649088 and a multiple of 7.
Signed-off-by: Darrick J. Wong <djwong@kernel.org>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Carlos Maiolino <cmaiolino@redhat.com>
Signed-off-by: Eric Sandeen <sandeen@sandeen.net>
}
/*
- * Now we do it again with a realtime file so that we know the hint and
- * flag that get passed on to realtime files will be correct.
+ * If the value is to be passed on to realtime files, revalidate with
+ * a realtime file so that we know the hint and flag that get passed on
+ * to realtime files will be correct.
*/
- if (mp->m_sb.sb_rextsize == 0)
+ if (!(cli->fsx.fsx_xflags & FS_XFLAG_RTINHERIT))
return;
flags = XFS_DIFLAG_REALTIME;