Linux Audio

Check our new training course

Loading...
v3.15
  1/*
  2 * Copyright (c) 2000-2006 Silicon Graphics, Inc.
  3 * All Rights Reserved.
  4 *
  5 * This program is free software; you can redistribute it and/or
  6 * modify it under the terms of the GNU General Public License as
  7 * published by the Free Software Foundation.
  8 *
  9 * This program is distributed in the hope that it would be useful,
 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 12 * GNU General Public License for more details.
 13 *
 14 * You should have received a copy of the GNU General Public License
 15 * along with this program; if not, write the Free Software Foundation,
 16 * Inc.,  51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
 17 */
 18#ifndef __XFS_BMAP_UTIL_H__
 19#define	__XFS_BMAP_UTIL_H__
 20
 21/* Kernel only BMAP related definitions and functions */
 22
 23struct xfs_bmbt_irec;
 24struct xfs_bmap_free_item;
 25struct xfs_ifork;
 26struct xfs_inode;
 27struct xfs_mount;
 28struct xfs_trans;
 
 29
 
 
 
 30/*
 31 * Argument structure for xfs_bmap_alloc.
 
 32 */
 33struct xfs_bmalloca {
 34	xfs_fsblock_t		*firstblock; /* i/o first block allocated */
 35	struct xfs_bmap_free	*flist;	/* bmap freelist */
 36	struct xfs_trans	*tp;	/* transaction pointer */
 37	struct xfs_inode	*ip;	/* incore inode pointer */
 38	struct xfs_bmbt_irec	prev;	/* extent before the new one */
 39	struct xfs_bmbt_irec	got;	/* extent after, or delayed */
 40
 41	xfs_fileoff_t		offset;	/* offset in file filling in */
 42	xfs_extlen_t		length;	/* i/o length asked/allocated */
 43	xfs_fsblock_t		blkno;	/* starting block of new extent */
 44
 45	struct xfs_btree_cur	*cur;	/* btree cursor */
 46	xfs_extnum_t		idx;	/* current extent index */
 47	int			nallocs;/* number of extents alloc'd */
 48	int			logflags;/* flags for transaction logging */
 49
 50	xfs_extlen_t		total;	/* total blocks needed for xaction */
 51	xfs_extlen_t		minlen;	/* minimum allocation size (blocks) */
 52	xfs_extlen_t		minleft; /* amount must be left after alloc */
 53	char			eof;	/* set if allocating past last extent */
 54	char			wasdel;	/* replacing a delayed allocation */
 55	char			userdata;/* set if is user data */
 56	char			aeof;	/* allocated space at eof */
 57	char			conv;	/* overwriting unwritten extents */
 58	char			stack_switch;
 59	int			flags;
 60	struct completion	*done;
 61	struct work_struct	work;
 62	int			result;
 63};
 64
 65int	xfs_bmap_finish(struct xfs_trans **tp, struct xfs_bmap_free *flist,
 66			int *committed);
 67int	xfs_bmap_rtalloc(struct xfs_bmalloca *ap);
 68int	xfs_bmapi_allocate(struct xfs_bmalloca *args);
 69int	__xfs_bmapi_allocate(struct xfs_bmalloca *args);
 70int	xfs_bmap_eof(struct xfs_inode *ip, xfs_fileoff_t endoff,
 71		     int whichfork, int *eof);
 72int	xfs_bmap_count_blocks(struct xfs_trans *tp, struct xfs_inode *ip,
 73			      int whichfork, int *count);
 74int	xfs_bmap_punch_delalloc_range(struct xfs_inode *ip,
 75		xfs_fileoff_t start_fsb, xfs_fileoff_t length);
 76
 77/* bmap to userspace formatter - copy to user & advance pointer */
 78typedef int (*xfs_bmap_format_t)(void **, struct getbmapx *, int *);
 
 
 
 
 79int	xfs_getbmap(struct xfs_inode *ip, struct getbmapx *bmv,
 80		xfs_bmap_format_t formatter, void *arg);
 81
 82/* functions in xfs_bmap.c that are only needed by xfs_bmap_util.c */
 83void	xfs_bmap_del_free(struct xfs_bmap_free *flist,
 84			  struct xfs_bmap_free_item *prev,
 85			  struct xfs_bmap_free_item *free);
 86int	xfs_bmap_extsize_align(struct xfs_mount *mp, struct xfs_bmbt_irec *gotp,
 87			       struct xfs_bmbt_irec *prevp, xfs_extlen_t extsz,
 88			       int rt, int eof, int delay, int convert,
 89			       xfs_fileoff_t *offp, xfs_extlen_t *lenp);
 90void	xfs_bmap_adjacent(struct xfs_bmalloca *ap);
 91int	xfs_bmap_last_extent(struct xfs_trans *tp, struct xfs_inode *ip,
 92			     int whichfork, struct xfs_bmbt_irec *rec,
 93			     int *is_empty);
 94
 95/* preallocation and hole punch interface */
 96int	xfs_alloc_file_space(struct xfs_inode *ip, xfs_off_t offset,
 97			     xfs_off_t len, int alloc_type);
 98int	xfs_free_file_space(struct xfs_inode *ip, xfs_off_t offset,
 99			    xfs_off_t len);
