diff options
Diffstat (limited to 'fs/xfs/xfs_trans.h')
-rw-r--r-- | fs/xfs/xfs_trans.h | 176 |
1 files changed, 76 insertions, 100 deletions
diff --git a/fs/xfs/xfs_trans.h b/fs/xfs/xfs_trans.h index a263aec8b3a6..a889963fdd14 100644 --- a/fs/xfs/xfs_trans.h +++ b/fs/xfs/xfs_trans.h | |||
@@ -1,33 +1,19 @@ | |||
1 | /* | 1 | /* |
2 | * Copyright (c) 2000-2002 Silicon Graphics, Inc. All Rights Reserved. | 2 | * Copyright (c) 2000-2002,2005 Silicon Graphics, Inc. |
3 | * All Rights Reserved. | ||
3 | * | 4 | * |
4 | * This program is free software; you can redistribute it and/or modify it | 5 | * This program is free software; you can redistribute it and/or |
5 | * under the terms of version 2 of the GNU General Public License as | 6 | * modify it under the terms of the GNU General Public License as |
6 | * published by the Free Software Foundation. | 7 | * published by the Free Software Foundation. |
7 | * | 8 | * |
8 | * This program is distributed in the hope that it would be useful, but | 9 | * This program is distributed in the hope that it would be useful, |
9 | * WITHOUT ANY WARRANTY; without even the implied warranty of | 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
10 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
12 | * GNU General Public License for more details. | ||
11 | * | 13 | * |
12 | * Further, this software is distributed without any warranty that it is | 14 | * You should have received a copy of the GNU General Public License |
13 | * free of the rightful claim of any third person regarding infringement | 15 | * along with this program; if not, write the Free Software Foundation, |
14 | * or the like. Any license provided herein, whether implied or | 16 | * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA |
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 | */ | 17 | */ |
32 | #ifndef __XFS_TRANS_H__ | 18 | #ifndef __XFS_TRANS_H__ |
33 | #define __XFS_TRANS_H__ | 19 | #define __XFS_TRANS_H__ |
@@ -135,19 +121,6 @@ typedef struct xfs_ail_entry { | |||
135 | struct xfs_log_item *ail_back; /* AIL back pointer */ | 121 | struct xfs_log_item *ail_back; /* AIL back pointer */ |
136 | } xfs_ail_entry_t; | 122 | } xfs_ail_entry_t; |
137 | 123 | ||
138 | /* | ||
139 | * This structure is passed as a parameter to xfs_trans_push_ail() | ||
140 | * and is used to track the what LSN the waiting processes are | ||
141 | * waiting to become unused. | ||
142 | */ | ||
143 | typedef struct xfs_ail_ticket { | ||
144 | xfs_lsn_t at_lsn; /* lsn waitin for */ | ||
145 | struct xfs_ail_ticket *at_forw; /* wait list ptr */ | ||
146 | struct xfs_ail_ticket *at_back; /* wait list ptr */ | ||
147 | sv_t at_sema; /* wait sema */ | ||
148 | } xfs_ail_ticket_t; | ||
149 | |||
150 | |||
151 | typedef struct xfs_log_item { | 124 | typedef struct xfs_log_item { |
152 | xfs_ail_entry_t li_ail; /* AIL pointers */ | 125 | xfs_ail_entry_t li_ail; /* AIL pointers */ |
153 | xfs_lsn_t li_lsn; /* last on-disk lsn */ | 126 | xfs_lsn_t li_lsn; /* last on-disk lsn */ |
@@ -247,68 +220,67 @@ typedef struct xfs_log_item_chunk { | |||
247 | * lic_unused to the right value (0 matches all free). The | 220 | * lic_unused to the right value (0 matches all free). The |
248 | * lic_descs.lid_index values are set up as each desc is allocated. | 221 | * lic_descs.lid_index values are set up as each desc is allocated. |
249 | */ | 222 | */ |
250 | #if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_LIC_INIT) | ||
251 | void xfs_lic_init(xfs_log_item_chunk_t *cp); | ||
252 | #define XFS_LIC_INIT(cp) xfs_lic_init(cp) | 223 | #define XFS_LIC_INIT(cp) xfs_lic_init(cp) |
253 | #else | 224 | static inline void xfs_lic_init(xfs_log_item_chunk_t *cp) |
254 | #define XFS_LIC_INIT(cp) ((cp)->lic_free = XFS_LIC_FREEMASK) | 225 | { |
255 | #endif | 226 | cp->lic_free = XFS_LIC_FREEMASK; |
256 | #if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_LIC_INIT_SLOT) | 227 | } |
257 | void xfs_lic_init_slot(xfs_log_item_chunk_t *cp, int slot); | 228 | |
258 | #define XFS_LIC_INIT_SLOT(cp,slot) xfs_lic_init_slot(cp, slot) | 229 | #define XFS_LIC_INIT_SLOT(cp,slot) xfs_lic_init_slot(cp, slot) |
259 | #else | 230 | static inline void xfs_lic_init_slot(xfs_log_item_chunk_t *cp, int slot) |
260 | #define XFS_LIC_INIT_SLOT(cp,slot) \ | 231 | { |
261 | ((cp)->lic_descs[slot].lid_index = (unsigned char)(slot)) | 232 | cp->lic_descs[slot].lid_index = (unsigned char)(slot); |
262 | #endif | 233 | } |
263 | #if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_LIC_VACANCY) | 234 | |
264 | int xfs_lic_vacancy(xfs_log_item_chunk_t *cp); | ||
265 | #define XFS_LIC_VACANCY(cp) xfs_lic_vacancy(cp) | 235 | #define XFS_LIC_VACANCY(cp) xfs_lic_vacancy(cp) |
266 | #else | 236 | static inline int xfs_lic_vacancy(xfs_log_item_chunk_t *cp) |
267 | #define XFS_LIC_VACANCY(cp) (((cp)->lic_free) & XFS_LIC_FREEMASK) | 237 | { |
268 | #endif | 238 | return cp->lic_free & XFS_LIC_FREEMASK; |
269 | #if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_LIC_ALL_FREE) | 239 | } |
270 | void xfs_lic_all_free(xfs_log_item_chunk_t *cp); | 240 | |
271 | #define XFS_LIC_ALL_FREE(cp) xfs_lic_all_free(cp) | 241 | #define XFS_LIC_ALL_FREE(cp) xfs_lic_all_free(cp) |
272 | #else | 242 | static inline void xfs_lic_all_free(xfs_log_item_chunk_t *cp) |
273 | #define XFS_LIC_ALL_FREE(cp) ((cp)->lic_free = XFS_LIC_FREEMASK) | 243 | { |
274 | #endif | 244 | cp->lic_free = XFS_LIC_FREEMASK; |
275 | #if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_LIC_ARE_ALL_FREE) | 245 | } |
276 | int xfs_lic_are_all_free(xfs_log_item_chunk_t *cp); | 246 | |
277 | #define XFS_LIC_ARE_ALL_FREE(cp) xfs_lic_are_all_free(cp) | 247 | #define XFS_LIC_ARE_ALL_FREE(cp) xfs_lic_are_all_free(cp) |
278 | #else | 248 | static inline int xfs_lic_are_all_free(xfs_log_item_chunk_t *cp) |
279 | #define XFS_LIC_ARE_ALL_FREE(cp) (((cp)->lic_free & XFS_LIC_FREEMASK) ==\ | 249 | { |
280 | XFS_LIC_FREEMASK) | 250 | return ((cp->lic_free & XFS_LIC_FREEMASK) == XFS_LIC_FREEMASK); |
281 | #endif | 251 | } |
282 | #if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_LIC_ISFREE) | 252 | |
283 | int xfs_lic_isfree(xfs_log_item_chunk_t *cp, int slot); | ||
284 | #define XFS_LIC_ISFREE(cp,slot) xfs_lic_isfree(cp,slot) | 253 | #define XFS_LIC_ISFREE(cp,slot) xfs_lic_isfree(cp,slot) |
285 | #else | 254 | static inline int xfs_lic_isfree(xfs_log_item_chunk_t *cp, int slot) |
286 | #define XFS_LIC_ISFREE(cp,slot) ((cp)->lic_free & (1 << (slot))) | 255 | { |
287 | #endif | 256 | return (cp->lic_free & (1 << slot)); |
288 | #if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_LIC_CLAIM) | 257 | } |
289 | void xfs_lic_claim(xfs_log_item_chunk_t *cp, int slot); | 258 | |
290 | #define XFS_LIC_CLAIM(cp,slot) xfs_lic_claim(cp,slot) | 259 | #define XFS_LIC_CLAIM(cp,slot) xfs_lic_claim(cp,slot) |
291 | #else | 260 | static inline void xfs_lic_claim(xfs_log_item_chunk_t *cp, int slot) |
292 | #define XFS_LIC_CLAIM(cp,slot) ((cp)->lic_free &= ~(1 << (slot))) | 261 | { |
293 | #endif | 262 | cp->lic_free &= ~(1 << slot); |
294 | #if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_LIC_RELSE) | 263 | } |
295 | void xfs_lic_relse(xfs_log_item_chunk_t *cp, int slot); | 264 | |
296 | #define XFS_LIC_RELSE(cp,slot) xfs_lic_relse(cp,slot) | 265 | #define XFS_LIC_RELSE(cp,slot) xfs_lic_relse(cp,slot) |
297 | #else | 266 | static inline void xfs_lic_relse(xfs_log_item_chunk_t *cp, int slot) |
298 | #define XFS_LIC_RELSE(cp,slot) ((cp)->lic_free |= 1 << (slot)) | 267 | { |
299 | #endif | 268 | cp->lic_free |= 1 << slot; |
300 | #if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_LIC_SLOT) | 269 | } |
301 | xfs_log_item_desc_t *xfs_lic_slot(xfs_log_item_chunk_t *cp, int slot); | 270 | |
302 | #define XFS_LIC_SLOT(cp,slot) xfs_lic_slot(cp,slot) | 271 | #define XFS_LIC_SLOT(cp,slot) xfs_lic_slot(cp,slot) |
303 | #else | 272 | static inline xfs_log_item_desc_t * |
304 | #define XFS_LIC_SLOT(cp,slot) (&((cp)->lic_descs[slot])) | 273 | xfs_lic_slot(xfs_log_item_chunk_t *cp, int slot) |
305 | #endif | 274 | { |
306 | #if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_LIC_DESC_TO_SLOT) | 275 | return &(cp->lic_descs[slot]); |
307 | int xfs_lic_desc_to_slot(xfs_log_item_desc_t *dp); | 276 | } |
277 | |||
308 | #define XFS_LIC_DESC_TO_SLOT(dp) xfs_lic_desc_to_slot(dp) | 278 | #define XFS_LIC_DESC_TO_SLOT(dp) xfs_lic_desc_to_slot(dp) |
309 | #else | 279 | static inline int xfs_lic_desc_to_slot(xfs_log_item_desc_t *dp) |
310 | #define XFS_LIC_DESC_TO_SLOT(dp) ((uint)((dp)->lid_index)) | 280 | { |
311 | #endif | 281 | return (uint)dp->lid_index; |
282 | } | ||
283 | |||
312 | /* | 284 | /* |
313 | * Calculate the address of a chunk given a descriptor pointer: | 285 | * Calculate the address of a chunk given a descriptor pointer: |
314 | * dp - dp->lid_index give the address of the start of the lic_descs array. | 286 | * dp - dp->lid_index give the address of the start of the lic_descs array. |
@@ -316,15 +288,14 @@ int xfs_lic_desc_to_slot(xfs_log_item_desc_t *dp); | |||
316 | * All of this yields the address of the chunk, which is | 288 | * All of this yields the address of the chunk, which is |
317 | * cast to a chunk pointer. | 289 | * cast to a chunk pointer. |
318 | */ | 290 | */ |
319 | #if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_LIC_DESC_TO_CHUNK) | ||
320 | xfs_log_item_chunk_t *xfs_lic_desc_to_chunk(xfs_log_item_desc_t *dp); | ||
321 | #define XFS_LIC_DESC_TO_CHUNK(dp) xfs_lic_desc_to_chunk(dp) | 291 | #define XFS_LIC_DESC_TO_CHUNK(dp) xfs_lic_desc_to_chunk(dp) |
322 | #else | 292 | static inline xfs_log_item_chunk_t * |
323 | #define XFS_LIC_DESC_TO_CHUNK(dp) ((xfs_log_item_chunk_t*) \ | 293 | xfs_lic_desc_to_chunk(xfs_log_item_desc_t *dp) |
324 | (((xfs_caddr_t)((dp) - (dp)->lid_index)) -\ | 294 | { |
325 | (xfs_caddr_t)(((xfs_log_item_chunk_t*) \ | 295 | return (xfs_log_item_chunk_t*) \ |
326 | 0)->lic_descs))) | 296 | (((xfs_caddr_t)((dp) - (dp)->lid_index)) - \ |
327 | #endif | 297 | (xfs_caddr_t)(((xfs_log_item_chunk_t*)0)->lic_descs)); |
298 | } | ||
328 | 299 | ||
329 | #ifdef __KERNEL__ | 300 | #ifdef __KERNEL__ |
330 | /* | 301 | /* |
@@ -341,7 +312,7 @@ typedef struct xfs_log_busy_slot { | |||
341 | #define XFS_LBC_NUM_SLOTS 31 | 312 | #define XFS_LBC_NUM_SLOTS 31 |
342 | typedef struct xfs_log_busy_chunk { | 313 | typedef struct xfs_log_busy_chunk { |
343 | struct xfs_log_busy_chunk *lbc_next; | 314 | struct xfs_log_busy_chunk *lbc_next; |
344 | uint lbc_free; /* bitmask of free slots */ | 315 | uint lbc_free; /* free slots bitmask */ |
345 | ushort lbc_unused; /* first unused */ | 316 | ushort lbc_unused; /* first unused */ |
346 | xfs_log_busy_slot_t lbc_busy[XFS_LBC_NUM_SLOTS]; | 317 | xfs_log_busy_slot_t lbc_busy[XFS_LBC_NUM_SLOTS]; |
347 | } xfs_log_busy_chunk_t; | 318 | } xfs_log_busy_chunk_t; |
@@ -1025,7 +996,12 @@ void xfs_trans_log_efd_extent(xfs_trans_t *, | |||
1025 | struct xfs_efd_log_item *, | 996 | struct xfs_efd_log_item *, |
1026 | xfs_fsblock_t, | 997 | xfs_fsblock_t, |
1027 | xfs_extlen_t); | 998 | xfs_extlen_t); |
1028 | int xfs_trans_commit(xfs_trans_t *, uint flags, xfs_lsn_t *); | 999 | int _xfs_trans_commit(xfs_trans_t *, |
1000 | uint flags, | ||
1001 | xfs_lsn_t *, | ||
1002 | int *); | ||
1003 | #define xfs_trans_commit(tp, flags, lsn) \ | ||
1004 | _xfs_trans_commit(tp, flags, lsn, NULL) | ||
1029 | void xfs_trans_cancel(xfs_trans_t *, int); | 1005 | void xfs_trans_cancel(xfs_trans_t *, int); |
1030 | void xfs_trans_ail_init(struct xfs_mount *); | 1006 | void xfs_trans_ail_init(struct xfs_mount *); |
1031 | xfs_lsn_t xfs_trans_push_ail(struct xfs_mount *, xfs_lsn_t); | 1007 | xfs_lsn_t xfs_trans_push_ail(struct xfs_mount *, xfs_lsn_t); |