~ubuntu-branches/ubuntu/hoary/xfsprogs/hoary

« back to all changes in this revision

Viewing changes to include/xfs_bmap.h

  • Committer: Bazaar Package Importer
  • Author(s): Nathan Scott
  • Date: 2004-07-28 21:11:38 UTC
  • Revision ID: james.westby@ubuntu.com-20040728211138-0v4pdnunnp7na5lm
Tags: 2.6.20-1
* New upstream release.
* Fix xfs_io segfault on non-XFS files.  (closes: #260470)
* Fix packaging botch, deleted files included.  (closes: #260491)

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
/*
2
 
 * Copyright (c) 2000 Silicon Graphics, Inc.  All Rights Reserved.
3
 
 * 
 
2
 * Copyright (c) 2000-2003 Silicon Graphics, Inc.  All Rights Reserved.
 
3
 *
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.
7
 
 * 
 
7
 *
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.
11
 
 * 
 
11
 *
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.
18
 
 * 
 
18
 *
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.
22
 
 * 
 
22
 *
23
23
 * Contact information: Silicon Graphics, Inc., 1600 Amphitheatre Pkwy,
24
24
 * Mountain View, CA  94043, or:
25
 
 * 
26
 
 * http://www.sgi.com 
27
 
 * 
28
 
 * For further information regarding this notice, see: 
29
 
 * 
 
25
 *
 
26
 * http://www.sgi.com
 
27
 *
 
28
 * For further information regarding this notice, see:
 
29
 *
30
30
 * http://oss.sgi.com/projects/GenInfo/SGIGPLNoticeExplan/
31
31
 */
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 */
83
79
 
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)
96
92
 
97
 
/*
98
 
 * Trace operations for bmap extent tracing
99
 
 */
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
104
 
 
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 */
107
 
 
108
 
#if defined(XFS_ALL_TRACE)
109
 
#define XFS_BMAP_TRACE
110
 
#endif
111
 
 
112
 
#if !defined(DEBUG)
113
 
#undef  XFS_BMAP_TRACE
114
 
#endif
115
 
 
116
 
 
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;
147
123
 
148
124
#ifdef __KERNEL__
 
125
 
 
126
#if defined(XFS_BMAP_TRACE)
 
127
/*
 
128
 * Trace operations for bmap extent tracing
 
129
 */
 
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
 
134
 
 
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;
 
138
 
 
139
/*
 
140
 * Add bmap trace insert entries for all the contents of the extent list.
 
141
 */
 
142
void
 
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 */
 
148
#else
 
149
#define xfs_bmap_trace_exlist(f,ip,c,w)
 
150
#endif
 
151
 
149
152
/*
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 */
183
186
 
184
 
/* 
 
187
/*
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.
187
190
 */
191
194
        int                     whichfork);     /* data or attr fork */
192
195
 
193
196
/*
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.
197
200
 *
264
267
        struct xfs_inode        *ip,            /* incore inode */
265
268
        int                     whichfork);     /* data or attr fork */
266
269
 
267
 
#if defined(XFS_BMAP_TRACE)
268
 
/*
269
 
 * Add bmap trace insert entries for all the contents of the extent list.
270
 
 */
271
 
void
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 */
277
 
#else
278
 
#define xfs_bmap_trace_exlist(f,ip,c,w)
279
 
#endif
280
 
 
281
270
/*
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").
293
282
 */
294
283
int                                             /* error */
295
284
xfs_bmapi(
357
346
 */
358
347
int
359
348
xfs_bmap_isaeof(
360
 
        struct xfs_inode        *ip,
361
 
        xfs_fileoff_t           off,
362
 
        int                     whichfork,
363
 
        int                     *aeof);
 
349
        struct xfs_inode        *ip,
 
350
        xfs_fileoff_t           off,
 
351
        int                     whichfork,
 
352
        char                    *aeof);
364
353
 
365
354
/*
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
368
357
 */
369
358
int
370
359
xfs_bmap_eof(
371
 
        struct xfs_inode        *ip,
372
 
        xfs_fileoff_t           endoff,
373
 
        int                     whichfork,
374
 
        int                     *eof);
 
360
        struct xfs_inode        *ip,
 
361
        xfs_fileoff_t           endoff,
 
362
        int                     whichfork,
 
363
        int                     *eof);
375
364
 
376
365
/*
377
366
 * Count fsblocks of the given fork.
379
368
int
380
369
xfs_bmap_count_blocks(
381
370
        xfs_trans_t             *tp,
382
 
        xfs_inode_t             *ip,
 
371
        struct xfs_inode        *ip,
383
372
        int                     whichfork,
384
373
        int                     *count);
385
374