KVM: PPC: Book3S: Fix compile error that occurs with some gcc versions
[linux/fpc-iii.git] / fs / xfs / libxfs / xfs_refcount_btree.h
blob9db008b955b7ed68bb62d8654073da0302668171
1 /*
2 * Copyright (C) 2016 Oracle. All Rights Reserved.
4 * Author: Darrick J. Wong <darrick.wong@oracle.com>
6 * This program is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU General Public License
8 * as published by the Free Software Foundation; either version 2
9 * of the License, or (at your option) any later version.
11 * This program is distributed in the hope that it would be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, write the Free Software Foundation,
18 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
20 #ifndef __XFS_REFCOUNT_BTREE_H__
21 #define __XFS_REFCOUNT_BTREE_H__
24 * Reference Count Btree on-disk structures
27 struct xfs_buf;
28 struct xfs_btree_cur;
29 struct xfs_mount;
32 * Btree block header size
34 #define XFS_REFCOUNT_BLOCK_LEN XFS_BTREE_SBLOCK_CRC_LEN
37 * Record, key, and pointer address macros for btree blocks.
39 * (note that some of these may appear unused, but they are used in userspace)
41 #define XFS_REFCOUNT_REC_ADDR(block, index) \
42 ((struct xfs_refcount_rec *) \
43 ((char *)(block) + \
44 XFS_REFCOUNT_BLOCK_LEN + \
45 (((index) - 1) * sizeof(struct xfs_refcount_rec))))
47 #define XFS_REFCOUNT_KEY_ADDR(block, index) \
48 ((struct xfs_refcount_key *) \
49 ((char *)(block) + \
50 XFS_REFCOUNT_BLOCK_LEN + \
51 ((index) - 1) * sizeof(struct xfs_refcount_key)))
53 #define XFS_REFCOUNT_PTR_ADDR(block, index, maxrecs) \
54 ((xfs_refcount_ptr_t *) \
55 ((char *)(block) + \
56 XFS_REFCOUNT_BLOCK_LEN + \
57 (maxrecs) * sizeof(struct xfs_refcount_key) + \
58 ((index) - 1) * sizeof(xfs_refcount_ptr_t)))
60 extern struct xfs_btree_cur *xfs_refcountbt_init_cursor(struct xfs_mount *mp,
61 struct xfs_trans *tp, struct xfs_buf *agbp, xfs_agnumber_t agno,
62 struct xfs_defer_ops *dfops);
63 extern int xfs_refcountbt_maxrecs(struct xfs_mount *mp, int blocklen,
64 bool leaf);
65 extern void xfs_refcountbt_compute_maxlevels(struct xfs_mount *mp);
67 extern xfs_extlen_t xfs_refcountbt_calc_size(struct xfs_mount *mp,
68 unsigned long long len);
69 extern xfs_extlen_t xfs_refcountbt_max_size(struct xfs_mount *mp,
70 xfs_agblock_t agblocks);
72 extern int xfs_refcountbt_calc_reserves(struct xfs_mount *mp,
73 xfs_agnumber_t agno, xfs_extlen_t *ask, xfs_extlen_t *used);
75 #endif /* __XFS_REFCOUNT_BTREE_H__ */