1 /* SPDX-License-Identifier: GPL-2.0-or-later */
3 * Copyright (C) 2019 Oracle. All Rights Reserved.
4 * Author: Darrick J. Wong <darrick.wong@oracle.com>
6 #ifndef __XFS_SCRUB_ATTR_H__
7 #define __XFS_SCRUB_ATTR_H__
10 * Temporary storage for online scrub and repair of extended attributes.
12 struct xchk_xattr_buf
{
13 /* Size of @buf, in bytes. */
17 * Memory buffer -- either used for extracting attr values while
18 * walking the attributes; or for computing attr block bitmaps when
19 * checking the attribute tree.
21 * Each bitmap contains enough bits to track every byte in an attr
22 * block (rounded up to the size of an unsigned long). The attr block
23 * used space bitmap starts at the beginning of the buffer; the free
24 * space bitmap follows immediately after; and we have a third buffer
25 * for storing intermediate bitmap results.
30 /* A place to store attribute values. */
31 static inline uint8_t *
35 struct xchk_xattr_buf
*ab
= sc
->buf
;
40 /* A bitmap of space usage computed by walking an attr leaf block. */
41 static inline unsigned long *
45 struct xchk_xattr_buf
*ab
= sc
->buf
;
47 return (unsigned long *)ab
->buf
;
50 /* A bitmap of free space computed by walking attr leaf block free info. */
51 static inline unsigned long *
55 return xchk_xattr_usedmap(sc
) +
56 BITS_TO_LONGS(sc
->mp
->m_attr_geo
->blksize
);
59 /* A bitmap used to hold temporary results. */
60 static inline unsigned long *
64 return xchk_xattr_freemap(sc
) +
65 BITS_TO_LONGS(sc
->mp
->m_attr_geo
->blksize
);
68 int xchk_setup_xattr_buf(struct xfs_scrub
*sc
, size_t value_size
,
69 xfs_km_flags_t flags
);
71 #endif /* __XFS_SCRUB_ATTR_H__ */