Skip to content

Commit 336642f

Browse files
author
Darrick J. Wong
committed
xfs: alert the user about data/attr fork mappings that could be merged
If the data or attr forks have mappings that could be merged, let the user know that the structure could be optimized. This isn't a filesystem corruption since the regular filesystem does not try to be smart about merging bmbt records. Signed-off-by: Darrick J. Wong <djwong@kernel.org> Reviewed-by: Dave Chinner <dchinner@redhat.com>
1 parent c0d5a92 commit 336642f

1 file changed

Lines changed: 11 additions & 0 deletions

File tree

fs/xfs/scrub/bmap.c

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -764,6 +764,7 @@ xchk_bmap_iext_iter(
764764
{
765765
struct xfs_bmbt_irec got;
766766
struct xfs_ifork *ifp;
767+
xfs_filblks_t prev_len;
767768

768769
ifp = xfs_ifork_ptr(info->sc->ip, info->whichfork);
769770

@@ -782,6 +783,7 @@ xchk_bmap_iext_iter(
782783
* Iterate subsequent iextent records and merge them with the one
783784
* that we just read, if possible.
784785
*/
786+
prev_len = irec->br_blockcount;
785787
while (xfs_iext_peek_next_extent(ifp, &info->icur, &got)) {
786788
if (!xchk_are_bmaps_contiguous(irec, &got))
787789
break;
@@ -792,7 +794,16 @@ xchk_bmap_iext_iter(
792794
return false;
793795
}
794796

797+
/*
798+
* Notify the user of mergeable records in the data or attr
799+
* forks. CoW forks only exist in memory so we ignore them.
800+
*/
801+
if (info->whichfork != XFS_COW_FORK &&
802+
prev_len + got.br_blockcount > BMBT_BLOCKCOUNT_MASK)
803+
xchk_ino_set_preen(info->sc, info->sc->ip->i_ino);
804+
795805
irec->br_blockcount += got.br_blockcount;
806+
prev_len = got.br_blockcount;
796807
xfs_iext_next(ifp, &info->icur);
797808
}
798809

0 commit comments

Comments
 (0)