Orange Pi5 kernel

Deprecated Linux kernel 5.10.110 for OrangePi 5/5B/5+ boards

3 Commits   0 Branches   0 Tags
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  1) /* SPDX-License-Identifier: GPL-2.0-or-later */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  2) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  3)  * Copyright (C) 2019 Oracle.  All Rights Reserved.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  4)  * Author: Darrick J. Wong <darrick.wong@oracle.com>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  5)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  6) #ifndef __XFS_SCRUB_ATTR_H__
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  7) #define __XFS_SCRUB_ATTR_H__
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  8) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  9) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 10)  * Temporary storage for online scrub and repair of extended attributes.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 11)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 12) struct xchk_xattr_buf {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 13) 	/* Size of @buf, in bytes. */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 14) 	size_t			sz;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 15) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 16) 	/*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 17) 	 * Memory buffer -- either used for extracting attr values while
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 18) 	 * walking the attributes; or for computing attr block bitmaps when
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 19) 	 * checking the attribute tree.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 20) 	 *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 21) 	 * Each bitmap contains enough bits to track every byte in an attr
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 22) 	 * block (rounded up to the size of an unsigned long).  The attr block
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 23) 	 * used space bitmap starts at the beginning of the buffer; the free
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 24) 	 * space bitmap follows immediately after; and we have a third buffer
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 25) 	 * for storing intermediate bitmap results.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 26) 	 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 27) 	uint8_t			buf[0];
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 28) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 29) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 30) /* A place to store attribute values. */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 31) static inline uint8_t *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 32) xchk_xattr_valuebuf(
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 33) 	struct xfs_scrub	*sc)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 34) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 35) 	struct xchk_xattr_buf	*ab = sc->buf;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 36) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 37) 	return ab->buf;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 38) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 39) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 40) /* A bitmap of space usage computed by walking an attr leaf block. */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 41) static inline unsigned long *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 42) xchk_xattr_usedmap(
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 43) 	struct xfs_scrub	*sc)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 44) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 45) 	struct xchk_xattr_buf	*ab = sc->buf;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 46) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 47) 	return (unsigned long *)ab->buf;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 48) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 49) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 50) /* A bitmap of free space computed by walking attr leaf block free info. */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 51) static inline unsigned long *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 52) xchk_xattr_freemap(
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 53) 	struct xfs_scrub	*sc)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 54) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 55) 	return xchk_xattr_usedmap(sc) +
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 56) 			BITS_TO_LONGS(sc->mp->m_attr_geo->blksize);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 57) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 58) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 59) /* A bitmap used to hold temporary results. */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 60) static inline unsigned long *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 61) xchk_xattr_dstmap(
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 62) 	struct xfs_scrub	*sc)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 63) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 64) 	return xchk_xattr_freemap(sc) +
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 65) 			BITS_TO_LONGS(sc->mp->m_attr_geo->blksize);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 66) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 67) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 68) int xchk_setup_xattr_buf(struct xfs_scrub *sc, size_t value_size,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 69) 		xfs_km_flags_t flags);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 70) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 71) #endif	/* __XFS_SCRUB_ATTR_H__ */