diff options
author | Darrick J. Wong <djwong@kernel.org> | 2022-07-14 11:06:38 -0700 |
---|---|---|
committer | Darrick J. Wong <djwong@kernel.org> | 2022-11-09 19:07:36 -0800 |
commit | a4365342dddc85ec2c1e955fac4a0bdc12028f67 (patch) | |
tree | 13206693b3de7bea3f5460d7bc14de1995a0fad4 | |
parent | 36fdb2f400813c67e1d8f83a0e5afdc3c256e64c (diff) |
xfs: support recovering bmap intent items targetting realtime extentsrealtime-bmap-intents_2022-11-09
Now that we have reflink on the realtime device, bmap intent items have
to support remapping extents on the realtime volume.
Signed-off-by: Darrick J. Wong <djwong@kernel.org>
-rw-r--r-- | fs/xfs/xfs_bmap_item.c | 17 |
1 files changed, 16 insertions, 1 deletions
diff --git a/fs/xfs/xfs_bmap_item.c b/fs/xfs/xfs_bmap_item.c index 82970413cb85..30a5402bb79c 100644 --- a/fs/xfs/xfs_bmap_item.c +++ b/fs/xfs/xfs_bmap_item.c @@ -319,7 +319,7 @@ xfs_bmap_update_log_item( map->me_flags |= XFS_BMAP_EXTENT_UNWRITTEN; if (bi->bi_whichfork == XFS_ATTR_FORK) map->me_flags |= XFS_BMAP_EXTENT_ATTR_FORK; - if (xfs_ifork_is_realtime(bmap->bi_owner, bmap->bi_whichfork)) + if (xfs_ifork_is_realtime(bi->bi_owner, bi->bi_whichfork)) map->me_flags |= XFS_BMAP_EXTENT_REALTIME; } @@ -362,6 +362,9 @@ xfs_bmap_update_get_group( { xfs_agnumber_t agno; + if (xfs_ifork_is_realtime(bi->bi_owner, bi->bi_whichfork)) + return; + agno = XFS_FSB_TO_AGNO(mp, bi->bi_bmap.br_startblock); bi->bi_pag = xfs_perag_get(mp, agno); @@ -380,6 +383,9 @@ static inline void xfs_bmap_update_put_group( struct xfs_bmap_intent *bi) { + if (xfs_ifork_is_realtime(bi->bi_owner, bi->bi_whichfork)) + return; + xfs_perag_drop_intents(bi->bi_pag); xfs_perag_put(bi->bi_pag); } @@ -469,6 +475,9 @@ xfs_bui_validate( if (!xfs_verify_fileext(mp, map->me_startoff, map->me_len)) return false; + if (map->me_flags & XFS_BMAP_EXTENT_REALTIME) + return xfs_verify_rtext(mp, map->me_startblock, map->me_len); + return xfs_verify_fsbext(mp, map->me_startblock, map->me_len); } @@ -516,6 +525,12 @@ xfs_bui_item_recover( xfs_ilock(ip, XFS_ILOCK_EXCL); xfs_trans_ijoin(tp, ip, 0); + if (!!(map->me_flags & XFS_BMAP_EXTENT_REALTIME) != + xfs_ifork_is_realtime(ip, fake.bi_whichfork)) { + error = -EFSCORRUPTED; + goto err_cancel; + } + if (fake.bi_type == XFS_BMAP_MAP) iext_delta = XFS_IEXT_ADD_NOSPLIT_CNT; else |