OpenCores
URL https://opencores.org/ocsvn/or1k/or1k/trunk

Subversion Repositories or1k

[/] [or1k/] [trunk/] [linux/] [linux-2.4/] [fs/] [xfs/] [xfs_trans_extfree.c] - Blame information for rev 1765

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 1275 phoenix
/*
2
 * Copyright (c) 2000 Silicon Graphics, Inc.  All Rights Reserved.
3
 *
4
 * This program is free software; you can redistribute it and/or modify it
5
 * under the terms of version 2 of the GNU General Public License as
6
 * published by the Free Software Foundation.
7
 *
8
 * This program is distributed in the hope that it would be useful, but
9
 * WITHOUT ANY WARRANTY; without even the implied warranty of
10
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
11
 *
12
 * Further, this software is distributed without any warranty that it is
13
 * free of the rightful claim of any third person regarding infringement
14
 * or the like.  Any license provided herein, whether implied or
15
 * otherwise, applies only to this software file.  Patent licenses, if
16
 * any, provided herein do not apply to combinations of this program with
17
 * other software, or any other product whatsoever.
18
 *
19
 * You should have received a copy of the GNU General Public License along
20
 * with this program; if not, write the Free Software Foundation, Inc., 59
21
 * Temple Place - Suite 330, Boston MA 02111-1307, USA.
22
 *
23
 * Contact information: Silicon Graphics, Inc., 1600 Amphitheatre Pkwy,
24
 * Mountain View, CA  94043, or:
25
 *
26
 * http://www.sgi.com
27
 *
28
 * For further information regarding this notice, see:
29
 *
30
 * http://oss.sgi.com/projects/GenInfo/SGIGPLNoticeExplan/
31
 */
32
 
33
#include "xfs.h"
34
#include "xfs_macros.h"
35
#include "xfs_types.h"
36
#include "xfs_inum.h"
37
#include "xfs_log.h"
38
#include "xfs_trans.h"
39
#include "xfs_sb.h"
40
#include "xfs_dir.h"
41
#include "xfs_dmapi.h"
42
#include "xfs_mount.h"
43
#include "xfs_trans_priv.h"
44
#include "xfs_extfree_item.h"
45
 
46
/*
47
 * This routine is called to allocate an "extent free intention"
48
 * log item that will hold nextents worth of extents.  The
49
 * caller must use all nextents extents, because we are not
50
 * flexible about this at all.
51
 */
52
xfs_efi_log_item_t *
53
xfs_trans_get_efi(xfs_trans_t   *tp,
54
                  uint          nextents)
55
{
56
        xfs_efi_log_item_t      *efip;
57
 
58
        ASSERT(tp != NULL);
59
        ASSERT(nextents > 0);
60
 
61
        efip = xfs_efi_init(tp->t_mountp, nextents);
62
        ASSERT(efip != NULL);
63
 
64
        /*
65
         * Get a log_item_desc to point at the new item.
66
         */
67
        (void) xfs_trans_add_item(tp, (xfs_log_item_t*)efip);
68
 
69
        return (efip);
70
}
71
 
72
/*
73
 * This routine is called to indicate that the described
74
 * extent is to be logged as needing to be freed.  It should
75
 * be called once for each extent to be freed.
76
 */
77
void
78
xfs_trans_log_efi_extent(xfs_trans_t            *tp,
79
                         xfs_efi_log_item_t     *efip,
80
                         xfs_fsblock_t          start_block,
81
                         xfs_extlen_t           ext_len)
82
{
83
        xfs_log_item_desc_t     *lidp;
84
        uint                    next_extent;
85
        xfs_extent_t            *extp;
86
 
87
        lidp = xfs_trans_find_item(tp, (xfs_log_item_t*)efip);
88
        ASSERT(lidp != NULL);
89
 
90
        tp->t_flags |= XFS_TRANS_DIRTY;
91
        lidp->lid_flags |= XFS_LID_DIRTY;
92
 
93
        next_extent = efip->efi_next_extent;
94
        ASSERT(next_extent < efip->efi_format.efi_nextents);
95
        extp = &(efip->efi_format.efi_extents[next_extent]);
96
        extp->ext_start = start_block;
97
        extp->ext_len = ext_len;
98
        efip->efi_next_extent++;
99
}
100
 
101
 
102
/*
103
 * This routine is called to allocate an "extent free done"
104
 * log item that will hold nextents worth of extents.  The
105
 * caller must use all nextents extents, because we are not
106
 * flexible about this at all.
107
 */
108
xfs_efd_log_item_t *
109
xfs_trans_get_efd(xfs_trans_t           *tp,
110
                  xfs_efi_log_item_t    *efip,
111
                  uint                  nextents)
112
{
113
        xfs_efd_log_item_t      *efdp;
114
 
115
        ASSERT(tp != NULL);
116
        ASSERT(nextents > 0);
117
 
118
        efdp = xfs_efd_init(tp->t_mountp, efip, nextents);
119
        ASSERT(efdp != NULL);
120
 
121
        /*
122
         * Get a log_item_desc to point at the new item.
123
         */
124
        (void) xfs_trans_add_item(tp, (xfs_log_item_t*)efdp);
125
 
126
        return (efdp);
127
}
128
 
129
/*
130
 * This routine is called to indicate that the described
131
 * extent is to be logged as having been freed.  It should
132
 * be called once for each extent freed.
133
 */
134
void
135
xfs_trans_log_efd_extent(xfs_trans_t            *tp,
136
                         xfs_efd_log_item_t     *efdp,
137
                         xfs_fsblock_t          start_block,
138
                         xfs_extlen_t           ext_len)
139
{
140
        xfs_log_item_desc_t     *lidp;
141
        uint                    next_extent;
142
        xfs_extent_t            *extp;
143
 
144
        lidp = xfs_trans_find_item(tp, (xfs_log_item_t*)efdp);
145
        ASSERT(lidp != NULL);
146
 
147
        tp->t_flags |= XFS_TRANS_DIRTY;
148
        lidp->lid_flags |= XFS_LID_DIRTY;
149
 
150
        next_extent = efdp->efd_next_extent;
151
        ASSERT(next_extent < efdp->efd_format.efd_nextents);
152
        extp = &(efdp->efd_format.efd_extents[next_extent]);
153
        extp->ext_start = start_block;
154
        extp->ext_len = ext_len;
155
        efdp->efd_next_extent++;
156
}

powered by: WebSVN 2.1.0

© copyright 1999-2025 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.