Input: add missing exports to fix modular build
[linux-2.6/verdex.git] / fs / xfs / xfs_trans_extfree.c
blobb290270dd4a69f941d18d98a16bf840ed57d25c4
1 /*
2 * Copyright (c) 2000,2005 Silicon Graphics, Inc.
3 * All Rights Reserved.
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.
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.
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
18 #include "xfs.h"
19 #include "xfs_fs.h"
20 #include "xfs_types.h"
21 #include "xfs_log.h"
22 #include "xfs_inum.h"
23 #include "xfs_trans.h"
24 #include "xfs_sb.h"
25 #include "xfs_dmapi.h"
26 #include "xfs_mount.h"
27 #include "xfs_trans_priv.h"
28 #include "xfs_extfree_item.h"
31 * This routine is called to allocate an "extent free intention"
32 * log item that will hold nextents worth of extents. The
33 * caller must use all nextents extents, because we are not
34 * flexible about this at all.
36 xfs_efi_log_item_t *
37 xfs_trans_get_efi(xfs_trans_t *tp,
38 uint nextents)
40 xfs_efi_log_item_t *efip;
42 ASSERT(tp != NULL);
43 ASSERT(nextents > 0);
45 efip = xfs_efi_init(tp->t_mountp, nextents);
46 ASSERT(efip != NULL);
49 * Get a log_item_desc to point at the new item.
51 (void) xfs_trans_add_item(tp, (xfs_log_item_t*)efip);
53 return (efip);
57 * This routine is called to indicate that the described
58 * extent is to be logged as needing to be freed. It should
59 * be called once for each extent to be freed.
61 void
62 xfs_trans_log_efi_extent(xfs_trans_t *tp,
63 xfs_efi_log_item_t *efip,
64 xfs_fsblock_t start_block,
65 xfs_extlen_t ext_len)
67 xfs_log_item_desc_t *lidp;
68 uint next_extent;
69 xfs_extent_t *extp;
71 lidp = xfs_trans_find_item(tp, (xfs_log_item_t*)efip);
72 ASSERT(lidp != NULL);
74 tp->t_flags |= XFS_TRANS_DIRTY;
75 lidp->lid_flags |= XFS_LID_DIRTY;
77 next_extent = efip->efi_next_extent;
78 ASSERT(next_extent < efip->efi_format.efi_nextents);
79 extp = &(efip->efi_format.efi_extents[next_extent]);
80 extp->ext_start = start_block;
81 extp->ext_len = ext_len;
82 efip->efi_next_extent++;
87 * This routine is called to allocate an "extent free done"
88 * log item that will hold nextents worth of extents. The
89 * caller must use all nextents extents, because we are not
90 * flexible about this at all.
92 xfs_efd_log_item_t *
93 xfs_trans_get_efd(xfs_trans_t *tp,
94 xfs_efi_log_item_t *efip,
95 uint nextents)
97 xfs_efd_log_item_t *efdp;
99 ASSERT(tp != NULL);
100 ASSERT(nextents > 0);
102 efdp = xfs_efd_init(tp->t_mountp, efip, nextents);
103 ASSERT(efdp != NULL);
106 * Get a log_item_desc to point at the new item.
108 (void) xfs_trans_add_item(tp, (xfs_log_item_t*)efdp);
110 return (efdp);
114 * This routine is called to indicate that the described
115 * extent is to be logged as having been freed. It should
116 * be called once for each extent freed.
118 void
119 xfs_trans_log_efd_extent(xfs_trans_t *tp,
120 xfs_efd_log_item_t *efdp,
121 xfs_fsblock_t start_block,
122 xfs_extlen_t ext_len)
124 xfs_log_item_desc_t *lidp;
125 uint next_extent;
126 xfs_extent_t *extp;
128 lidp = xfs_trans_find_item(tp, (xfs_log_item_t*)efdp);
129 ASSERT(lidp != NULL);
131 tp->t_flags |= XFS_TRANS_DIRTY;
132 lidp->lid_flags |= XFS_LID_DIRTY;
134 next_extent = efdp->efd_next_extent;
135 ASSERT(next_extent < efdp->efd_format.efd_nextents);
136 extp = &(efdp->efd_format.efd_extents[next_extent]);
137 extp->ext_start = start_block;
138 extp->ext_len = ext_len;
139 efdp->efd_next_extent++;