root/fs/xfs/libxfs/xfs_rmap_btree.h

/* [<][>][^][v][top][bottom][index][help] */

INCLUDED FROM


   1 // SPDX-License-Identifier: GPL-2.0
   2 /*
   3  * Copyright (c) 2014 Red Hat, Inc.
   4  * All Rights Reserved.
   5  */
   6 #ifndef __XFS_RMAP_BTREE_H__
   7 #define __XFS_RMAP_BTREE_H__
   8 
   9 struct xfs_buf;
  10 struct xfs_btree_cur;
  11 struct xfs_mount;
  12 
  13 /* rmaps only exist on crc enabled filesystems */
  14 #define XFS_RMAP_BLOCK_LEN      XFS_BTREE_SBLOCK_CRC_LEN
  15 
  16 /*
  17  * Record, key, and pointer address macros for btree blocks.
  18  *
  19  * (note that some of these may appear unused, but they are used in userspace)
  20  */
  21 #define XFS_RMAP_REC_ADDR(block, index) \
  22         ((struct xfs_rmap_rec *) \
  23                 ((char *)(block) + XFS_RMAP_BLOCK_LEN + \
  24                  (((index) - 1) * sizeof(struct xfs_rmap_rec))))
  25 
  26 #define XFS_RMAP_KEY_ADDR(block, index) \
  27         ((struct xfs_rmap_key *) \
  28                 ((char *)(block) + XFS_RMAP_BLOCK_LEN + \
  29                  ((index) - 1) * 2 * sizeof(struct xfs_rmap_key)))
  30 
  31 #define XFS_RMAP_HIGH_KEY_ADDR(block, index) \
  32         ((struct xfs_rmap_key *) \
  33                 ((char *)(block) + XFS_RMAP_BLOCK_LEN + \
  34                  sizeof(struct xfs_rmap_key) + \
  35                  ((index) - 1) * 2 * sizeof(struct xfs_rmap_key)))
  36 
  37 #define XFS_RMAP_PTR_ADDR(block, index, maxrecs) \
  38         ((xfs_rmap_ptr_t *) \
  39                 ((char *)(block) + XFS_RMAP_BLOCK_LEN + \
  40                  (maxrecs) * 2 * sizeof(struct xfs_rmap_key) + \
  41                  ((index) - 1) * sizeof(xfs_rmap_ptr_t)))
  42 
  43 struct xfs_btree_cur *xfs_rmapbt_init_cursor(struct xfs_mount *mp,
  44                                 struct xfs_trans *tp, struct xfs_buf *bp,
  45                                 xfs_agnumber_t agno);
  46 int xfs_rmapbt_maxrecs(int blocklen, int leaf);
  47 extern void xfs_rmapbt_compute_maxlevels(struct xfs_mount *mp);
  48 
  49 extern xfs_extlen_t xfs_rmapbt_calc_size(struct xfs_mount *mp,
  50                 unsigned long long len);
  51 extern xfs_extlen_t xfs_rmapbt_max_size(struct xfs_mount *mp,
  52                 xfs_agblock_t agblocks);
  53 
  54 extern int xfs_rmapbt_calc_reserves(struct xfs_mount *mp, struct xfs_trans *tp,
  55                 xfs_agnumber_t agno, xfs_extlen_t *ask, xfs_extlen_t *used);
  56 
  57 #endif  /* __XFS_RMAP_BTREE_H__ */

/* [<][>][^][v][top][bottom][index][help] */