]>
git.ipfire.org Git - thirdparty/xfsprogs-dev.git/blob - include/xfs_log.h
10d28cbff6f0acc5c7592bc9b76b28742c7a3992
2 * Copyright (c) 2000 Silicon Graphics, Inc. All Rights Reserved.
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.
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.
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.
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.
23 * Contact information: Silicon Graphics, Inc., 1600 Amphitheatre Pkwy,
24 * Mountain View, CA 94043, or:
28 * For further information regarding this notice, see:
30 * http://oss.sgi.com/projects/GenInfo/SGIGPLNoticeExplan/
35 #if __BYTE_ORDER == __LITTLE_ENDIAN
36 #define LSN_FIELD_CYCLE(arch) (((arch)==ARCH_NOCONVERT)?1:0)
37 #define LSN_FIELD_BLOCK(arch) (((arch)==ARCH_NOCONVERT)?0:1)
39 #define LSN_FIELD_CYCLE(arch) (0)
40 #define LSN_FIELD_BLOCK(arch) (1)
45 #define CYCLE_LSN(lsn,arch) (INT_GET(((uint *)&(lsn))[LSN_FIELD_CYCLE(arch)], arch))
46 #define BLOCK_LSN(lsn,arch) (INT_GET(((uint *)&(lsn))[LSN_FIELD_BLOCK(arch)], arch))
47 /* this is used in a spot where we might otherwise double-endian-flip */
48 #define CYCLE_LSN_NOCONV(lsn,arch) (((uint *)&(lsn))[LSN_FIELD_CYCLE(arch)])
51 #if (__GNUC__ == 2) && (__GNUC_MINOR__ == 95)
52 extern xfs_lsn_t
_lsn_cmp(xfs_lsn_t
, xfs_lsn_t
, xfs_arch_t
);
53 #define _lsn_cmp _xfs_lsn_cmp
57 * By comparing each component, we don't have to worry about extra
58 * endian issues in treating two 32 bit numbers as one 64 bit number
61 xfs_lsn_t
_lsn_cmp(xfs_lsn_t lsn1
, xfs_lsn_t lsn2
, xfs_arch_t arch
)
63 if (CYCLE_LSN(lsn1
, arch
) != CYCLE_LSN(lsn2
, arch
))
64 return (CYCLE_LSN(lsn1
, arch
)<CYCLE_LSN(lsn2
, arch
))? -999 : 999;
66 if (BLOCK_LSN(lsn1
, arch
) != BLOCK_LSN(lsn2
, arch
))
67 return (BLOCK_LSN(lsn1
, arch
)<BLOCK_LSN(lsn2
, arch
))? -999 : 999;
72 #define XFS_LSN_CMP_ARCH(x,y,arch) _lsn_cmp(x, y, arch)
73 #define XFS_LSN_CMP(x,y) XFS_LSN_CMP_ARCH(x,y,ARCH_NOCONVERT)
74 #define XFS_LSN_DIFF_ARCH(x,y,arch) _lsn_cmp(x, y, arch)
75 #define XFS_LSN_DIFF(x,y) XFS_LSN_DIFF_ARCH(x,y,ARCH_NOCONVERT)
78 * Macros, structures, prototypes for interface to the log manager.
82 * Flags to xfs_log_mount
84 #define XFS_LOG_RECOVER 0x1
87 * Flags to xfs_log_done()
89 #define XFS_LOG_REL_PERM_RESERV 0x1
93 * Flags to xfs_log_reserve()
95 * XFS_LOG_SLEEP: If space is not available, sleep (default)
96 * XFS_LOG_NOSLEEP: If space is not available, return error
97 * XFS_LOG_PERM_RESERV: Permanent reservation. When writes are
98 * performed against this type of reservation, the reservation
99 * is not decreased. Long running transactions should use this.
101 #define XFS_LOG_SLEEP 0x0
102 #define XFS_LOG_NOSLEEP 0x1
103 #define XFS_LOG_PERM_RESERV 0x2
104 #define XFS_LOG_RESV_ALL (XFS_LOG_NOSLEEP|XFS_LOG_PERM_RESERV)
108 * Flags to xfs_log_force()
110 * XFS_LOG_SYNC: Synchronous force in-core log to disk
111 * XFS_LOG_FORCE: Start in-core log write now.
112 * XFS_LOG_URGE: Start write within some window of time.
114 * Note: Either XFS_LOG_FORCE or XFS_LOG_URGE must be set.
116 #define XFS_LOG_SYNC 0x1
117 #define XFS_LOG_FORCE 0x2
118 #define XFS_LOG_URGE 0x4
120 #endif /* __KERNEL__ */
124 #define XFS_TRANSACTION 0x69
125 #define XFS_VOLUME 0x2
128 typedef struct xfs_log_iovec
{
129 xfs_caddr_t i_addr
; /* beginning address of region */
130 int i_len
; /* length in bytes of region */
133 typedef void* xfs_log_ticket_t
;
136 * Structure used to pass callback function and the function's argument
137 * to the log manager.
139 typedef struct xfs_log_callback
{
140 struct xfs_log_callback
*cb_next
;
141 void (*cb_func
)(void *, int);
143 } xfs_log_callback_t
;
147 /* Log manager interfaces */
149 xfs_lsn_t
xfs_log_done(struct xfs_mount
*mp
,
150 xfs_log_ticket_t ticket
,
152 int xfs_log_force(struct xfs_mount
*mp
,
155 int xfs_log_init(void);
156 int xfs_log_mount(struct xfs_mount
*mp
,
158 xfs_daddr_t start_block
,
160 int xfs_log_mount_finish(struct xfs_mount
*mp
, int);
161 void xfs_log_move_tail(struct xfs_mount
*mp
,
163 void xfs_log_notify(struct xfs_mount
*mp
,
165 xfs_log_callback_t
*callback_entry
);
166 int xfs_log_reserve(struct xfs_mount
*mp
,
169 xfs_log_ticket_t
*ticket
,
172 int xfs_log_write(struct xfs_mount
*mp
,
173 xfs_log_iovec_t region
[],
175 xfs_log_ticket_t ticket
,
176 xfs_lsn_t
*start_lsn
);
177 int xfs_log_unmount(struct xfs_mount
*mp
);
178 int xfs_log_unmount_write(struct xfs_mount
*mp
);
179 void xfs_log_unmount_dealloc(struct xfs_mount
*mp
);
180 int xfs_log_force_umount(struct xfs_mount
*mp
, int logerror
);
181 int xfs_log_need_covered(struct xfs_mount
*mp
);
183 void xlog_iodone(struct xfs_buf
*);
188 extern int xlog_debug
; /* set to 1 to enable real log */
191 #endif /* __XFS_LOG_H__ */