io_uring: don't use 'fd' for openat/openat2/statx
[linux/fpc-iii.git] / fs / xfs / scrub / attr.h
blob13a1d2e8424d9a3b4d52c1721eea610ad9bd6780
1 /* SPDX-License-Identifier: GPL-2.0-or-later */
2 /*
3 * Copyright (C) 2019 Oracle. All Rights Reserved.
4 * Author: Darrick J. Wong <darrick.wong@oracle.com>
5 */
6 #ifndef __XFS_SCRUB_ATTR_H__
7 #define __XFS_SCRUB_ATTR_H__
9 /*
10 * Temporary storage for online scrub and repair of extended attributes.
12 struct xchk_xattr_buf {
13 /* Size of @buf, in bytes. */
14 size_t sz;
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.
27 uint8_t buf[0];
30 /* A place to store attribute values. */
31 static inline uint8_t *
32 xchk_xattr_valuebuf(
33 struct xfs_scrub *sc)
35 struct xchk_xattr_buf *ab = sc->buf;
37 return ab->buf;
40 /* A bitmap of space usage computed by walking an attr leaf block. */
41 static inline unsigned long *
42 xchk_xattr_usedmap(
43 struct xfs_scrub *sc)
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 *
52 xchk_xattr_freemap(
53 struct xfs_scrub *sc)
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 *
61 xchk_xattr_dstmap(
62 struct xfs_scrub *sc)
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__ */