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

Subversion Repositories or1k

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

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 1275 phoenix
/*
2
 * Copyright (c) 2000-2003 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
#ifndef __XFS_LOG_H__
33
#define __XFS_LOG_H__
34
 
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)
38
#else
39
#define LSN_FIELD_CYCLE(arch) (0)
40
#define LSN_FIELD_BLOCK(arch) (1)
41
#endif
42
 
43
/* get lsn fields */
44
 
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)])
49
 
50
#ifdef __KERNEL__
51
/*
52
 * By comparing each compnent, we don't have to worry about extra
53
 * endian issues in treating two 32 bit numbers as one 64 bit number
54
 */
55
static
56
#if defined(__GNUC__) && (__GNUC__ == 2) && ( (__GNUC_MINOR__ == 95) || (__GNUC_MINOR__ == 96))
57
__attribute__((unused)) /* gcc 2.95, 2.96 miscompile this when inlined */
58
#else
59
__inline__
60
#endif
61
xfs_lsn_t       _lsn_cmp(xfs_lsn_t lsn1, xfs_lsn_t lsn2, xfs_arch_t arch)
62
{
63
        if (CYCLE_LSN(lsn1, arch) != CYCLE_LSN(lsn2, arch))
64
                return (CYCLE_LSN(lsn1, arch)<CYCLE_LSN(lsn2, arch))? -999 : 999;
65
 
66
        if (BLOCK_LSN(lsn1, arch) != BLOCK_LSN(lsn2, arch))
67
                return (BLOCK_LSN(lsn1, arch)<BLOCK_LSN(lsn2, arch))? -999 : 999;
68
 
69
        return 0;
70
}
71
 
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)
76
 
77
/*
78
 * Macros, structures, prototypes for interface to the log manager.
79
 */
80
 
81
/*
82
 * Flags to xfs_log_mount
83
 */
84
#define XFS_LOG_RECOVER         0x1
85
 
86
/*
87
 * Flags to xfs_log_done()
88
 */
89
#define XFS_LOG_REL_PERM_RESERV 0x1
90
 
91
 
92
/*
93
 * Flags to xfs_log_reserve()
94
 *
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.
100
 */
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)
105
 
106
 
107
/*
108
 * Flags to xfs_log_force()
109
 *
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.
113
 *
114
 * Note: Either XFS_LOG_FORCE or XFS_LOG_URGE must be set.
115
 */
116
#define XFS_LOG_SYNC            0x1
117
#define XFS_LOG_FORCE           0x2
118
#define XFS_LOG_URGE            0x4
119
 
120
#endif  /* __KERNEL__ */
121
 
122
 
123
/* Log Clients */
124
#define XFS_TRANSACTION         0x69
125
#define XFS_VOLUME              0x2
126
#define XFS_LOG                 0xaa
127
 
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 */
131
} xfs_log_iovec_t;
132
 
133
typedef void* xfs_log_ticket_t;
134
 
135
/*
136
 * Structure used to pass callback function and the function's argument
137
 * to the log manager.
138
 */
139
typedef struct xfs_log_callback {
140
        struct xfs_log_callback *cb_next;
141
        void                    (*cb_func)(void *, int);
142
        void                    *cb_arg;
143
} xfs_log_callback_t;
144
 
145
 
146
#ifdef __KERNEL__
147
/* Log manager interfaces */
148
struct xfs_mount;
149
xfs_lsn_t xfs_log_done(struct xfs_mount *mp,
150
                       xfs_log_ticket_t ticket,
151
                       void             **iclog,
152
                       uint             flags);
153
int       xfs_log_force(struct xfs_mount *mp,
154
                        xfs_lsn_t        lsn,
155
                        uint             flags);
156
int       xfs_log_mount(struct xfs_mount        *mp,
157
                        struct xfs_buftarg      *log_target,
158
                        xfs_daddr_t             start_block,
159
                        int                     num_bblocks);
160
int       xfs_log_mount_finish(struct xfs_mount *mp, int);
161
void      xfs_log_move_tail(struct xfs_mount    *mp,
162
                            xfs_lsn_t           tail_lsn);
163
int       xfs_log_notify(struct xfs_mount       *mp,
164
                         void                   *iclog,
165
                         xfs_log_callback_t     *callback_entry);
166
int       xfs_log_release_iclog(struct xfs_mount *mp,
167
                         void                    *iclog_hndl);
168
int       xfs_log_reserve(struct xfs_mount *mp,
169
                          int              length,
170
                          int              count,
171
                          xfs_log_ticket_t *ticket,
172
                          __uint8_t        clientid,
173
                          uint             flags);
174
int       xfs_log_write(struct xfs_mount *mp,
175
                        xfs_log_iovec_t  region[],
176
                        int              nentries,
177
                        xfs_log_ticket_t ticket,
178
                        xfs_lsn_t        *start_lsn);
179
int       xfs_log_unmount(struct xfs_mount *mp);
180
int       xfs_log_unmount_write(struct xfs_mount *mp);
181
void      xfs_log_unmount_dealloc(struct xfs_mount *mp);
182
int       xfs_log_force_umount(struct xfs_mount *mp, int logerror);
183
int       xfs_log_need_covered(struct xfs_mount *mp);
184
 
185
void      xlog_iodone(struct xfs_buf *);
186
 
187
#endif
188
 
189
 
190
extern int xlog_debug;          /* set to 1 to enable real log */
191
 
192
 
193
#endif  /* __XFS_LOG_H__ */

powered by: WebSVN 2.1.0

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