![]() |
|
|||
0001 /* SPDX-License-Identifier: GPL-2.0-or-later */ 0002 /* 0003 * Copyright (C) 2019 Oracle. All Rights Reserved. 0004 * Author: Darrick J. Wong <darrick.wong@oracle.com> 0005 */ 0006 #ifndef __XFS_SCRUB_ATTR_H__ 0007 #define __XFS_SCRUB_ATTR_H__ 0008 0009 /* 0010 * Temporary storage for online scrub and repair of extended attributes. 0011 */ 0012 struct xchk_xattr_buf { 0013 /* Size of @buf, in bytes. */ 0014 size_t sz; 0015 0016 /* 0017 * Memory buffer -- either used for extracting attr values while 0018 * walking the attributes; or for computing attr block bitmaps when 0019 * checking the attribute tree. 0020 * 0021 * Each bitmap contains enough bits to track every byte in an attr 0022 * block (rounded up to the size of an unsigned long). The attr block 0023 * used space bitmap starts at the beginning of the buffer; the free 0024 * space bitmap follows immediately after; and we have a third buffer 0025 * for storing intermediate bitmap results. 0026 */ 0027 uint8_t buf[]; 0028 }; 0029 0030 /* A place to store attribute values. */ 0031 static inline uint8_t * 0032 xchk_xattr_valuebuf( 0033 struct xfs_scrub *sc) 0034 { 0035 struct xchk_xattr_buf *ab = sc->buf; 0036 0037 return ab->buf; 0038 } 0039 0040 /* A bitmap of space usage computed by walking an attr leaf block. */ 0041 static inline unsigned long * 0042 xchk_xattr_usedmap( 0043 struct xfs_scrub *sc) 0044 { 0045 struct xchk_xattr_buf *ab = sc->buf; 0046 0047 return (unsigned long *)ab->buf; 0048 } 0049 0050 /* A bitmap of free space computed by walking attr leaf block free info. */ 0051 static inline unsigned long * 0052 xchk_xattr_freemap( 0053 struct xfs_scrub *sc) 0054 { 0055 return xchk_xattr_usedmap(sc) + 0056 BITS_TO_LONGS(sc->mp->m_attr_geo->blksize); 0057 } 0058 0059 /* A bitmap used to hold temporary results. */ 0060 static inline unsigned long * 0061 xchk_xattr_dstmap( 0062 struct xfs_scrub *sc) 0063 { 0064 return xchk_xattr_freemap(sc) + 0065 BITS_TO_LONGS(sc->mp->m_attr_geo->blksize); 0066 } 0067 0068 #endif /* __XFS_SCRUB_ATTR_H__ */
[ Source navigation ] | [ Diff markup ] | [ Identifier search ] | [ general search ] |
This page was automatically generated by the 2.1.0 LXR engine. The LXR team |
![]() ![]() |