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>
This commit is contained in:
parent
b0eab14e74
commit
d952e2f812
1 changed files with 33 additions and 192 deletions
|
@ -155,121 +155,29 @@ typedef struct xfs_bmalloca {
|
||||||
{ BMAP_RIGHT_FILLING, "RF" }, \
|
{ BMAP_RIGHT_FILLING, "RF" }, \
|
||||||
{ BMAP_ATTRFORK, "ATTR" }
|
{ BMAP_ATTRFORK, "ATTR" }
|
||||||
|
|
||||||
/*
|
|
||||||
* Add bmap trace insert entries for all the contents of the extent list.
|
|
||||||
*
|
|
||||||
* Quite excessive tracing. Only do this for debug builds.
|
|
||||||
*/
|
|
||||||
#if defined(__KERNEL) && defined(DEBUG)
|
#if defined(__KERNEL) && defined(DEBUG)
|
||||||
void
|
void xfs_bmap_trace_exlist(struct xfs_inode *ip, xfs_extnum_t cnt,
|
||||||
xfs_bmap_trace_exlist(
|
int whichfork, unsigned long caller_ip);
|
||||||
struct xfs_inode *ip, /* incore inode pointer */
|
|
||||||
xfs_extnum_t cnt, /* count of entries in list */
|
|
||||||
int whichfork,
|
|
||||||
unsigned long caller_ip); /* data or attr fork */
|
|
||||||
#define XFS_BMAP_TRACE_EXLIST(ip,c,w) \
|
#define XFS_BMAP_TRACE_EXLIST(ip,c,w) \
|
||||||
xfs_bmap_trace_exlist(ip,c,w, _THIS_IP_)
|
xfs_bmap_trace_exlist(ip,c,w, _THIS_IP_)
|
||||||
#else
|
#else
|
||||||
#define XFS_BMAP_TRACE_EXLIST(ip,c,w)
|
#define XFS_BMAP_TRACE_EXLIST(ip,c,w)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/*
|
int xfs_bmap_add_attrfork(struct xfs_inode *ip, int size, int rsvd);
|
||||||
* Convert inode from non-attributed to attributed.
|
void xfs_bmap_add_free(xfs_fsblock_t bno, xfs_filblks_t len,
|
||||||
* Must not be in a transaction, ip must not be locked.
|
struct xfs_bmap_free *flist, struct xfs_mount *mp);
|
||||||
*/
|
void xfs_bmap_cancel(struct xfs_bmap_free *flist);
|
||||||
int /* error code */
|
void xfs_bmap_compute_maxlevels(struct xfs_mount *mp, int whichfork);
|
||||||
xfs_bmap_add_attrfork(
|
int xfs_bmap_first_unused(struct xfs_trans *tp, struct xfs_inode *ip,
|
||||||
struct xfs_inode *ip, /* incore inode pointer */
|
xfs_extlen_t len, xfs_fileoff_t *unused, int whichfork);
|
||||||
int size, /* space needed for new attribute */
|
int xfs_bmap_last_before(struct xfs_trans *tp, struct xfs_inode *ip,
|
||||||
int rsvd); /* flag for reserved block allocation */
|
xfs_fileoff_t *last_block, int whichfork);
|
||||||
|
int xfs_bmap_last_offset(struct xfs_trans *tp, struct xfs_inode *ip,
|
||||||
/*
|
xfs_fileoff_t *unused, int whichfork);
|
||||||
* Add the extent to the list of extents to be free at transaction end.
|
int xfs_bmap_one_block(struct xfs_inode *ip, int whichfork);
|
||||||
* The list is maintained sorted (by block number).
|
int xfs_bmap_read_extents(struct xfs_trans *tp, struct xfs_inode *ip,
|
||||||
*/
|
int whichfork);
|
||||||
void
|
|
||||||
xfs_bmap_add_free(
|
|
||||||
xfs_fsblock_t bno, /* fs block number of extent */
|
|
||||||
xfs_filblks_t len, /* length of extent */
|
|
||||||
xfs_bmap_free_t *flist, /* list of extents */
|
|
||||||
struct xfs_mount *mp); /* mount point structure */
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Routine to clean up the free list data structure when
|
|
||||||
* an error occurs during a transaction.
|
|
||||||
*/
|
|
||||||
void
|
|
||||||
xfs_bmap_cancel(
|
|
||||||
xfs_bmap_free_t *flist); /* free list to clean up */
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Compute and fill in the value of the maximum depth of a bmap btree
|
|
||||||
* in this filesystem. Done once, during mount.
|
|
||||||
*/
|
|
||||||
void
|
|
||||||
xfs_bmap_compute_maxlevels(
|
|
||||||
struct xfs_mount *mp, /* file system mount structure */
|
|
||||||
int whichfork); /* data or attr fork */
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Returns the file-relative block number of the first unused block in the file.
|
|
||||||
* This is the lowest-address hole if the file has holes, else the first block
|
|
||||||
* past the end of file.
|
|
||||||
*/
|
|
||||||
int /* error */
|
|
||||||
xfs_bmap_first_unused(
|
|
||||||
struct xfs_trans *tp, /* transaction pointer */
|
|
||||||
struct xfs_inode *ip, /* incore inode */
|
|
||||||
xfs_extlen_t len, /* size of hole to find */
|
|
||||||
xfs_fileoff_t *unused, /* unused block num */
|
|
||||||
int whichfork); /* data or attr fork */
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Returns the file-relative block number of the last block + 1 before
|
|
||||||
* last_block (input value) in the file.
|
|
||||||
* This is not based on i_size, it is based on the extent list.
|
|
||||||
* Returns 0 for local files, as they do not have an extent list.
|
|
||||||
*/
|
|
||||||
int /* error */
|
|
||||||
xfs_bmap_last_before(
|
|
||||||
struct xfs_trans *tp, /* transaction pointer */
|
|
||||||
struct xfs_inode *ip, /* incore inode */
|
|
||||||
xfs_fileoff_t *last_block, /* last block */
|
|
||||||
int whichfork); /* data or attr fork */
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Returns the file-relative block number of the first block past eof in
|
|
||||||
* the file. This is not based on i_size, it is based on the extent list.
|
|
||||||
* Returns 0 for local files, as they do not have an extent list.
|
|
||||||
*/
|
|
||||||
int /* error */
|
|
||||||
xfs_bmap_last_offset(
|
|
||||||
struct xfs_trans *tp, /* transaction pointer */
|
|
||||||
struct xfs_inode *ip, /* incore inode */
|
|
||||||
xfs_fileoff_t *unused, /* last block num */
|
|
||||||
int whichfork); /* data or attr fork */
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Returns whether the selected fork of the inode has exactly one
|
|
||||||
* block or not. For the data fork we check this matches di_size,
|
|
||||||
* implying the file's range is 0..bsize-1.
|
|
||||||
*/
|
|
||||||
int
|
|
||||||
xfs_bmap_one_block(
|
|
||||||
struct xfs_inode *ip, /* incore inode */
|
|
||||||
int whichfork); /* data or attr fork */
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Read in the extents to iu_extents.
|
|
||||||
* All inode fields are set up by caller, we just traverse the btree
|
|
||||||
* and copy the records in.
|
|
||||||
*/
|
|
||||||
int /* error */
|
|
||||||
xfs_bmap_read_extents(
|
|
||||||
struct xfs_trans *tp, /* transaction pointer */
|
|
||||||
struct xfs_inode *ip, /* incore inode */
|
|
||||||
int whichfork); /* data or attr fork */
|
|
||||||
|
|
||||||
int xfs_bmapi_read(struct xfs_inode *ip, xfs_fileoff_t bno,
|
int xfs_bmapi_read(struct xfs_inode *ip, xfs_fileoff_t bno,
|
||||||
xfs_filblks_t len, struct xfs_bmbt_irec *mval,
|
xfs_filblks_t len, struct xfs_bmbt_irec *mval,
|
||||||
int *nmap, int flags);
|
int *nmap, int flags);
|
||||||
|
@ -281,95 +189,28 @@ int xfs_bmapi_write(struct xfs_trans *tp, struct xfs_inode *ip,
|
||||||
xfs_fsblock_t *firstblock, xfs_extlen_t total,
|
xfs_fsblock_t *firstblock, xfs_extlen_t total,
|
||||||
struct xfs_bmbt_irec *mval, int *nmap,
|
struct xfs_bmbt_irec *mval, int *nmap,
|
||||||
struct xfs_bmap_free *flist);
|
struct xfs_bmap_free *flist);
|
||||||
|
int xfs_bunmapi(struct xfs_trans *tp, struct xfs_inode *ip,
|
||||||
/*
|
xfs_fileoff_t bno, xfs_filblks_t len, int flags,
|
||||||
* Unmap (remove) blocks from a file.
|
xfs_extnum_t nexts, xfs_fsblock_t *firstblock,
|
||||||
* If nexts is nonzero then the number of extents to remove is limited to
|
struct xfs_bmap_free *flist, int *done);
|
||||||
* that value. If not all extents in the block range can be removed then
|
int xfs_check_nostate_extents(struct xfs_ifork *ifp, xfs_extnum_t idx,
|
||||||
* *done is set.
|
|
||||||
*/
|
|
||||||
int /* error */
|
|
||||||
xfs_bunmapi(
|
|
||||||
struct xfs_trans *tp, /* transaction pointer */
|
|
||||||
struct xfs_inode *ip, /* incore inode */
|
|
||||||
xfs_fileoff_t bno, /* starting offset to unmap */
|
|
||||||
xfs_filblks_t len, /* length to unmap in file */
|
|
||||||
int flags, /* XFS_BMAPI_... */
|
|
||||||
xfs_extnum_t nexts, /* number of extents max */
|
|
||||||
xfs_fsblock_t *firstblock, /* first allocated block
|
|
||||||
controls a.g. for allocs */
|
|
||||||
xfs_bmap_free_t *flist, /* i/o: list extents to free */
|
|
||||||
int *done); /* set if not done yet */
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Check an extent list, which has just been read, for
|
|
||||||
* any bit in the extent flag field.
|
|
||||||
*/
|
|
||||||
int
|
|
||||||
xfs_check_nostate_extents(
|
|
||||||
struct xfs_ifork *ifp,
|
|
||||||
xfs_extnum_t idx,
|
|
||||||
xfs_extnum_t num);
|
xfs_extnum_t num);
|
||||||
|
uint xfs_default_attroffset(struct xfs_inode *ip);
|
||||||
uint
|
|
||||||
xfs_default_attroffset(
|
|
||||||
struct xfs_inode *ip);
|
|
||||||
|
|
||||||
#ifdef __KERNEL__
|
#ifdef __KERNEL__
|
||||||
|
|
||||||
/*
|
|
||||||
* Routine to be called at transaction's end by xfs_bmapi, xfs_bunmapi
|
|
||||||
* caller. Frees all the extents that need freeing, which must be done
|
|
||||||
* last due to locking considerations.
|
|
||||||
*
|
|
||||||
* Return 1 if the given transaction was committed and a new one allocated,
|
|
||||||
* and 0 otherwise.
|
|
||||||
*/
|
|
||||||
int /* error */
|
|
||||||
xfs_bmap_finish(
|
|
||||||
struct xfs_trans **tp, /* transaction pointer addr */
|
|
||||||
xfs_bmap_free_t *flist, /* i/o: list extents to free */
|
|
||||||
int *committed); /* xact committed or not */
|
|
||||||
|
|
||||||
/* bmap to userspace formatter - copy to user & advance pointer */
|
/* bmap to userspace formatter - copy to user & advance pointer */
|
||||||
typedef int (*xfs_bmap_format_t)(void **, struct getbmapx *, int *);
|
typedef int (*xfs_bmap_format_t)(void **, struct getbmapx *, int *);
|
||||||
|
|
||||||
/*
|
int xfs_bmap_finish(struct xfs_trans **tp, struct xfs_bmap_free *flist,
|
||||||
* Get inode's extents as described in bmv, and format for output.
|
int *committed);
|
||||||
*/
|
int xfs_getbmap(struct xfs_inode *ip, struct getbmapx *bmv,
|
||||||
int /* error code */
|
xfs_bmap_format_t formatter, void *arg);
|
||||||
xfs_getbmap(
|
int xfs_bmap_eof(struct xfs_inode *ip, xfs_fileoff_t endoff,
|
||||||
xfs_inode_t *ip,
|
int whichfork, int *eof);
|
||||||
struct getbmapx *bmv, /* user bmap structure */
|
int xfs_bmap_count_blocks(struct xfs_trans *tp, struct xfs_inode *ip,
|
||||||
xfs_bmap_format_t formatter, /* format to user */
|
int whichfork, int *count);
|
||||||
void *arg); /* formatter arg */
|
int xfs_bmap_punch_delalloc_range(struct xfs_inode *ip,
|
||||||
|
xfs_fileoff_t start_fsb, xfs_fileoff_t length);
|
||||||
/*
|
|
||||||
* Check if the endoff is outside the last extent. If so the caller will grow
|
|
||||||
* the allocation to a stripe unit boundary
|
|
||||||
*/
|
|
||||||
int
|
|
||||||
xfs_bmap_eof(
|
|
||||||
struct xfs_inode *ip,
|
|
||||||
xfs_fileoff_t endoff,
|
|
||||||
int whichfork,
|
|
||||||
int *eof);
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Count fsblocks of the given fork.
|
|
||||||
*/
|
|
||||||
int
|
|
||||||
xfs_bmap_count_blocks(
|
|
||||||
xfs_trans_t *tp,
|
|
||||||
struct xfs_inode *ip,
|
|
||||||
int whichfork,
|
|
||||||
int *count);
|
|
||||||
|
|
||||||
int
|
|
||||||
xfs_bmap_punch_delalloc_range(
|
|
||||||
struct xfs_inode *ip,
|
|
||||||
xfs_fileoff_t start_fsb,
|
|
||||||
xfs_fileoff_t length);
|
|
||||||
#endif /* __KERNEL__ */
|
#endif /* __KERNEL__ */
|
||||||
|
|
||||||
#endif /* __XFS_BMAP_H__ */
|
#endif /* __XFS_BMAP_H__ */
|
||||||
|
|
Loading…
Reference in a new issue