2
* Copyright (c) 2000-2003 Silicon Graphics, Inc. All Rights Reserved.
2
* Copyright (c) 2000-2003,2005 Silicon Graphics, Inc.
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
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
6
7
* 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/
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
32
18
#ifndef __XFS_LOG_H__
33
19
#define __XFS_LOG_H__
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)
43
21
/* get lsn fields */
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))
23
#define CYCLE_LSN(lsn) ((uint)((lsn)>>32))
24
#define BLOCK_LSN(lsn) ((uint)(lsn))
47
25
/* 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)])
26
#define CYCLE_LSN_DISK(lsn) (((uint *)&(lsn))[0])
61
xfs_lsn_t _lsn_cmp(xfs_lsn_t lsn1, xfs_lsn_t lsn2, xfs_arch_t arch)
39
xfs_lsn_t _lsn_cmp(xfs_lsn_t lsn1, xfs_lsn_t lsn2)
63
if (CYCLE_LSN(lsn1, arch) != CYCLE_LSN(lsn2, arch))
64
return (CYCLE_LSN(lsn1, arch)<CYCLE_LSN(lsn2, arch))? -999 : 999;
41
if (CYCLE_LSN(lsn1) != CYCLE_LSN(lsn2))
42
return (CYCLE_LSN(lsn1)<CYCLE_LSN(lsn2))? -999 : 999;
66
if (BLOCK_LSN(lsn1, arch) != BLOCK_LSN(lsn2, arch))
67
return (BLOCK_LSN(lsn1, arch)<BLOCK_LSN(lsn2, arch))? -999 : 999;
44
if (BLOCK_LSN(lsn1) != BLOCK_LSN(lsn2))
45
return (BLOCK_LSN(lsn1)<BLOCK_LSN(lsn2))? -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)
50
#define XFS_LSN_CMP(x,y) _lsn_cmp(x,y)
78
53
* Macros, structures, prototypes for interface to the log manager.
125
100
#define XFS_VOLUME 0x2
126
101
#define XFS_LOG 0xaa
104
/* Region types for iovec's i_type */
105
#if defined(XFS_LOG_RES_DEBUG)
106
#define XLOG_REG_TYPE_BFORMAT 1
107
#define XLOG_REG_TYPE_BCHUNK 2
108
#define XLOG_REG_TYPE_EFI_FORMAT 3
109
#define XLOG_REG_TYPE_EFD_FORMAT 4
110
#define XLOG_REG_TYPE_IFORMAT 5
111
#define XLOG_REG_TYPE_ICORE 6
112
#define XLOG_REG_TYPE_IEXT 7
113
#define XLOG_REG_TYPE_IBROOT 8
114
#define XLOG_REG_TYPE_ILOCAL 9
115
#define XLOG_REG_TYPE_IATTR_EXT 10
116
#define XLOG_REG_TYPE_IATTR_BROOT 11
117
#define XLOG_REG_TYPE_IATTR_LOCAL 12
118
#define XLOG_REG_TYPE_QFORMAT 13
119
#define XLOG_REG_TYPE_DQUOT 14
120
#define XLOG_REG_TYPE_QUOTAOFF 15
121
#define XLOG_REG_TYPE_LRHEADER 16
122
#define XLOG_REG_TYPE_UNMOUNT 17
123
#define XLOG_REG_TYPE_COMMIT 18
124
#define XLOG_REG_TYPE_TRANSHDR 19
125
#define XLOG_REG_TYPE_MAX 19
128
#if defined(XFS_LOG_RES_DEBUG)
129
#define XLOG_VEC_SET_TYPE(vecp, t) ((vecp)->i_type = (t))
131
#define XLOG_VEC_SET_TYPE(vecp, t)
128
135
typedef struct xfs_log_iovec {
129
136
xfs_caddr_t i_addr; /* beginning address of region */
130
137
int i_len; /* length in bytes of region */
138
#if defined(XFS_LOG_RES_DEBUG)
139
uint i_type; /* type of region */
131
141
} xfs_log_iovec_t;
133
143
typedef void* xfs_log_ticket_t;
150
160
xfs_log_ticket_t ticket,
153
int xfs_log_force(struct xfs_mount *mp,
163
int _xfs_log_force(struct xfs_mount *mp,
167
#define xfs_log_force(mp, lsn, flags) \
168
_xfs_log_force(mp, lsn, flags, NULL);
156
169
int xfs_log_mount(struct xfs_mount *mp,
157
170
struct xfs_buftarg *log_target,
158
171
xfs_daddr_t start_block,