diff options
author | Glenn Elliott <gelliott@cs.unc.edu> | 2012-03-04 19:47:13 -0500 |
---|---|---|
committer | Glenn Elliott <gelliott@cs.unc.edu> | 2012-03-04 19:47:13 -0500 |
commit | c71c03bda1e86c9d5198c5d83f712e695c4f2a1e (patch) | |
tree | ecb166cb3e2b7e2adb3b5e292245fefd23381ac8 /fs/xfs/xfs_alloc.h | |
parent | ea53c912f8a86a8567697115b6a0d8152beee5c8 (diff) | |
parent | 6a00f206debf8a5c8899055726ad127dbeeed098 (diff) |
Merge branch 'mpi-master' into wip-k-fmlpwip-k-fmlp
Conflicts:
litmus/sched_cedf.c
Diffstat (limited to 'fs/xfs/xfs_alloc.h')
-rw-r--r-- | fs/xfs/xfs_alloc.h | 55 |
1 files changed, 50 insertions, 5 deletions
diff --git a/fs/xfs/xfs_alloc.h b/fs/xfs/xfs_alloc.h index 895009a97271..2f52b924be79 100644 --- a/fs/xfs/xfs_alloc.h +++ b/fs/xfs/xfs_alloc.h | |||
@@ -19,6 +19,7 @@ | |||
19 | #define __XFS_ALLOC_H__ | 19 | #define __XFS_ALLOC_H__ |
20 | 20 | ||
21 | struct xfs_buf; | 21 | struct xfs_buf; |
22 | struct xfs_btree_cur; | ||
22 | struct xfs_mount; | 23 | struct xfs_mount; |
23 | struct xfs_perag; | 24 | struct xfs_perag; |
24 | struct xfs_trans; | 25 | struct xfs_trans; |
@@ -74,6 +75,22 @@ typedef unsigned int xfs_alloctype_t; | |||
74 | #define XFS_ALLOC_SET_ASIDE(mp) (4 + ((mp)->m_sb.sb_agcount * 4)) | 75 | #define XFS_ALLOC_SET_ASIDE(mp) (4 + ((mp)->m_sb.sb_agcount * 4)) |
75 | 76 | ||
76 | /* | 77 | /* |
78 | * When deciding how much space to allocate out of an AG, we limit the | ||
79 | * allocation maximum size to the size the AG. However, we cannot use all the | ||
80 | * blocks in the AG - some are permanently used by metadata. These | ||
81 | * blocks are generally: | ||
82 | * - the AG superblock, AGF, AGI and AGFL | ||
83 | * - the AGF (bno and cnt) and AGI btree root blocks | ||
84 | * - 4 blocks on the AGFL according to XFS_ALLOC_SET_ASIDE() limits | ||
85 | * | ||
86 | * The AG headers are sector sized, so the amount of space they take up is | ||
87 | * dependent on filesystem geometry. The others are all single blocks. | ||
88 | */ | ||
89 | #define XFS_ALLOC_AG_MAX_USABLE(mp) \ | ||
90 | ((mp)->m_sb.sb_agblocks - XFS_BB_TO_FSB(mp, XFS_FSS_TO_BB(mp, 4)) - 7) | ||
91 | |||
92 | |||
93 | /* | ||
77 | * Argument structure for xfs_alloc routines. | 94 | * Argument structure for xfs_alloc routines. |
78 | * This is turned into a structure to avoid having 20 arguments passed | 95 | * This is turned into a structure to avoid having 20 arguments passed |
79 | * down several levels of the stack. | 96 | * down several levels of the stack. |
@@ -118,15 +135,29 @@ xfs_alloc_longest_free_extent(struct xfs_mount *mp, | |||
118 | struct xfs_perag *pag); | 135 | struct xfs_perag *pag); |
119 | 136 | ||
120 | #ifdef __KERNEL__ | 137 | #ifdef __KERNEL__ |
138 | void | ||
139 | xfs_alloc_busy_insert(struct xfs_trans *tp, xfs_agnumber_t agno, | ||
140 | xfs_agblock_t bno, xfs_extlen_t len, unsigned int flags); | ||
121 | 141 | ||
122 | void | 142 | void |
123 | xfs_alloc_busy_insert(xfs_trans_t *tp, | 143 | xfs_alloc_busy_clear(struct xfs_mount *mp, struct list_head *list, |
124 | xfs_agnumber_t agno, | 144 | bool do_discard); |
125 | xfs_agblock_t bno, | 145 | |
126 | xfs_extlen_t len); | 146 | int |
147 | xfs_alloc_busy_search(struct xfs_mount *mp, xfs_agnumber_t agno, | ||
148 | xfs_agblock_t bno, xfs_extlen_t len); | ||
127 | 149 | ||
128 | void | 150 | void |
129 | xfs_alloc_busy_clear(struct xfs_mount *mp, struct xfs_busy_extent *busyp); | 151 | xfs_alloc_busy_reuse(struct xfs_mount *mp, xfs_agnumber_t agno, |
152 | xfs_agblock_t fbno, xfs_extlen_t flen, bool userdata); | ||
153 | |||
154 | int | ||
155 | xfs_busy_extent_ag_cmp(void *priv, struct list_head *a, struct list_head *b); | ||
156 | |||
157 | static inline void xfs_alloc_busy_sort(struct list_head *list) | ||
158 | { | ||
159 | list_sort(NULL, list, xfs_busy_extent_ag_cmp); | ||
160 | } | ||
130 | 161 | ||
131 | #endif /* __KERNEL__ */ | 162 | #endif /* __KERNEL__ */ |
132 | 163 | ||
@@ -205,4 +236,18 @@ xfs_free_extent( | |||
205 | xfs_fsblock_t bno, /* starting block number of extent */ | 236 | xfs_fsblock_t bno, /* starting block number of extent */ |
206 | xfs_extlen_t len); /* length of extent */ | 237 | xfs_extlen_t len); /* length of extent */ |
207 | 238 | ||
239 | int /* error */ | ||
240 | xfs_alloc_lookup_le( | ||
241 | struct xfs_btree_cur *cur, /* btree cursor */ | ||
242 | xfs_agblock_t bno, /* starting block of extent */ | ||
243 | xfs_extlen_t len, /* length of extent */ | ||
244 | int *stat); /* success/failure */ | ||
245 | |||
246 | int /* error */ | ||
247 | xfs_alloc_get_rec( | ||
248 | struct xfs_btree_cur *cur, /* btree cursor */ | ||
249 | xfs_agblock_t *bno, /* output: starting block of extent */ | ||
250 | xfs_extlen_t *len, /* output: length of extent */ | ||
251 | int *stat); /* output: success/failure */ | ||
252 | |||
208 | #endif /* __XFS_ALLOC_H__ */ | 253 | #endif /* __XFS_ALLOC_H__ */ |