0001
0002
0003
0004
0005
0006
0007
0008 #ifndef __XFS_EXTENT_BUSY_H__
0009 #define __XFS_EXTENT_BUSY_H__
0010
0011 struct xfs_mount;
0012 struct xfs_perag;
0013 struct xfs_trans;
0014 struct xfs_alloc_arg;
0015
0016
0017
0018
0019
0020
0021
0022
0023 struct xfs_extent_busy {
0024 struct rb_node rb_node;
0025 struct list_head list;
0026 xfs_agnumber_t agno;
0027 xfs_agblock_t bno;
0028 xfs_extlen_t length;
0029 unsigned int flags;
0030 #define XFS_EXTENT_BUSY_DISCARDED 0x01
0031 #define XFS_EXTENT_BUSY_SKIP_DISCARD 0x02
0032 };
0033
0034 void
0035 xfs_extent_busy_insert(struct xfs_trans *tp, struct xfs_perag *pag,
0036 xfs_agblock_t bno, xfs_extlen_t len, unsigned int flags);
0037
0038 void
0039 xfs_extent_busy_clear(struct xfs_mount *mp, struct list_head *list,
0040 bool do_discard);
0041
0042 int
0043 xfs_extent_busy_search(struct xfs_mount *mp, struct xfs_perag *pag,
0044 xfs_agblock_t bno, xfs_extlen_t len);
0045
0046 void
0047 xfs_extent_busy_reuse(struct xfs_mount *mp, struct xfs_perag *pag,
0048 xfs_agblock_t fbno, xfs_extlen_t flen, bool userdata);
0049
0050 bool
0051 xfs_extent_busy_trim(struct xfs_alloc_arg *args, xfs_agblock_t *bno,
0052 xfs_extlen_t *len, unsigned *busy_gen);
0053
0054 void
0055 xfs_extent_busy_flush(struct xfs_mount *mp, struct xfs_perag *pag,
0056 unsigned busy_gen);
0057
0058 void
0059 xfs_extent_busy_wait_all(struct xfs_mount *mp);
0060
0061 int
0062 xfs_extent_busy_ag_cmp(void *priv, const struct list_head *a,
0063 const struct list_head *b);
0064
0065 static inline void xfs_extent_busy_sort(struct list_head *list)
0066 {
0067 list_sort(NULL, list, xfs_extent_busy_ag_cmp);
0068 }
0069
0070 #endif