aboutsummaryrefslogtreecommitdiffstats
path: root/fs/xfs
diff options
context:
space:
mode:
authorChristoph Hellwig <hch@infradead.org>2011-09-18 16:41:07 -0400
committerAlex Elder <aelder@sgi.com>2011-10-11 22:15:07 -0400
commitd952e2f81244d6502aff126df5011fab10f92187 (patch)
tree15503180081395092f0c1395e6403d98c906c143 /fs/xfs
parentb0eab14e74d2d7b22d065e18a1cdebcf7716debf (diff)
xfs: cleanup xfs_bmap.h
Convert all function prototypes to the short form used elsewhere, and remove duplicates of comments already placed at the function body. Signed-off-by: Christoph Hellwig <hch@lst.de> Signed-off-by: Alex Elder <aelder@sgi.com>
Diffstat (limited to 'fs/xfs')
-rw-r--r--fs/xfs/xfs_bmap.h225
1 files changed, 33 insertions, 192 deletions
diff --git a/fs/xfs/xfs_bmap.h b/fs/xfs/xfs_bmap.h
index 243e212b31f6..89ee672d378a 100644
--- a/fs/xfs/xfs_bmap.h
+++ b/fs/xfs/xfs_bmap.h
@@ -155,121 +155,29 @@ typedef struct xfs_bmalloca {
155 { BMAP_RIGHT_FILLING, "RF" }, \ 155 { BMAP_RIGHT_FILLING, "RF" }, \
156 { BMAP_ATTRFORK, "ATTR" } 156 { BMAP_ATTRFORK, "ATTR" }
157 157
158/*
159 * Add bmap trace insert entries for all the contents of the extent list.
160 *
161 * Quite excessive tracing. Only do this for debug builds.
162 */
163#if defined(__KERNEL) && defined(DEBUG) 158#if defined(__KERNEL) && defined(DEBUG)
164void 159void xfs_bmap_trace_exlist(struct xfs_inode *ip, xfs_extnum_t cnt,
165xfs_bmap_trace_exlist( 160 int whichfork, unsigned long caller_ip);
166 struct xfs_inode *ip, /* incore inode pointer */
167 xfs_extnum_t cnt, /* count of entries in list */
168 int whichfork,
169 unsigned long caller_ip); /* data or attr fork */
170#define XFS_BMAP_TRACE_EXLIST(ip,c,w) \ 161#define XFS_BMAP_TRACE_EXLIST(ip,c,w) \
171 xfs_bmap_trace_exlist(ip,c,w, _THIS_IP_) 162 xfs_bmap_trace_exlist(ip,c,w, _THIS_IP_)
172#else 163#else
173#define XFS_BMAP_TRACE_EXLIST(ip,c,w) 164#define XFS_BMAP_TRACE_EXLIST(ip,c,w)
174#endif 165#endif
175 166
176/* 167int xfs_bmap_add_attrfork(struct xfs_inode *ip, int size, int rsvd);
177 * Convert inode from non-attributed to attributed. 168void xfs_bmap_add_free(xfs_fsblock_t bno, xfs_filblks_t len,
178 * Must not be in a transaction, ip must not be locked. 169 struct xfs_bmap_free *flist, struct xfs_mount *mp);
179 */ 170void xfs_bmap_cancel(struct xfs_bmap_free *flist);
180int /* error code */ 171void xfs_bmap_compute_maxlevels(struct xfs_mount *mp, int whichfork);
181xfs_bmap_add_attrfork( 172int xfs_bmap_first_unused(struct xfs_trans *tp, struct xfs_inode *ip,
182 struct xfs_inode *ip, /* incore inode pointer */ 173 xfs_extlen_t len, xfs_fileoff_t *unused, int whichfork);
183 int size, /* space needed for new attribute */ 174int xfs_bmap_last_before(struct xfs_trans *tp, struct xfs_inode *ip,
184 int rsvd); /* flag for reserved block allocation */ 175 xfs_fileoff_t *last_block, int whichfork);
185 176int xfs_bmap_last_offset(struct xfs_trans *tp, struct xfs_inode *ip,
186/* 177 xfs_fileoff_t *unused, int whichfork);
187 * Add the extent to the list of extents to be free at transaction end. 178int xfs_bmap_one_block(struct xfs_inode *ip, int whichfork);
188 * The list is maintained sorted (by block number). 179int xfs_bmap_read_extents(struct xfs_trans *tp, struct xfs_inode *ip,
189 */ 180 int whichfork);
190void
191xfs_bmap_add_free(
192 xfs_fsblock_t bno, /* fs block number of extent */
193 xfs_filblks_t len, /* length of extent */
194 xfs_bmap_free_t *flist, /* list of extents */
195 struct xfs_mount *mp); /* mount point structure */
196
197/*
198 * Routine to clean up the free list data structure when
199 * an error occurs during a transaction.
200 */
201void
202xfs_bmap_cancel(
203 xfs_bmap_free_t *flist); /* free list to clean up */
204
205/*
206 * Compute and fill in the value of the maximum depth of a bmap btree
207 * in this filesystem. Done once, during mount.
208 */
209void
210xfs_bmap_compute_maxlevels(
211 struct xfs_mount *mp, /* file system mount structure */
212 int whichfork); /* data or attr fork */
213
214/*
215 * Returns the file-relative block number of the first unused block in the file.
216 * This is the lowest-address hole if the file has holes, else the first block
217 * past the end of file.
218 */
219int /* error */
220xfs_bmap_first_unused(
221 struct xfs_trans *tp, /* transaction pointer */
222 struct xfs_inode *ip, /* incore inode */
223 xfs_extlen_t len, /* size of hole to find */
224 xfs_fileoff_t *unused, /* unused block num */
225 int whichfork); /* data or attr fork */
226
227/*
228 * Returns the file-relative block number of the last block + 1 before
229 * last_block (input value) in the file.
230 * This is not based on i_size, it is based on the extent list.
231 * Returns 0 for local files, as they do not have an extent list.
232 */
233int /* error */
234xfs_bmap_last_before(
235 struct xfs_trans *tp, /* transaction pointer */
236 struct xfs_inode *ip, /* incore inode */
237 xfs_fileoff_t *last_block, /* last block */
238 int whichfork); /* data or attr fork */
239
240/*
241 * Returns the file-relative block number of the first block past eof in
242 * the file. This is not based on i_size, it is based on the extent list.
243 * Returns 0 for local files, as they do not have an extent list.
244 */
245int /* error */
246xfs_bmap_last_offset(
247 struct xfs_trans *tp, /* transaction pointer */
248 struct xfs_inode *ip, /* incore inode */
249 xfs_fileoff_t *unused, /* last block num */
250 int whichfork); /* data or attr fork */
251
252/*
253 * Returns whether the selected fork of the inode has exactly one
254 * block or not. For the data fork we check this matches di_size,
255 * implying the file's range is 0..bsize-1.
256 */
257int
258xfs_bmap_one_block(
259 struct xfs_inode *ip, /* incore inode */
260 int whichfork); /* data or attr fork */
261
262/*
263 * Read in the extents to iu_extents.
264 * All inode fields are set up by caller, we just traverse the btree
265 * and copy the records in.
266 */
267int /* error */
268xfs_bmap_read_extents(
269 struct xfs_trans *tp, /* transaction pointer */
270 struct xfs_inode *ip, /* incore inode */
271 int whichfork); /* data or attr fork */
272
273int xfs_bmapi_read(struct xfs_inode *ip, xfs_fileoff_t bno, 181int xfs_bmapi_read(struct xfs_inode *ip, xfs_fileoff_t bno,
274 xfs_filblks_t len, struct xfs_bmbt_irec *mval, 182 xfs_filblks_t len, struct xfs_bmbt_irec *mval,
275 int *nmap, int flags); 183 int *nmap, int flags);
@@ -281,95 +189,28 @@ int xfs_bmapi_write(struct xfs_trans *tp, struct xfs_inode *ip,
281 xfs_fsblock_t *firstblock, xfs_extlen_t total, 189 xfs_fsblock_t *firstblock, xfs_extlen_t total,
282 struct xfs_bmbt_irec *mval, int *nmap, 190 struct xfs_bmbt_irec *mval, int *nmap,
283 struct xfs_bmap_free *flist); 191 struct xfs_bmap_free *flist);
284 192int xfs_bunmapi(struct xfs_trans *tp, struct xfs_inode *ip,
285/* 193 xfs_fileoff_t bno, xfs_filblks_t len, int flags,
286 * Unmap (remove) blocks from a file. 194 xfs_extnum_t nexts, xfs_fsblock_t *firstblock,
287 * If nexts is nonzero then the number of extents to remove is limited to 195 struct xfs_bmap_free *flist, int *done);
288 * that value. If not all extents in the block range can be removed then 196int xfs_check_nostate_extents(struct xfs_ifork *ifp, xfs_extnum_t idx,
289 * *done is set. 197 xfs_extnum_t num);
290 */ 198uint xfs_default_attroffset(struct xfs_inode *ip);
291int /* error */
292xfs_bunmapi(
293 struct xfs_trans *tp, /* transaction pointer */
294 struct xfs_inode *ip, /* incore inode */
295 xfs_fileoff_t bno, /* starting offset to unmap */
296 xfs_filblks_t len, /* length to unmap in file */
297 int flags, /* XFS_BMAPI_... */
298 xfs_extnum_t nexts, /* number of extents max */
299 xfs_fsblock_t *firstblock, /* first allocated block
300 controls a.g. for allocs */
301 xfs_bmap_free_t *flist, /* i/o: list extents to free */
302 int *done); /* set if not done yet */
303
304/*
305 * Check an extent list, which has just been read, for
306 * any bit in the extent flag field.
307 */
308int
309xfs_check_nostate_extents(
310 struct xfs_ifork *ifp,
311 xfs_extnum_t idx,
312 xfs_extnum_t num);
313
314uint
315xfs_default_attroffset(
316 struct xfs_inode *ip);
317 199
318#ifdef __KERNEL__ 200#ifdef __KERNEL__
319
320/*
321 * Routine to be called at transaction's end by xfs_bmapi, xfs_bunmapi
322 * caller. Frees all the extents that need freeing, which must be done
323 * last due to locking considerations.
324 *
325 * Return 1 if the given transaction was committed and a new one allocated,
326 * and 0 otherwise.
327 */
328int /* error */
329xfs_bmap_finish(
330 struct xfs_trans **tp, /* transaction pointer addr */
331 xfs_bmap_free_t *flist, /* i/o: list extents to free */
332 int *committed); /* xact committed or not */
333
334/* bmap to userspace formatter - copy to user & advance pointer */ 201/* bmap to userspace formatter - copy to user & advance pointer */
335typedef int (*xfs_bmap_format_t)(void **, struct getbmapx *, int *); 202typedef int (*xfs_bmap_format_t)(void **, struct getbmapx *, int *);
336 203
337/* 204int xfs_bmap_finish(struct xfs_trans **tp, struct xfs_bmap_free *flist,
338 * Get inode's extents as described in bmv, and format for output. 205 int *committed);
339 */ 206int xfs_getbmap(struct xfs_inode *ip, struct getbmapx *bmv,
340int /* error code */ 207 xfs_bmap_format_t formatter, void *arg);
341xfs_getbmap( 208int xfs_bmap_eof(struct xfs_inode *ip, xfs_fileoff_t endoff,
342 xfs_inode_t *ip, 209 int whichfork, int *eof);
343 struct getbmapx *bmv, /* user bmap structure */ 210int xfs_bmap_count_blocks(struct xfs_trans *tp, struct xfs_inode *ip,
344 xfs_bmap_format_t formatter, /* format to user */ 211 int whichfork, int *count);
345 void *arg); /* formatter arg */ 212int xfs_bmap_punch_delalloc_range(struct xfs_inode *ip,
346 213 xfs_fileoff_t start_fsb, xfs_fileoff_t length);
347/*
348 * Check if the endoff is outside the last extent. If so the caller will grow
349 * the allocation to a stripe unit boundary
350 */
351int
352xfs_bmap_eof(
353 struct xfs_inode *ip,
354 xfs_fileoff_t endoff,
355 int whichfork,
356 int *eof);
357
358/*
359 * Count fsblocks of the given fork.
360 */
361int
362xfs_bmap_count_blocks(
363 xfs_trans_t *tp,
364 struct xfs_inode *ip,
365 int whichfork,
366 int *count);
367
368int
369xfs_bmap_punch_delalloc_range(
370 struct xfs_inode *ip,
371 xfs_fileoff_t start_fsb,
372 xfs_fileoff_t length);
373#endif /* __KERNEL__ */ 214#endif /* __KERNEL__ */
374 215
375#endif /* __XFS_BMAP_H__ */ 216#endif /* __XFS_BMAP_H__ */