aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDave Chinner <dchinner@redhat.com>2013-08-12 06:49:22 -0400
committerBen Myers <bpm@sgi.com>2013-08-12 17:03:51 -0400
commitfc06c6d064dd50f7aa157065ef79216190d75c91 (patch)
tree014e558cfc5a9c55a795e0988b4e320a0a8f60df
parent7a378c9aeab3782a5f998c17313bc7027cee3454 (diff)
xfs: separate out log format definitions
The on-disk format definitions for the log are spread randoms through a couple of header files. Consolidate it all in a single file that can be shared easily with userspace. This means that xfs_log.h and xfs_log_priv.h no longer need to be shared with userspace. Signed-off-by: Dave Chinner <dchinner@redhat.com> Reviewed-by: Brian Foster <bfoster@redhat.com> Reviewed-by: Mark Tinguely <tinguely@sgi.com> Signed-off-by: Ben Myers <bpm@sgi.com>
-rw-r--r--fs/xfs/xfs_log.h89
-rw-r--r--fs/xfs/xfs_log_format.h178
-rw-r--r--fs/xfs/xfs_log_priv.h146
-rw-r--r--fs/xfs/xfs_log_recover.c2
4 files changed, 207 insertions, 208 deletions
diff --git a/fs/xfs/xfs_log.h b/fs/xfs/xfs_log.h
index fb630e496c12..e63d9e10bd69 100644
--- a/fs/xfs/xfs_log.h
+++ b/fs/xfs/xfs_log.h
@@ -18,14 +18,29 @@
18#ifndef __XFS_LOG_H__ 18#ifndef __XFS_LOG_H__
19#define __XFS_LOG_H__ 19#define __XFS_LOG_H__
20 20
21/* get lsn fields */ 21#include "xfs_log_format.h"
22#define CYCLE_LSN(lsn) ((uint)((lsn)>>32))
23#define BLOCK_LSN(lsn) ((uint)(lsn))
24 22
25/* this is used in a spot where we might otherwise double-endian-flip */ 23struct xfs_log_vec {
26#define CYCLE_LSN_DISK(lsn) (((__be32 *)&(lsn))[0]) 24 struct xfs_log_vec *lv_next; /* next lv in build list */
25 int lv_niovecs; /* number of iovecs in lv */
26 struct xfs_log_iovec *lv_iovecp; /* iovec array */
27 struct xfs_log_item *lv_item; /* owner */
28 char *lv_buf; /* formatted buffer */
29 int lv_buf_len; /* size of formatted buffer */
30};
31
32#define XFS_LOG_VEC_ORDERED (-1)
33
34/*
35 * Structure used to pass callback function and the function's argument
36 * to the log manager.
37 */
38typedef struct xfs_log_callback {
39 struct xfs_log_callback *cb_next;
40 void (*cb_func)(void *, int);
41 void *cb_arg;
42} xfs_log_callback_t;
27 43
28#ifdef __KERNEL__
29/* 44/*
30 * By comparing each component, we don't have to worry about extra 45 * By comparing each component, we don't have to worry about extra
31 * endian issues in treating two 32 bit numbers as one 64 bit number 46 * endian issues in treating two 32 bit numbers as one 64 bit number
@@ -59,67 +74,6 @@ static inline xfs_lsn_t _lsn_cmp(xfs_lsn_t lsn1, xfs_lsn_t lsn2)
59 */ 74 */
60#define XFS_LOG_SYNC 0x1 75#define XFS_LOG_SYNC 0x1
61 76
62#endif /* __KERNEL__ */
63
64
65/* Log Clients */
66#define XFS_TRANSACTION 0x69
67#define XFS_VOLUME 0x2
68#define XFS_LOG 0xaa
69
70
71/* Region types for iovec's i_type */
72#define XLOG_REG_TYPE_BFORMAT 1
73#define XLOG_REG_TYPE_BCHUNK 2
74#define XLOG_REG_TYPE_EFI_FORMAT 3
75#define XLOG_REG_TYPE_EFD_FORMAT 4
76#define XLOG_REG_TYPE_IFORMAT 5
77#define XLOG_REG_TYPE_ICORE 6
78#define XLOG_REG_TYPE_IEXT 7
79#define XLOG_REG_TYPE_IBROOT 8
80#define XLOG_REG_TYPE_ILOCAL 9
81#define XLOG_REG_TYPE_IATTR_EXT 10
82#define XLOG_REG_TYPE_IATTR_BROOT 11
83#define XLOG_REG_TYPE_IATTR_LOCAL 12
84#define XLOG_REG_TYPE_QFORMAT 13
85#define XLOG_REG_TYPE_DQUOT 14
86#define XLOG_REG_TYPE_QUOTAOFF 15
87#define XLOG_REG_TYPE_LRHEADER 16
88#define XLOG_REG_TYPE_UNMOUNT 17
89#define XLOG_REG_TYPE_COMMIT 18
90#define XLOG_REG_TYPE_TRANSHDR 19
91#define XLOG_REG_TYPE_ICREATE 20
92#define XLOG_REG_TYPE_MAX 20
93
94typedef struct xfs_log_iovec {
95 void *i_addr; /* beginning address of region */
96 int i_len; /* length in bytes of region */
97 uint i_type; /* type of region */
98} xfs_log_iovec_t;
99
100struct xfs_log_vec {
101 struct xfs_log_vec *lv_next; /* next lv in build list */
102 int lv_niovecs; /* number of iovecs in lv */
103 struct xfs_log_iovec *lv_iovecp; /* iovec array */
104 struct xfs_log_item *lv_item; /* owner */
105 char *lv_buf; /* formatted buffer */
106 int lv_buf_len; /* size of formatted buffer */
107};
108
109#define XFS_LOG_VEC_ORDERED (-1)
110
111/*
112 * Structure used to pass callback function and the function's argument
113 * to the log manager.
114 */
115typedef struct xfs_log_callback {
116 struct xfs_log_callback *cb_next;
117 void (*cb_func)(void *, int);
118 void *cb_arg;
119} xfs_log_callback_t;
120
121
122#ifdef __KERNEL__
123/* Log manager interfaces */ 77/* Log manager interfaces */
124struct xfs_mount; 78struct xfs_mount;
125struct xlog_in_core; 79struct xlog_in_core;
@@ -188,5 +142,4 @@ void xfs_log_work_queue(struct xfs_mount *mp);
188void xfs_log_worker(struct work_struct *work); 142void xfs_log_worker(struct work_struct *work);
189void xfs_log_quiesce(struct xfs_mount *mp); 143void xfs_log_quiesce(struct xfs_mount *mp);
190 144
191#endif
192#endif /* __XFS_LOG_H__ */ 145#endif /* __XFS_LOG_H__ */
diff --git a/fs/xfs/xfs_log_format.h b/fs/xfs/xfs_log_format.h
new file mode 100644
index 000000000000..9f9aeb63545a
--- /dev/null
+++ b/fs/xfs/xfs_log_format.h
@@ -0,0 +1,178 @@
1/*
2 * Copyright (c) 2000-2003,2005 Silicon Graphics, Inc.
3 * All Rights Reserved.
4 *
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.
8 *
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.
13 *
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
17 */
18#ifndef __XFS_LOG_FORMAT_H__
19#define __XFS_LOG_FORMAT_H__
20
21typedef __uint32_t xlog_tid_t;
22
23#define XLOG_MIN_ICLOGS 2
24#define XLOG_MAX_ICLOGS 8
25#define XLOG_HEADER_MAGIC_NUM 0xFEEDbabe /* Invalid cycle number */
26#define XLOG_VERSION_1 1
27#define XLOG_VERSION_2 2 /* Large IClogs, Log sunit */
28#define XLOG_VERSION_OKBITS (XLOG_VERSION_1 | XLOG_VERSION_2)
29#define XLOG_MIN_RECORD_BSIZE (16*1024) /* eventually 32k */
30#define XLOG_BIG_RECORD_BSIZE (32*1024) /* 32k buffers */
31#define XLOG_MAX_RECORD_BSIZE (256*1024)
32#define XLOG_HEADER_CYCLE_SIZE (32*1024) /* cycle data in header */
33#define XLOG_MIN_RECORD_BSHIFT 14 /* 16384 == 1 << 14 */
34#define XLOG_BIG_RECORD_BSHIFT 15 /* 32k == 1 << 15 */
35#define XLOG_MAX_RECORD_BSHIFT 18 /* 256k == 1 << 18 */
36#define XLOG_BTOLSUNIT(log, b) (((b)+(log)->l_mp->m_sb.sb_logsunit-1) / \
37 (log)->l_mp->m_sb.sb_logsunit)
38#define XLOG_LSUNITTOB(log, su) ((su) * (log)->l_mp->m_sb.sb_logsunit)
39
40#define XLOG_HEADER_SIZE 512
41
42#define XLOG_REC_SHIFT(log) \
43 BTOBB(1 << (xfs_sb_version_haslogv2(&log->l_mp->m_sb) ? \
44 XLOG_MAX_RECORD_BSHIFT : XLOG_BIG_RECORD_BSHIFT))
45#define XLOG_TOTAL_REC_SHIFT(log) \
46 BTOBB(XLOG_MAX_ICLOGS << (xfs_sb_version_haslogv2(&log->l_mp->m_sb) ? \
47 XLOG_MAX_RECORD_BSHIFT : XLOG_BIG_RECORD_BSHIFT))
48
49/* get lsn fields */
50#define CYCLE_LSN(lsn) ((uint)((lsn)>>32))
51#define BLOCK_LSN(lsn) ((uint)(lsn))
52
53/* this is used in a spot where we might otherwise double-endian-flip */
54#define CYCLE_LSN_DISK(lsn) (((__be32 *)&(lsn))[0])
55
56static inline xfs_lsn_t xlog_assign_lsn(uint cycle, uint block)
57{
58 return ((xfs_lsn_t)cycle << 32) | block;
59}
60
61static inline uint xlog_get_cycle(char *ptr)
62{
63 if (be32_to_cpu(*(__be32 *)ptr) == XLOG_HEADER_MAGIC_NUM)
64 return be32_to_cpu(*((__be32 *)ptr + 1));
65 else
66 return be32_to_cpu(*(__be32 *)ptr);
67}
68
69/* Log Clients */
70#define XFS_TRANSACTION 0x69
71#define XFS_VOLUME 0x2
72#define XFS_LOG 0xaa
73
74#define XLOG_UNMOUNT_TYPE 0x556e /* Un for Unmount */
75
76/* Region types for iovec's i_type */
77#define XLOG_REG_TYPE_BFORMAT 1
78#define XLOG_REG_TYPE_BCHUNK 2
79#define XLOG_REG_TYPE_EFI_FORMAT 3
80#define XLOG_REG_TYPE_EFD_FORMAT 4
81#define XLOG_REG_TYPE_IFORMAT 5
82#define XLOG_REG_TYPE_ICORE 6
83#define XLOG_REG_TYPE_IEXT 7
84#define XLOG_REG_TYPE_IBROOT 8
85#define XLOG_REG_TYPE_ILOCAL 9
86#define XLOG_REG_TYPE_IATTR_EXT 10
87#define XLOG_REG_TYPE_IATTR_BROOT 11
88#define XLOG_REG_TYPE_IATTR_LOCAL 12
89#define XLOG_REG_TYPE_QFORMAT 13
90#define XLOG_REG_TYPE_DQUOT 14
91#define XLOG_REG_TYPE_QUOTAOFF 15
92#define XLOG_REG_TYPE_LRHEADER 16
93#define XLOG_REG_TYPE_UNMOUNT 17
94#define XLOG_REG_TYPE_COMMIT 18
95#define XLOG_REG_TYPE_TRANSHDR 19
96#define XLOG_REG_TYPE_ICREATE 20
97#define XLOG_REG_TYPE_MAX 20
98
99/*
100 * Flags to log operation header
101 *
102 * The first write of a new transaction will be preceded with a start
103 * record, XLOG_START_TRANS. Once a transaction is committed, a commit
104 * record is written, XLOG_COMMIT_TRANS. If a single region can not fit into
105 * the remainder of the current active in-core log, it is split up into
106 * multiple regions. Each partial region will be marked with a
107 * XLOG_CONTINUE_TRANS until the last one, which gets marked with XLOG_END_TRANS.
108 *
109 */
110#define XLOG_START_TRANS 0x01 /* Start a new transaction */
111#define XLOG_COMMIT_TRANS 0x02 /* Commit this transaction */
112#define XLOG_CONTINUE_TRANS 0x04 /* Cont this trans into new region */
113#define XLOG_WAS_CONT_TRANS 0x08 /* Cont this trans into new region */
114#define XLOG_END_TRANS 0x10 /* End a continued transaction */
115#define XLOG_UNMOUNT_TRANS 0x20 /* Unmount a filesystem transaction */
116
117
118typedef struct xlog_op_header {
119 __be32 oh_tid; /* transaction id of operation : 4 b */
120 __be32 oh_len; /* bytes in data region : 4 b */
121 __u8 oh_clientid; /* who sent me this : 1 b */
122 __u8 oh_flags; /* : 1 b */
123 __u16 oh_res2; /* 32 bit align : 2 b */
124} xlog_op_header_t;
125
126
127/* valid values for h_fmt */
128#define XLOG_FMT_UNKNOWN 0
129#define XLOG_FMT_LINUX_LE 1
130#define XLOG_FMT_LINUX_BE 2
131#define XLOG_FMT_IRIX_BE 3
132
133/* our fmt */
134#ifdef XFS_NATIVE_HOST
135#define XLOG_FMT XLOG_FMT_LINUX_BE
136#else
137#define XLOG_FMT XLOG_FMT_LINUX_LE
138#endif
139
140typedef struct xlog_rec_header {
141 __be32 h_magicno; /* log record (LR) identifier : 4 */
142 __be32 h_cycle; /* write cycle of log : 4 */
143 __be32 h_version; /* LR version : 4 */
144 __be32 h_len; /* len in bytes; should be 64-bit aligned: 4 */
145 __be64 h_lsn; /* lsn of this LR : 8 */
146 __be64 h_tail_lsn; /* lsn of 1st LR w/ buffers not committed: 8 */
147 __le32 h_crc; /* crc of log record : 4 */
148 __be32 h_prev_block; /* block number to previous LR : 4 */
149 __be32 h_num_logops; /* number of log operations in this LR : 4 */
150 __be32 h_cycle_data[XLOG_HEADER_CYCLE_SIZE / BBSIZE];
151 /* new fields */
152 __be32 h_fmt; /* format of log record : 4 */
153 uuid_t h_fs_uuid; /* uuid of FS : 16 */
154 __be32 h_size; /* iclog size : 4 */
155} xlog_rec_header_t;
156
157typedef struct xlog_rec_ext_header {
158 __be32 xh_cycle; /* write cycle of log : 4 */
159 __be32 xh_cycle_data[XLOG_HEADER_CYCLE_SIZE / BBSIZE]; /* : 256 */
160} xlog_rec_ext_header_t;
161
162/*
163 * Quite misnamed, because this union lays out the actual on-disk log buffer.
164 */
165typedef union xlog_in_core2 {
166 xlog_rec_header_t hic_header;
167 xlog_rec_ext_header_t hic_xheader;
168 char hic_sector[XLOG_HEADER_SIZE];
169} xlog_in_core_2_t;
170
171/* not an on-disk structure, but needed by log recovery in userspace */
172typedef struct xfs_log_iovec {
173 void *i_addr; /* beginning address of region */
174 int i_len; /* length in bytes of region */
175 uint i_type; /* type of region */
176} xfs_log_iovec_t;
177
178#endif /* __XFS_LOG_FORMAT_H__ */
diff --git a/fs/xfs/xfs_log_priv.h b/fs/xfs/xfs_log_priv.h
index b9ea262dd1c2..edd0964fb65c 100644
--- a/fs/xfs/xfs_log_priv.h
+++ b/fs/xfs/xfs_log_priv.h
@@ -24,51 +24,13 @@ struct xlog_ticket;
24struct xfs_mount; 24struct xfs_mount;
25 25
26/* 26/*
27 * Macros, structures, prototypes for internal log manager use. 27 * Flags for log structure
28 */ 28 */
29 29#define XLOG_ACTIVE_RECOVERY 0x2 /* in the middle of recovery */
30#define XLOG_MIN_ICLOGS 2 30#define XLOG_RECOVERY_NEEDED 0x4 /* log was recovered */
31#define XLOG_MAX_ICLOGS 8 31#define XLOG_IO_ERROR 0x8 /* log hit an I/O error, and being
32#define XLOG_HEADER_MAGIC_NUM 0xFEEDbabe /* Invalid cycle number */ 32 shutdown */
33#define XLOG_VERSION_1 1 33#define XLOG_TAIL_WARN 0x10 /* log tail verify warning issued */
34#define XLOG_VERSION_2 2 /* Large IClogs, Log sunit */
35#define XLOG_VERSION_OKBITS (XLOG_VERSION_1 | XLOG_VERSION_2)
36#define XLOG_MIN_RECORD_BSIZE (16*1024) /* eventually 32k */
37#define XLOG_BIG_RECORD_BSIZE (32*1024) /* 32k buffers */
38#define XLOG_MAX_RECORD_BSIZE (256*1024)
39#define XLOG_HEADER_CYCLE_SIZE (32*1024) /* cycle data in header */
40#define XLOG_MIN_RECORD_BSHIFT 14 /* 16384 == 1 << 14 */
41#define XLOG_BIG_RECORD_BSHIFT 15 /* 32k == 1 << 15 */
42#define XLOG_MAX_RECORD_BSHIFT 18 /* 256k == 1 << 18 */
43#define XLOG_BTOLSUNIT(log, b) (((b)+(log)->l_mp->m_sb.sb_logsunit-1) / \
44 (log)->l_mp->m_sb.sb_logsunit)
45#define XLOG_LSUNITTOB(log, su) ((su) * (log)->l_mp->m_sb.sb_logsunit)
46
47#define XLOG_HEADER_SIZE 512
48
49#define XLOG_REC_SHIFT(log) \
50 BTOBB(1 << (xfs_sb_version_haslogv2(&log->l_mp->m_sb) ? \
51 XLOG_MAX_RECORD_BSHIFT : XLOG_BIG_RECORD_BSHIFT))
52#define XLOG_TOTAL_REC_SHIFT(log) \
53 BTOBB(XLOG_MAX_ICLOGS << (xfs_sb_version_haslogv2(&log->l_mp->m_sb) ? \
54 XLOG_MAX_RECORD_BSHIFT : XLOG_BIG_RECORD_BSHIFT))
55
56static inline xfs_lsn_t xlog_assign_lsn(uint cycle, uint block)
57{
58 return ((xfs_lsn_t)cycle << 32) | block;
59}
60
61static inline uint xlog_get_cycle(char *ptr)
62{
63 if (be32_to_cpu(*(__be32 *)ptr) == XLOG_HEADER_MAGIC_NUM)
64 return be32_to_cpu(*((__be32 *)ptr + 1));
65 else
66 return be32_to_cpu(*(__be32 *)ptr);
67}
68
69#define BLK_AVG(blk1, blk2) ((blk1+blk2) >> 1)
70
71#ifdef __KERNEL__
72 34
73/* 35/*
74 * get client id from packed copy. 36 * get client id from packed copy.
@@ -101,28 +63,8 @@ static inline uint xlog_get_client_id(__be32 i)
101#define XLOG_STATE_IOERROR 0x0080 /* IO error happened in sync'ing log */ 63#define XLOG_STATE_IOERROR 0x0080 /* IO error happened in sync'ing log */
102#define XLOG_STATE_ALL 0x7FFF /* All possible valid flags */ 64#define XLOG_STATE_ALL 0x7FFF /* All possible valid flags */
103#define XLOG_STATE_NOTUSED 0x8000 /* This IC log not being used */ 65#define XLOG_STATE_NOTUSED 0x8000 /* This IC log not being used */
104#endif /* __KERNEL__ */
105 66
106/* 67/*
107 * Flags to log operation header
108 *
109 * The first write of a new transaction will be preceded with a start
110 * record, XLOG_START_TRANS. Once a transaction is committed, a commit
111 * record is written, XLOG_COMMIT_TRANS. If a single region can not fit into
112 * the remainder of the current active in-core log, it is split up into
113 * multiple regions. Each partial region will be marked with a
114 * XLOG_CONTINUE_TRANS until the last one, which gets marked with XLOG_END_TRANS.
115 *
116 */
117#define XLOG_START_TRANS 0x01 /* Start a new transaction */
118#define XLOG_COMMIT_TRANS 0x02 /* Commit this transaction */
119#define XLOG_CONTINUE_TRANS 0x04 /* Cont this trans into new region */
120#define XLOG_WAS_CONT_TRANS 0x08 /* Cont this trans into new region */
121#define XLOG_END_TRANS 0x10 /* End a continued transaction */
122#define XLOG_UNMOUNT_TRANS 0x20 /* Unmount a filesystem transaction */
123
124#ifdef __KERNEL__
125/*
126 * Flags to log ticket 68 * Flags to log ticket
127 */ 69 */
128#define XLOG_TIC_INITED 0x1 /* has been initialized */ 70#define XLOG_TIC_INITED 0x1 /* has been initialized */
@@ -132,22 +74,6 @@ static inline uint xlog_get_client_id(__be32 i)
132 { XLOG_TIC_INITED, "XLOG_TIC_INITED" }, \ 74 { XLOG_TIC_INITED, "XLOG_TIC_INITED" }, \
133 { XLOG_TIC_PERM_RESERV, "XLOG_TIC_PERM_RESERV" } 75 { XLOG_TIC_PERM_RESERV, "XLOG_TIC_PERM_RESERV" }
134 76
135#endif /* __KERNEL__ */
136
137#define XLOG_UNMOUNT_TYPE 0x556e /* Un for Unmount */
138
139/*
140 * Flags for log structure
141 */
142#define XLOG_ACTIVE_RECOVERY 0x2 /* in the middle of recovery */
143#define XLOG_RECOVERY_NEEDED 0x4 /* log was recovered */
144#define XLOG_IO_ERROR 0x8 /* log hit an I/O error, and being
145 shutdown */
146#define XLOG_TAIL_WARN 0x10 /* log tail verify warning issued */
147
148typedef __uint32_t xlog_tid_t;
149
150#ifdef __KERNEL__
151/* 77/*
152 * Below are states for covering allocation transactions. 78 * Below are states for covering allocation transactions.
153 * By covering, we mean changing the h_tail_lsn in the last on-disk 79 * By covering, we mean changing the h_tail_lsn in the last on-disk
@@ -223,7 +149,6 @@ typedef __uint32_t xlog_tid_t;
223 149
224#define XLOG_COVER_OPS 5 150#define XLOG_COVER_OPS 5
225 151
226
227/* Ticket reservation region accounting */ 152/* Ticket reservation region accounting */
228#define XLOG_TIC_LEN_MAX 15 153#define XLOG_TIC_LEN_MAX 15
229 154
@@ -258,64 +183,6 @@ typedef struct xlog_ticket {
258 xlog_res_t t_res_arr[XLOG_TIC_LEN_MAX]; /* array of res : 8 * 15 */ 183 xlog_res_t t_res_arr[XLOG_TIC_LEN_MAX]; /* array of res : 8 * 15 */
259} xlog_ticket_t; 184} xlog_ticket_t;
260 185
261#endif
262
263
264typedef struct xlog_op_header {
265 __be32 oh_tid; /* transaction id of operation : 4 b */
266 __be32 oh_len; /* bytes in data region : 4 b */
267 __u8 oh_clientid; /* who sent me this : 1 b */
268 __u8 oh_flags; /* : 1 b */
269 __u16 oh_res2; /* 32 bit align : 2 b */
270} xlog_op_header_t;
271
272
273/* valid values for h_fmt */
274#define XLOG_FMT_UNKNOWN 0
275#define XLOG_FMT_LINUX_LE 1
276#define XLOG_FMT_LINUX_BE 2
277#define XLOG_FMT_IRIX_BE 3
278
279/* our fmt */
280#ifdef XFS_NATIVE_HOST
281#define XLOG_FMT XLOG_FMT_LINUX_BE
282#else
283#define XLOG_FMT XLOG_FMT_LINUX_LE
284#endif
285
286typedef struct xlog_rec_header {
287 __be32 h_magicno; /* log record (LR) identifier : 4 */
288 __be32 h_cycle; /* write cycle of log : 4 */
289 __be32 h_version; /* LR version : 4 */
290 __be32 h_len; /* len in bytes; should be 64-bit aligned: 4 */
291 __be64 h_lsn; /* lsn of this LR : 8 */
292 __be64 h_tail_lsn; /* lsn of 1st LR w/ buffers not committed: 8 */
293 __le32 h_crc; /* crc of log record : 4 */
294 __be32 h_prev_block; /* block number to previous LR : 4 */
295 __be32 h_num_logops; /* number of log operations in this LR : 4 */
296 __be32 h_cycle_data[XLOG_HEADER_CYCLE_SIZE / BBSIZE];
297 /* new fields */
298 __be32 h_fmt; /* format of log record : 4 */
299 uuid_t h_fs_uuid; /* uuid of FS : 16 */
300 __be32 h_size; /* iclog size : 4 */
301} xlog_rec_header_t;
302
303typedef struct xlog_rec_ext_header {
304 __be32 xh_cycle; /* write cycle of log : 4 */
305 __be32 xh_cycle_data[XLOG_HEADER_CYCLE_SIZE / BBSIZE]; /* : 256 */
306} xlog_rec_ext_header_t;
307
308#ifdef __KERNEL__
309
310/*
311 * Quite misnamed, because this union lays out the actual on-disk log buffer.
312 */
313typedef union xlog_in_core2 {
314 xlog_rec_header_t hic_header;
315 xlog_rec_ext_header_t hic_xheader;
316 char hic_sector[XLOG_HEADER_SIZE];
317} xlog_in_core_2_t;
318
319/* 186/*
320 * - A log record header is 512 bytes. There is plenty of room to grow the 187 * - A log record header is 512 bytes. There is plenty of room to grow the
321 * xlog_rec_header_t into the reserved space. 188 * xlog_rec_header_t into the reserved space.
@@ -686,6 +553,5 @@ static inline void xlog_wait(wait_queue_head_t *wq, spinlock_t *lock)
686 schedule(); 553 schedule();
687 remove_wait_queue(wq, &wait); 554 remove_wait_queue(wq, &wait);
688} 555}
689#endif /* __KERNEL__ */
690 556
691#endif /* __XFS_LOG_PRIV_H__ */ 557#endif /* __XFS_LOG_PRIV_H__ */
diff --git a/fs/xfs/xfs_log_recover.c b/fs/xfs/xfs_log_recover.c
index 7681b19aa5dc..7d3fc9ec56a2 100644
--- a/fs/xfs/xfs_log_recover.c
+++ b/fs/xfs/xfs_log_recover.c
@@ -55,6 +55,8 @@
55#include "xfs_attr_leaf.h" 55#include "xfs_attr_leaf.h"
56#include "xfs_attr_remote.h" 56#include "xfs_attr_remote.h"
57 57
58#define BLK_AVG(blk1, blk2) ((blk1+blk2) >> 1)
59
58STATIC int 60STATIC int
59xlog_find_zeroed( 61xlog_find_zeroed(
60 struct xlog *, 62 struct xlog *,