2
* Copyright (c) 2000 Silicon Graphics, Inc. All Rights Reserved.
2
* Copyright (c) 2000-2003 Silicon Graphics, Inc. All Rights Reserved.
4
4
* This program is free software; you can redistribute it and/or modify it
5
5
* under the terms of version 2 of the GNU General Public License as
6
6
* published by the Free Software Foundation.
8
8
* This program is distributed in the hope that it would be useful, but
9
9
* WITHOUT ANY WARRANTY; without even the implied warranty of
10
10
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
12
12
* Further, this software is distributed without any warranty that it is
13
13
* free of the rightful claim of any third person regarding infringement
14
14
* or the like. Any license provided herein, whether implied or
15
15
* otherwise, applies only to this software file. Patent licenses, if
16
16
* any, provided herein do not apply to combinations of this program with
17
17
* other software, or any other product whatsoever.
19
19
* You should have received a copy of the GNU General Public License along
20
20
* with this program; if not, write the Free Software Foundation, Inc., 59
21
21
* Temple Place - Suite 330, Boston MA 02111-1307, USA.
23
23
* Contact information: Silicon Graphics, Inc., 1600 Amphitheatre Pkwy,
24
24
* Mountain View, CA 94043, or:
28
* For further information regarding this notice, see:
28
* For further information regarding this notice, see:
30
30
* http://oss.sgi.com/projects/GenInfo/SGIGPLNoticeExplan/
32
32
#ifndef __XFS_BMAP_H__
76
76
#define XFS_BMAPI_IGSTATE 0x200 /* Ignore state - */
77
77
/* combine contig. space */
78
78
#define XFS_BMAPI_CONTIG 0x400 /* must allocate only one extent */
79
#define XFS_BMAPI_DIRECT_IO 0x800 /* Flag from cxfs client, not used
80
* by xfs directly. Indicates alloc
81
* request is for direct I/O not
82
* extent conversion by server */
84
80
#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_BMAPI_AFLAG)
85
81
int xfs_bmapi_aflag(int w);
94
90
#define DELAYSTARTBLOCK ((xfs_fsblock_t)-1LL)
95
91
#define HOLESTARTBLOCK ((xfs_fsblock_t)-2LL)
98
* Trace operations for bmap extent tracing
100
#define XFS_BMAP_KTRACE_DELETE 1
101
#define XFS_BMAP_KTRACE_INSERT 2
102
#define XFS_BMAP_KTRACE_PRE_UP 3
103
#define XFS_BMAP_KTRACE_POST_UP 4
105
#define XFS_BMAP_TRACE_SIZE 4096 /* size of global trace buffer */
106
#define XFS_BMAP_KTRACE_SIZE 32 /* size of per-inode trace buffer */
108
#if defined(XFS_ALL_TRACE)
109
#define XFS_BMAP_TRACE
113
#undef XFS_BMAP_TRACE
117
93
#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_BMAP_INIT)
118
94
void xfs_bmap_init(xfs_bmap_free_t *flp, xfs_fsblock_t *fbp);
119
95
#define XFS_BMAP_INIT(flp,fbp) xfs_bmap_init(flp,fbp)
138
114
xfs_extlen_t total; /* total blocks needed for xaction */
139
115
xfs_extlen_t minlen; /* mininum allocation size (blocks) */
140
116
xfs_extlen_t minleft; /* amount must be left after alloc */
141
int eof; /* set if allocating past last extent */
142
int wasdel; /* replacing a delayed allocation */
143
int userdata;/* set if is user data */
144
int low; /* low on space, using seq'l ags */
145
int aeof; /* allocated space at eof */
117
char eof; /* set if allocating past last extent */
118
char wasdel; /* replacing a delayed allocation */
119
char userdata;/* set if is user data */
120
char low; /* low on space, using seq'l ags */
121
char aeof; /* allocated space at eof */
146
122
} xfs_bmalloca_t;
148
124
#ifdef __KERNEL__
126
#if defined(XFS_BMAP_TRACE)
128
* Trace operations for bmap extent tracing
130
#define XFS_BMAP_KTRACE_DELETE 1
131
#define XFS_BMAP_KTRACE_INSERT 2
132
#define XFS_BMAP_KTRACE_PRE_UP 3
133
#define XFS_BMAP_KTRACE_POST_UP 4
135
#define XFS_BMAP_TRACE_SIZE 4096 /* size of global trace buffer */
136
#define XFS_BMAP_KTRACE_SIZE 32 /* size of per-inode trace buffer */
137
extern ktrace_t *xfs_bmap_trace_buf;
140
* Add bmap trace insert entries for all the contents of the extent list.
143
xfs_bmap_trace_exlist(
144
char *fname, /* function name */
145
struct xfs_inode *ip, /* incore inode pointer */
146
xfs_extnum_t cnt, /* count of entries in list */
147
int whichfork); /* data or attr fork */
149
#define xfs_bmap_trace_exlist(f,ip,c,w)
150
153
* Convert inode from non-attributed to attributed.
151
154
* Must not be in a transaction, ip must not be locked.
181
184
xfs_bmap_check_swappable(
182
185
struct xfs_inode *ip); /* incore inode */
185
188
* Compute and fill in the value of the maximum depth of a bmap btree
186
189
* in this filesystem. Done once, during mount.
191
194
int whichfork); /* data or attr fork */
194
* Routine to be called at transaction's end by xfs_bmapi, xfs_bunmapi
197
* Routine to be called at transaction's end by xfs_bmapi, xfs_bunmapi
195
198
* caller. Frees all the extents that need freeing, which must be done
196
199
* last due to locking considerations.
264
267
struct xfs_inode *ip, /* incore inode */
265
268
int whichfork); /* data or attr fork */
267
#if defined(XFS_BMAP_TRACE)
269
* Add bmap trace insert entries for all the contents of the extent list.
272
xfs_bmap_trace_exlist(
273
char *fname, /* function name */
274
struct xfs_inode *ip, /* incore inode pointer */
275
xfs_extnum_t cnt, /* count of entries in list */
276
int whichfork); /* data or attr fork */
278
#define xfs_bmap_trace_exlist(f,ip,c,w)
282
271
* Map file blocks to filesystem blocks.
283
272
* File range is given by the bno/len pair.
289
278
* must be remembered and presented to subsequent calls in "firstblock".
290
279
* An upper bound for the number of blocks to be allocated is supplied to
291
280
* the first call in "total"; if no allocation group has that many free
292
* blocks then the call will fail (return NULLFSBLOCK in "firstblock").
281
* blocks then the call will fail (return NULLFSBLOCK in "firstblock").
360
struct xfs_inode *ip,
349
struct xfs_inode *ip,
366
* Check if the endoff is outside the last extent. If so the caller will grow
355
* Check if the endoff is outside the last extent. If so the caller will grow
367
356
* the allocation to a stripe unit boundary
371
struct xfs_inode *ip,
372
xfs_fileoff_t endoff,
360
struct xfs_inode *ip,
361
xfs_fileoff_t endoff,
377
366
* Count fsblocks of the given fork.