100int	xfs_zero_file_space(struct xfs_inode *ip, xfs_off_t offset,
101			    xfs_off_t len);
102int	xfs_collapse_file_space(struct xfs_inode *, xfs_off_t offset,
103				xfs_off_t len);
 
 
104
105/* EOF block manipulation functions */
106bool	xfs_can_free_eofblocks(struct xfs_inode *ip, bool force);
107int	xfs_free_eofblocks(struct xfs_mount *mp, struct xfs_inode *ip,
108			   bool need_iolock);
109
110int	xfs_swap_extents(struct xfs_inode *ip, struct xfs_inode *tip,
111			 struct xfs_swapext *sx);
112
113xfs_daddr_t xfs_fsb_to_db(struct xfs_inode *ip, xfs_fsblock_t fsb);
 
 
 
 
 
114
115#endif	/* __XFS_BMAP_UTIL_H__ */
v4.17
 1/*
 2 * Copyright (c) 2000-2006 Silicon Graphics, Inc.
 3 * All Rights Reserved.
 4 *
 5 * This program is free software; you can redistribute it and/or
 6 * modify it under the terms of the GNU General Public License as
 7 * published by the Free Software Foundation.
 8 *
 9 * This program is distributed in the hope that it would be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12 * GNU General Public License for more details.
13 *
14 * You should have received a copy of the GNU General Public License
15 * along with this program; if not, write the Free Software Foundation,
16 * Inc.,  51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
17 */
18#ifndef __XFS_BMAP_UTIL_H__
19#define	__XFS_BMAP_UTIL_H__
20
21/* Kernel only BMAP related definitions and functions */
22
23struct xfs_bmbt_irec;
24struct xfs_extent_free_item;
25struct xfs_ifork;
26struct xfs_inode;
27struct xfs_mount;
28struct xfs_trans;
29struct xfs_bmalloca;
30
31#ifdef CONFIG_XFS_RT
32int	xfs_bmap_rtalloc(struct xfs_bmalloca *ap);
33#else /* !CONFIG_XFS_RT */
34/*
35 * Attempts to allocate RT extents when RT is disable indicates corruption and
36 * should trigger a shutdown.
37 */
38static inline int
39xfs_bmap_rtalloc(struct xfs_bmalloca *ap)
40{
41	return -EFSCORRUPTED;
42}
43#endif /* CONFIG_XFS_RT */
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
44
 
 
 
 
 
45int	xfs_bmap_eof(struct xfs_inode *ip, xfs_fileoff_t endoff,
46		     int whichfork, int *eof);
 
 
47int	xfs_bmap_punch_delalloc_range(struct xfs_inode *ip,
48		xfs_fileoff_t start_fsb, xfs_fileoff_t length);
49
50struct kgetbmap {
51	__s64		bmv_offset;	/* file offset of segment in blocks */
52	__s64		bmv_block;	/* starting block (64-bit daddr_t)  */
53	__s64		bmv_length;	/* length of segment, blocks	    */
54	__s32		bmv_oflags;	/* output flags */
55};
56int	xfs_getbmap(struct xfs_inode *ip, struct getbmapx *bmv,
57		struct kgetbmap *out);
58
59/* functions in xfs_bmap.c that are only needed by xfs_bmap_util.c */
 
 
 
60int	xfs_bmap_extsize_align(struct xfs_mount *mp, struct xfs_bmbt_irec *gotp,
61			       struct xfs_bmbt_irec *prevp, xfs_extlen_t extsz,
62			       int rt, int eof, int delay, int convert,
63			       xfs_fileoff_t *offp, xfs_extlen_t *lenp);
64void	xfs_bmap_adjacent(struct xfs_bmalloca *ap);
65int	xfs_bmap_last_extent(struct xfs_trans *tp, struct xfs_inode *ip,
66			     int whichfork, struct xfs_bmbt_irec *rec,
67			     int *is_empty);
68
69/* preallocation and hole punch interface */
70int	xfs_alloc_file_space(struct xfs_inode *ip, xfs_off_t offset,
71			     xfs_off_t len, int alloc_type);
72int	xfs_free_file_space(struct xfs_inode *ip, xfs_off_t offset,
73			    xfs_off_t len);
74int	xfs_zero_file_space(struct xfs_inode *ip, xfs_off_t offset,
75			    xfs_off_t len);
76int	xfs_collapse_file_space(struct xfs_inode *, xfs_off_t offset,
77				xfs_off_t len);
78int	xfs_insert_file_space(struct xfs_inode *, xfs_off_t offset,
79				xfs_off_t len);
80
81/* EOF block manipulation functions */
82bool	xfs_can_free_eofblocks(struct xfs_inode *ip, bool force);
83int	xfs_free_eofblocks(struct xfs_inode *ip);
 
84
85int	xfs_swap_extents(struct xfs_inode *ip, struct xfs_inode *tip,
86			 struct xfs_swapext *sx);
87
88xfs_daddr_t xfs_fsb_to_db(struct xfs_inode *ip, xfs_fsblock_t fsb);
89
90xfs_extnum_t xfs_bmap_count_leaves(struct xfs_ifork *ifp, xfs_filblks_t *count);
91int xfs_bmap_count_blocks(struct xfs_trans *tp, struct xfs_inode *ip,
92			  int whichfork, xfs_extnum_t *nextents,
93			  xfs_filblks_t *count);
94
95#endif	/* __XFS_BMAP_UTIL_H__ */