Source kernel commit:
daa79baefc47293c753fed191d722f7ef605a303
The option to enable unwritten extents was made default in 2003,
removed from mkfs in 2007, and cannot be disabled in v5. We also
rely on it for a lot of common functionality, so filesystems without
it will run a completely untested and buggy code path. Enabling the
support also is a simple bit flip using xfs_db, so legacy file
systems can still be brought forward.
Signed-off-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Brian Foster <bfoster@redhat.com>
Signed-off-by: Dave Chinner <david@fromorbit.com>
Signed-off-by: Eric Sandeen <sandeen@sandeen.net>
strcat(s, ",DALIGN");
if (xfs_sb_version_haslogv2(sbp))
strcat(s, ",LOGV2");
- if (xfs_sb_version_hasextflgbit(sbp))
+ /* This feature is required now as well */
+ if (sbp->sb_versionnum & XFS_SB_VERSION_EXTFLGBIT)
strcat(s, ",EXTFLG");
if (xfs_sb_version_hassector(sbp))
strcat(s, ",SECTOR");
version = 0x0034 | XFS_SB_VERSION_EXTFLGBIT;
break;
case XFS_SB_VERSION_4:
- if (xfs_sb_version_hasextflgbit(&mp->m_sb))
+ if (mp->m_sb.sb_versionnum &
+ XFS_SB_VERSION_EXTFLGBIT)
dbprintf(
_("unwritten extents flag is already enabled\n"));
else
* extents to real extents when we're about to write the data.
*/
if ((!bma->wasdel || (bma->flags & XFS_BMAPI_COWFORK)) &&
- (bma->flags & XFS_BMAPI_PREALLOC) &&
- xfs_sb_version_hasextflgbit(&mp->m_sb))
+ (bma->flags & XFS_BMAPI_PREALLOC))
bma->got.br_state = XFS_EXT_UNWRITTEN;
if (bma->wasdel)
* unmapping part of it. But we can't really
* get rid of part of a realtime extent.
*/
- if (del.br_state == XFS_EXT_UNWRITTEN ||
- !xfs_sb_version_hasextflgbit(&mp->m_sb)) {
+ if (del.br_state == XFS_EXT_UNWRITTEN) {
/*
* This piece is unwritten, or we're not
* using unwritten extents. Skip over it.
del.br_blockcount -= mod;
del.br_startoff += mod;
del.br_startblock += mod;
- } else if ((del.br_startoff == start &&
- (del.br_state == XFS_EXT_UNWRITTEN ||
- tp->t_blk_res == 0)) ||
- !xfs_sb_version_hasextflgbit(&mp->m_sb)) {
+ } else if (del.br_startoff == start &&
+ (del.br_state == XFS_EXT_UNWRITTEN ||
+ tp->t_blk_res == 0)) {
/*
* Can't make it unwritten. There isn't
* a full extent here so just skip it.
XFS_FSB_TO_AGNO(mp, endfsb))
return __this_address;
}
- if (irec->br_state != XFS_EXT_NORM) {
- if (whichfork != XFS_DATA_FORK)
- return __this_address;
- if (!xfs_sb_version_hasextflgbit(&mp->m_sb))
- return __this_address;
- }
+ if (irec->br_state != XFS_EXT_NORM && whichfork != XFS_DATA_FORK)
+ return __this_address;
return NULL;
}
{
if (!(sbp->sb_versionnum & XFS_SB_VERSION_DIRV2BIT))
return false;
+ if (!(sbp->sb_versionnum & XFS_SB_VERSION_EXTFLGBIT))
+ return false;
/* check for unknown features in the fs */
if ((sbp->sb_versionnum & ~XFS_SB_VERSION_OKBITS) ||
(sbp->sb_versionnum & XFS_SB_VERSION_LOGV2BIT);
}
-static inline bool xfs_sb_version_hasextflgbit(struct xfs_sb *sbp)
-{
- return XFS_SB_VERSION_NUM(sbp) == XFS_SB_VERSION_5 ||
- (sbp->sb_versionnum & XFS_SB_VERSION_EXTFLGBIT);
-}
-
static inline bool xfs_sb_version_hassector(struct xfs_sb *sbp)
{
return (sbp->sb_versionnum & XFS_SB_VERSION_SECTORBIT);
geo->version = XFS_FSOP_GEOM_VERSION;
geo->flags = XFS_FSOP_GEOM_FLAGS_NLINK |
- XFS_FSOP_GEOM_FLAGS_DIRV2;
+ XFS_FSOP_GEOM_FLAGS_DIRV2 |
+ XFS_FSOP_GEOM_FLAGS_EXTFLG;
if (xfs_sb_version_hasattr(sbp))
geo->flags |= XFS_FSOP_GEOM_FLAGS_ATTR;
if (xfs_sb_version_hasquota(sbp))
geo->flags |= XFS_FSOP_GEOM_FLAGS_IALIGN;
if (xfs_sb_version_hasdalign(sbp))
geo->flags |= XFS_FSOP_GEOM_FLAGS_DALIGN;
- if (xfs_sb_version_hasextflgbit(sbp))
- geo->flags |= XFS_FSOP_GEOM_FLAGS_EXTFLG;
if (xfs_sb_version_hassector(sbp))
geo->flags |= XFS_FSOP_GEOM_FLAGS_SECTOR;
if (xfs_sb_version_hasasciici(sbp))
return 1;
}
- /*
- * verify that the blocks listed in the record
- * are multiples of an extent
- */
- if (xfs_sb_version_hasextflgbit(&mp->m_sb) == 0 &&
- (irec->br_startblock % mp->m_sb.sb_rextsize != 0 ||
- irec->br_blockcount % mp->m_sb.sb_rextsize != 0)) {
- do_warn(
-_("malformed rt inode extent [%" PRIu64 " %" PRIu64 "] (fs rtext size = %u)\n"),
- irec->br_startblock,
- irec->br_blockcount,
- mp->m_sb.sb_rextsize);
- return 1;
- }
-
/*
* set the appropriate number of extents
* this iterates block by block, this can be optimised using extents
for (b = irec->br_startblock; b < irec->br_startblock +
irec->br_blockcount; b += mp->m_sb.sb_rextsize) {
ext = (xfs_rtblock_t) b / mp->m_sb.sb_rextsize;
- pwe = xfs_sb_version_hasextflgbit(&mp->m_sb) &&
- irec->br_state == XFS_EXT_UNWRITTEN &&
+ pwe = irec->br_state == XFS_EXT_UNWRITTEN &&
(b % mp->m_sb.sb_rextsize != 0);
if (check_dups == 1) {
*/
if (xfs_sb_version_hasdalign(source))
dest->sb_versionnum |= XFS_SB_VERSION_DALIGNBIT;
- if (xfs_sb_version_hasextflgbit(source))
- dest->sb_versionnum |= XFS_SB_VERSION_EXTFLGBIT;
+ dest->sb_versionnum |= XFS_SB_VERSION_EXTFLGBIT;
/*
* these are all supposed to be zero or will get reset anyway
if (xfs_sb_version_hasdalign(sbp))
geo->sb_salignbit = 1;
- if (xfs_sb_version_hasextflgbit(sbp))
- geo->sb_extflgbit = 1;
-
+ geo->sb_extflgbit = 1;
geo->sb_fully_zeroed = 1;
}
fs_aligned_inodes = 0;
fs_sb_feature_bits = 0;
fs_ino_alignment = 0;
- fs_has_extflgbit = 0;
+ fs_has_extflgbit = 1;
have_uquotino = 0;
have_gquotino = 0;
have_pquotino = 0;
* ok, check to make sure that the sb isn't newer
* than we are
*/
- if (xfs_sb_version_hasextflgbit(sb))
- fs_has_extflgbit = 1;
-
if (!xfs_sb_good_version(sb)) {
do_warn(_("WARNING: unknown superblock version %d\n"),
XFS_SB_VERSION_NUM(sb));