diff options
Diffstat (limited to 'fs/xfs/xfs_refcount_item.c')
-rw-r--r-- | fs/xfs/xfs_refcount_item.c | 32 |
1 files changed, 30 insertions, 2 deletions
diff --git a/fs/xfs/xfs_refcount_item.c b/fs/xfs/xfs_refcount_item.c index 7d4879831809..feb21c1ac582 100644 --- a/fs/xfs/xfs_refcount_item.c +++ b/fs/xfs/xfs_refcount_item.c @@ -21,6 +21,7 @@ #include "xfs_log_priv.h" #include "xfs_log_recover.h" #include "xfs_ag.h" +#include "xfs_rtgroup.h" struct kmem_cache *xfs_cui_cache; struct kmem_cache *xfs_cud_cache; @@ -286,6 +287,11 @@ xfs_refcount_update_diff_items( ra = container_of(a, struct xfs_refcount_intent, ri_list); rb = container_of(b, struct xfs_refcount_intent, ri_list); + ASSERT(ra->ri_realtime == rb->ri_realtime); + + if (ra->ri_realtime) + return ra->ri_rtg->rtg_rgno - rb->ri_rtg->rtg_rgno; + return ra->ri_pag->pag_agno - rb->ri_pag->pag_agno; } @@ -324,6 +330,8 @@ xfs_refcount_update_log_item( default: ASSERT(0); } + if (ri->ri_realtime) + pmap->pe_flags |= XFS_REFCOUNT_EXTENT_REALTIME; } static struct xfs_log_item * @@ -365,6 +373,15 @@ xfs_refcount_update_get_group( { xfs_agnumber_t agno; + if (ri->ri_realtime) { + xfs_rgnumber_t rgno; + + rgno = xfs_rtb_to_rgno(mp, ri->ri_startblock); + ri->ri_rtg = xfs_rtgroup_get(mp, rgno); + xfs_rtgroup_bump_intents(ri->ri_rtg); + return; + } + agno = XFS_FSB_TO_AGNO(mp, ri->ri_startblock); ri->ri_pag = xfs_perag_get(mp, agno); xfs_perag_bump_intents(ri->ri_pag); @@ -375,6 +392,12 @@ static inline void xfs_refcount_update_put_group( struct xfs_refcount_intent *ri) { + if (ri->ri_realtime) { + xfs_rtgroup_drop_intents(ri->ri_rtg); + xfs_rtgroup_put(ri->ri_rtg); + return; + } + xfs_perag_drop_intents(ri->ri_pag); xfs_perag_put(ri->ri_pag); } @@ -536,6 +559,7 @@ xfs_cui_item_recover( goto abort_error; } + fake.ri_realtime = pmap->pe_flags & XFS_REFCOUNT_EXTENT_REALTIME; fake.ri_startblock = pmap->pe_startblock; fake.ri_blockcount = pmap->pe_len; @@ -561,18 +585,22 @@ xfs_cui_item_recover( switch (fake.ri_type) { case XFS_REFCOUNT_INCREASE: - xfs_refcount_increase_extent(tp, &irec); + xfs_refcount_increase_extent(tp, + fake.ri_realtime, &irec); break; case XFS_REFCOUNT_DECREASE: - xfs_refcount_decrease_extent(tp, &irec); + xfs_refcount_decrease_extent(tp, + fake.ri_realtime, &irec); break; case XFS_REFCOUNT_ALLOC_COW: xfs_refcount_alloc_cow_extent(tp, + fake.ri_realtime, irec.br_startblock, irec.br_blockcount); break; case XFS_REFCOUNT_FREE_COW: xfs_refcount_free_cow_extent(tp, + fake.ri_realtime, irec.br_startblock, irec.br_blockcount); break; |