0001
0002
0003
0004
0005
0006 #ifndef __XFS_RTALLOC_H__
0007 #define __XFS_RTALLOC_H__
0008
0009
0010
0011 struct xfs_mount;
0012 struct xfs_trans;
0013
0014
0015
0016
0017
0018
0019 struct xfs_rtalloc_rec {
0020 xfs_rtblock_t ar_startext;
0021 xfs_rtblock_t ar_extcount;
0022 };
0023
0024 typedef int (*xfs_rtalloc_query_range_fn)(
0025 struct xfs_mount *mp,
0026 struct xfs_trans *tp,
0027 const struct xfs_rtalloc_rec *rec,
0028 void *priv);
0029
0030 #ifdef CONFIG_XFS_RT
0031
0032
0033
0034
0035
0036
0037
0038
0039
0040 int
0041 xfs_rtallocate_extent(
0042 struct xfs_trans *tp,
0043 xfs_rtblock_t bno,
0044 xfs_extlen_t minlen,
0045 xfs_extlen_t maxlen,
0046 xfs_extlen_t *len,
0047 int wasdel,
0048 xfs_extlen_t prod,
0049 xfs_rtblock_t *rtblock);
0050
0051
0052
0053
0054
0055 int
0056 xfs_rtfree_extent(
0057 struct xfs_trans *tp,
0058 xfs_rtblock_t bno,
0059 xfs_extlen_t len);
0060
0061
0062
0063
0064 int
0065 xfs_rtmount_init(
0066 struct xfs_mount *mp);
0067 void
0068 xfs_rtunmount_inodes(
0069 struct xfs_mount *mp);
0070
0071
0072
0073
0074
0075 int
0076 xfs_rtmount_inodes(
0077 struct xfs_mount *mp);
0078
0079
0080
0081
0082
0083
0084
0085
0086 int
0087 xfs_rtpick_extent(
0088 struct xfs_mount *mp,
0089 struct xfs_trans *tp,
0090 xfs_extlen_t len,
0091 xfs_rtblock_t *pick);
0092
0093
0094
0095
0096 int
0097 xfs_growfs_rt(
0098 struct xfs_mount *mp,
0099 xfs_growfs_rt_t *in);
0100
0101
0102
0103
0104 int xfs_rtbuf_get(struct xfs_mount *mp, struct xfs_trans *tp,
0105 xfs_rtblock_t block, int issum, struct xfs_buf **bpp);
0106 int xfs_rtcheck_range(struct xfs_mount *mp, struct xfs_trans *tp,
0107 xfs_rtblock_t start, xfs_extlen_t len, int val,
0108 xfs_rtblock_t *new, int *stat);
0109 int xfs_rtfind_back(struct xfs_mount *mp, struct xfs_trans *tp,
0110 xfs_rtblock_t start, xfs_rtblock_t limit,
0111 xfs_rtblock_t *rtblock);
0112 int xfs_rtfind_forw(struct xfs_mount *mp, struct xfs_trans *tp,
0113 xfs_rtblock_t start, xfs_rtblock_t limit,
0114 xfs_rtblock_t *rtblock);
0115 int xfs_rtmodify_range(struct xfs_mount *mp, struct xfs_trans *tp,
0116 xfs_rtblock_t start, xfs_extlen_t len, int val);
0117 int xfs_rtmodify_summary_int(struct xfs_mount *mp, struct xfs_trans *tp,
0118 int log, xfs_rtblock_t bbno, int delta,
0119 struct xfs_buf **rbpp, xfs_fsblock_t *rsb,
0120 xfs_suminfo_t *sum);
0121 int xfs_rtmodify_summary(struct xfs_mount *mp, struct xfs_trans *tp, int log,
0122 xfs_rtblock_t bbno, int delta, struct xfs_buf **rbpp,
0123 xfs_fsblock_t *rsb);
0124 int xfs_rtfree_range(struct xfs_mount *mp, struct xfs_trans *tp,
0125 xfs_rtblock_t start, xfs_extlen_t len,
0126 struct xfs_buf **rbpp, xfs_fsblock_t *rsb);
0127 int xfs_rtalloc_query_range(struct xfs_mount *mp, struct xfs_trans *tp,
0128 const struct xfs_rtalloc_rec *low_rec,
0129 const struct xfs_rtalloc_rec *high_rec,
0130 xfs_rtalloc_query_range_fn fn, void *priv);
0131 int xfs_rtalloc_query_all(struct xfs_mount *mp, struct xfs_trans *tp,
0132 xfs_rtalloc_query_range_fn fn,
0133 void *priv);
0134 bool xfs_verify_rtbno(struct xfs_mount *mp, xfs_rtblock_t rtbno);
0135 int xfs_rtalloc_extent_is_free(struct xfs_mount *mp, struct xfs_trans *tp,
0136 xfs_rtblock_t start, xfs_extlen_t len,
0137 bool *is_free);
0138 int xfs_rtalloc_reinit_frextents(struct xfs_mount *mp);
0139 #else
0140 # define xfs_rtallocate_extent(t,b,min,max,l,f,p,rb) (ENOSYS)
0141 # define xfs_rtfree_extent(t,b,l) (ENOSYS)
0142 # define xfs_rtpick_extent(m,t,l,rb) (ENOSYS)
0143 # define xfs_growfs_rt(mp,in) (ENOSYS)
0144 # define xfs_rtalloc_query_range(t,l,h,f,p) (ENOSYS)
0145 # define xfs_rtalloc_query_all(m,t,f,p) (ENOSYS)
0146 # define xfs_rtbuf_get(m,t,b,i,p) (ENOSYS)
0147 # define xfs_verify_rtbno(m, r) (false)
0148 # define xfs_rtalloc_extent_is_free(m,t,s,l,i) (ENOSYS)
0149 # define xfs_rtalloc_reinit_frextents(m) (0)
0150 static inline int
0151 xfs_rtmount_init(
0152 xfs_mount_t *mp)
0153 {
0154 if (mp->m_sb.sb_rblocks == 0)
0155 return 0;
0156
0157 xfs_warn(mp, "Not built with CONFIG_XFS_RT");
0158 return -ENOSYS;
0159 }
0160 # define xfs_rtmount_inodes(m) (((mp)->m_sb.sb_rblocks == 0)? 0 : (ENOSYS))
0161 # define xfs_rtunmount_inodes(m)
0162 #endif
0163
0164 #endif