refcount.c (9a50ee4f8db6e4dd0d8d757b7adaf0591776860a) refcount.c (f492135df0aa0417337f9b8b1cc6d6a994d61d25)
1// SPDX-License-Identifier: GPL-2.0+
2/*
3 * Copyright (C) 2017 Oracle. All Rights Reserved.
4 * Author: Darrick J. Wong <darrick.wong@oracle.com>
5 */
6#include "xfs.h"
7#include "xfs_fs.h"
8#include "xfs_shared.h"

--- 323 unchanged lines hidden (view full) ---

332 const union xfs_btree_rec *rec)
333{
334 struct xfs_refcount_irec irec;
335 xfs_agblock_t *cow_blocks = bs->private;
336 struct xfs_perag *pag = bs->cur->bc_ag.pag;
337
338 xfs_refcount_btrec_to_irec(rec, &irec);
339
1// SPDX-License-Identifier: GPL-2.0+
2/*
3 * Copyright (C) 2017 Oracle. All Rights Reserved.
4 * Author: Darrick J. Wong <darrick.wong@oracle.com>
5 */
6#include "xfs.h"
7#include "xfs_fs.h"
8#include "xfs_shared.h"

--- 323 unchanged lines hidden (view full) ---

332 const union xfs_btree_rec *rec)
333{
334 struct xfs_refcount_irec irec;
335 xfs_agblock_t *cow_blocks = bs->private;
336 struct xfs_perag *pag = bs->cur->bc_ag.pag;
337
338 xfs_refcount_btrec_to_irec(rec, &irec);
339
340 /* Only CoW records can have refcount == 1. */
341 if (irec.rc_domain == XFS_REFC_DOMAIN_SHARED && irec.rc_refcount == 1)
340 /* Check the domain and refcount are not incompatible. */
341 if (!xfs_refcount_check_domain(&irec))
342 xchk_btree_set_corrupt(bs->sc, bs->cur, 0);
342 xchk_btree_set_corrupt(bs->sc, bs->cur, 0);
343 if (irec.rc_domain == XFS_REFC_DOMAIN_COW) {
344 if (irec.rc_refcount != 1)
345 xchk_btree_set_corrupt(bs->sc, bs->cur, 0);
343
344 if (irec.rc_domain == XFS_REFC_DOMAIN_COW)
346 (*cow_blocks) += irec.rc_blockcount;
345 (*cow_blocks) += irec.rc_blockcount;
347 }
348
349 /* Check the extent. */
350 if (!xfs_verify_agbext(pag, irec.rc_startblock, irec.rc_blockcount))
351 xchk_btree_set_corrupt(bs->sc, bs->cur, 0);
352
353 if (irec.rc_refcount == 0)
354 xchk_btree_set_corrupt(bs->sc, bs->cur, 0);
355

--- 120 unchanged lines hidden ---
346
347 /* Check the extent. */
348 if (!xfs_verify_agbext(pag, irec.rc_startblock, irec.rc_blockcount))
349 xchk_btree_set_corrupt(bs->sc, bs->cur, 0);
350
351 if (irec.rc_refcount == 0)
352 xchk_btree_set_corrupt(bs->sc, bs->cur, 0);
353

--- 120 unchanged lines hidden ---