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

« back to all changes in this revision

Viewing changes to libxfs/logitem.c

  • 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-2001 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
 
 * or the like.  Any license provided herein, whether implied or
 
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
 
45
45
 * with its li_desc field.
46
46
 */
47
47
xfs_log_item_desc_t *
48
 
xfs_trans_add_item(xfs_trans_t *tp, xfs_log_item_t *lip)
 
48
xfs_trans_add_item(
 
49
        xfs_trans_t             *tp,
 
50
        xfs_log_item_t          *lip)
49
51
{
50
52
        xfs_log_item_desc_t     *lidp;
51
53
        xfs_log_item_chunk_t    *licp;
135
137
 
136
138
/*
137
139
 * Free the given descriptor.
138
 
 * 
 
140
 *
139
141
 * This requires setting the bit in the chunk's free mask corresponding
140
142
 * to the given slot.
141
143
 */
142
144
void
143
 
xfs_trans_free_item(xfs_trans_t *tp, xfs_log_item_desc_t *lidp)
 
145
xfs_trans_free_item(
 
146
        xfs_trans_t             *tp,
 
147
        xfs_log_item_desc_t     *lidp)
144
148
{
145
149
        uint                    slot;
146
150
        xfs_log_item_chunk_t    *licp;
158
162
         * the chunk. First pull it from the chunk list and then
159
163
         * free it back to the heap.  We didn't bother with a doubly
160
164
         * linked list here because the lists should be very short
161
 
         * and this is not a performance path.  It's better to save
 
165
         * and this is not a performance path.  It's better to save
162
166
         * the memory of the extra pointer.
163
167
         *
164
168
         * Also decrement the transaction structure's count of free items
180
184
 * This is called to find the descriptor corresponding to the given
181
185
 * log item.  It returns a pointer to the descriptor.
182
186
 * The log item MUST have a corresponding descriptor in the given
183
 
 * transaction.  This routine does not return NULL, it panics.
 
187
 * transaction.  This routine does not return NULL, it panics.
184
188
 *
185
189
 * The descriptor pointer is kept in the log item's li_desc field.
186
190
 * Just return it.
187
191
 */
188
192
xfs_log_item_desc_t *
189
 
xfs_trans_find_item(xfs_trans_t *tp, xfs_log_item_t *lip)
 
193
xfs_trans_find_item(
 
194
        xfs_trans_t             *tp,
 
195
        xfs_log_item_t          *lip)
190
196
{
191
197
        ASSERT(lip->li_desc != NULL);
192
198
 
202
208
 */
203
209
void
204
210
xfs_trans_free_items(
205
 
        xfs_trans_t     *tp,
206
 
        int             flags)
 
211
        xfs_trans_t             *tp,
 
212
        int                     flags)
207
213
{
208
214
        xfs_log_item_chunk_t    *licp;
209
215
        xfs_log_item_chunk_t    *next_licp;
246
252
 */
247
253
STATIC xfs_buf_t *
248
254
xfs_trans_buf_item_match(
249
 
        xfs_trans_t     *tp,
250
 
        buftarg_t       *target,
251
 
        xfs_daddr_t     blkno,
252
 
        int             len)
 
255
        xfs_trans_t             *tp,
 
256
        xfs_buftarg_t           *target,
 
257
        xfs_daddr_t             blkno,
 
258
        int                     len)
253
259
{
254
260
        xfs_log_item_chunk_t    *licp;
255
261
        xfs_log_item_desc_t     *lidp;
256
262
        xfs_buf_log_item_t      *blip;
257
 
        xfs_buf_t                       *bp;
 
263
        xfs_buf_t               *bp;
258
264
        int                     i;
259
265
 
260
266
#ifdef LI_DEBUG
294
300
                            (XFS_BUF_ADDR(bp) == blkno) &&
295
301
                            (XFS_BUF_COUNT(bp) == len)) {
296
302
                                /*
297
 
                                 * We found it.  Break out and
 
303
                                 * We found it.  Break out and
298
304
                                 * return the pointer to the buffer.
299
305
                                 */
300
306
#ifdef LI_DEBUG
321
327
 */
322
328
STATIC xfs_buf_t *
323
329
xfs_trans_buf_item_match_all(
324
 
        xfs_trans_t     *tp,
325
 
        buftarg_t       *target,
326
 
        xfs_daddr_t     blkno,
327
 
        int             len)
 
330
        xfs_trans_t             *tp,
 
331
        xfs_buftarg_t           *target,
 
332
        xfs_daddr_t             blkno,
 
333
        int                     len)
328
334
{
329
335
        xfs_log_item_chunk_t    *licp;
330
336
        xfs_log_item_desc_t     *lidp;
331
337
        xfs_buf_log_item_t      *blip;
332
 
        xfs_buf_t                       *bp;
 
338
        xfs_buf_t               *bp;
333
339
        int                     i;
334
340
 
335
341
#ifdef LI_DEBUG
376
382
                            (XFS_BUF_ADDR(bp) == blkno) &&
377
383
                            (XFS_BUF_COUNT(bp) == len)) {
378
384
                                /*
379
 
                                 * We found it.  Break out and
 
385
                                 * We found it.  Break out and
380
386
                                 * return the pointer to the buffer.
381
387
                                 */
382
388
#ifdef LI_DEBUG
403
409
 */
404
410
void
405
411
xfs_buf_item_init(
406
 
        xfs_buf_t       *bp,
407
 
        xfs_mount_t     *mp)
 
412
        xfs_buf_t               *bp,
 
413
        xfs_mount_t             *mp)
408
414
{
409
415
        xfs_log_item_t          *lip;
410
416
        xfs_buf_log_item_t      *bip;
415
421
 
416
422
        /*
417
423
         * Check to see if there is already a buf log item for
418
 
         * this buffer.  If there is, it is guaranteed to be
 
424
         * this buffer.  If there is, it is guaranteed to be
419
425
         * the first.  If we do already have one, there is
420
426
         * nothing to do here so return.
421
427
         */
472
478
 */
473
479
void
474
480
xfs_inode_item_init(
475
 
        xfs_inode_t     *ip,
476
 
        xfs_mount_t     *mp)
 
481
        xfs_inode_t             *ip,
 
482
        xfs_mount_t             *mp)
477
483
{
478
484
        xfs_inode_log_item_t    *iip;
479
485