Commit e5e5cae0 authored by Christoph Hellwig's avatar Christoph Hellwig Committed by Darrick J. Wong
Browse files

xfs: store a generic group structure in the intents



Replace the pag pointers in the extent free, bmap, rmap and refcount
intent structures with a pointer to the generic group to prepare
for adding intents for realtime groups.

Signed-off-by: default avatarChristoph Hellwig <hch@lst.de>
Reviewed-by: default avatarDarrick J. Wong <djwong@kernel.org>
Signed-off-by: default avatarDarrick J. Wong <djwong@kernel.org>
parent ba102a68
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -248,7 +248,7 @@ struct xfs_extent_free_item {
	uint64_t		xefi_owner;
	xfs_fsblock_t		xefi_startblock;/* starting fs block number */
	xfs_extlen_t		xefi_blockcount;/* number of blocks in extent */
	struct xfs_perag	*xefi_pag;
	struct xfs_group	*xefi_group;
	unsigned int		xefi_flags;
	enum xfs_ag_resv_type	xefi_agresv;
};
+1 −1
Original line number Diff line number Diff line
@@ -248,7 +248,7 @@ struct xfs_bmap_intent {
	enum xfs_bmap_intent_type		bi_type;
	int					bi_whichfork;
	struct xfs_inode			*bi_owner;
	struct xfs_perag			*bi_pag;
	struct xfs_group			*bi_group;
	struct xfs_bmbt_irec			bi_bmap;
};

+5 −4
Original line number Diff line number Diff line
@@ -1358,7 +1358,7 @@ xfs_refcount_finish_one(
	 * If we haven't gotten a cursor or the cursor AG doesn't match
	 * the startblock, get one now.
	 */
	if (rcur != NULL && to_perag(rcur->bc_group) != ri->ri_pag) {
	if (rcur != NULL && rcur->bc_group != ri->ri_group) {
		nr_ops = rcur->bc_refc.nr_ops;
		shape_changes = rcur->bc_refc.shape_changes;
		xfs_btree_del_cursor(rcur, 0);
@@ -1366,13 +1366,14 @@ xfs_refcount_finish_one(
		*pcur = NULL;
	}
	if (rcur == NULL) {
		error = xfs_alloc_read_agf(ri->ri_pag, tp,
		struct xfs_perag	*pag = to_perag(ri->ri_group);

		error = xfs_alloc_read_agf(pag, tp,
				XFS_ALLOC_FLAG_FREEING, &agbp);
		if (error)
			return error;

		*pcur = rcur = xfs_refcountbt_init_cursor(mp, tp, agbp,
							  ri->ri_pag);
		*pcur = rcur = xfs_refcountbt_init_cursor(mp, tp, agbp, pag);
		rcur->bc_refc.nr_ops = nr_ops;
		rcur->bc_refc.shape_changes = shape_changes;
	}
+1 −1
Original line number Diff line number Diff line
@@ -56,7 +56,7 @@ enum xfs_refcount_intent_type {

struct xfs_refcount_intent {
	struct list_head			ri_list;
	struct xfs_perag			*ri_pag;
	struct xfs_group			*ri_group;
	enum xfs_refcount_intent_type		ri_type;
	xfs_extlen_t				ri_blockcount;
	xfs_fsblock_t				ri_startblock;
+9 −7
Original line number Diff line number Diff line
@@ -2586,28 +2586,30 @@ xfs_rmap_finish_one(
	 * If we haven't gotten a cursor or the cursor AG doesn't match
	 * the startblock, get one now.
	 */
	if (rcur != NULL && to_perag(rcur->bc_group) != ri->ri_pag) {
	if (rcur != NULL && rcur->bc_group != ri->ri_group) {
		xfs_btree_del_cursor(rcur, 0);
		rcur = NULL;
		*pcur = NULL;
	}
	if (rcur == NULL) {
		struct xfs_perag	*pag = to_perag(ri->ri_group);

		/*
		 * Refresh the freelist before we start changing the
		 * rmapbt, because a shape change could cause us to
		 * allocate blocks.
		 */
		error = xfs_free_extent_fix_freelist(tp, ri->ri_pag, &agbp);
		error = xfs_free_extent_fix_freelist(tp, pag, &agbp);
		if (error) {
			xfs_ag_mark_sick(ri->ri_pag, XFS_SICK_AG_AGFL);
			xfs_ag_mark_sick(pag, XFS_SICK_AG_AGFL);
			return error;
		}
		if (XFS_IS_CORRUPT(tp->t_mountp, !agbp)) {
			xfs_ag_mark_sick(ri->ri_pag, XFS_SICK_AG_AGFL);
			xfs_ag_mark_sick(pag, XFS_SICK_AG_AGFL);
			return -EFSCORRUPTED;
		}

		*pcur = rcur = xfs_rmapbt_init_cursor(mp, tp, agbp, ri->ri_pag);
		*pcur = rcur = xfs_rmapbt_init_cursor(mp, tp, agbp, pag);
	}

	xfs_rmap_ino_owner(&oinfo, ri->ri_owner, ri->ri_whichfork,
@@ -2620,7 +2622,7 @@ xfs_rmap_finish_one(
	if (error)
		return error;

	xfs_rmap_update_hook(tp, pag_group(ri->ri_pag), ri->ri_type, bno,
	xfs_rmap_update_hook(tp, ri->ri_group, ri->ri_type, bno,
			ri->ri_bmap.br_blockcount, unwritten, &oinfo);
	return 0;
}
Loading