]> git.ipfire.org Git - thirdparty/xfsprogs-dev.git/blob - include/libxlog.h
libxfs: plumb in refcount deferred op log items
[thirdparty/xfsprogs-dev.git] / include / libxlog.h
1 /*
2 * Copyright (c) 2000-2005 Silicon Graphics, Inc.All Rights Reserved.
3 *
4 * This program is free software; you can redistribute it and/or
5 * modify it under the terms 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,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
12 *
13 * You should have received a copy of the GNU General Public License
14 * along with this program; if not, write the Free Software Foundation,
15 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
16 */
17 #ifndef LIBXLOG_H
18 #define LIBXLOG_H
19
20 /*
21 * define the userlevel xlog_t to be the subset of the kernel's
22 * xlog_t that we actually need to get our work done, avoiding
23 * the need to define any exotic kernel types in userland.
24 */
25 struct xlog {
26 xfs_lsn_t l_tail_lsn; /* lsn of 1st LR w/ unflush buffers */
27 xfs_lsn_t l_last_sync_lsn;/* lsn of last LR on disk */
28 xfs_mount_t *l_mp; /* mount point */
29 struct xfs_buftarg *l_dev; /* dev_t of log */
30 xfs_daddr_t l_logBBstart; /* start block of log */
31 int l_logBBsize; /* size of log in 512 byte chunks */
32 int l_curr_cycle; /* Cycle number of log writes */
33 int l_prev_cycle; /* Cycle # b4 last block increment */
34 int l_curr_block; /* current logical block of log */
35 int l_prev_block; /* previous logical block of log */
36 int l_iclog_size; /* size of log in bytes */
37 int l_iclog_size_log;/* log power size of log */
38 int l_iclog_bufs; /* number of iclog buffers */
39 atomic64_t l_grant_reserve_head;
40 atomic64_t l_grant_write_head;
41 uint l_sectbb_log; /* log2 of sector size in bbs */
42 uint l_sectbb_mask; /* sector size (in BBs)
43 * alignment mask */
44 int l_sectBBsize; /* size of log sector in 512 byte chunks */
45 };
46
47 #include "xfs_log_recover.h"
48
49 /*
50 * macros mapping kernel code to user code
51 *
52 * XXX: this is duplicated stuff - should be shared with libxfs.
53 */
54 #ifndef EFSCORRUPTED
55 #define EFSCORRUPTED 990
56 #endif
57 #define STATIC static
58 #define XFS_ERROR(e) (e)
59 #ifdef DEBUG
60 #define XFS_ERROR_REPORT(e,l,mp) fprintf(stderr, "ERROR: %s\n", e)
61 #else
62 #define XFS_ERROR_REPORT(e,l,mp) ((void) 0)
63 #endif
64 #define XFS_CORRUPTION_ERROR(e,l,mp,m) ((void) 0)
65 #define XFS_MOUNT_WAS_CLEAN 0x1
66 #define unlikely(x) (x)
67 #define xfs_alert(mp,fmt,args...) cmn_err(CE_ALERT,fmt, ## args)
68 #define xfs_warn(mp,fmt,args...) cmn_err(CE_WARN,fmt, ## args)
69 #define xfs_hex_dump(d,n) ((void) 0)
70 #define __round_mask(x, y) ((__typeof__(x))((y)-1))
71 #define round_up(x, y) ((((x)-1) | __round_mask(x, y))+1)
72 #define round_down(x, y) ((x) & ~__round_mask(x, y))
73
74 extern void xlog_warn(char *fmt,...);
75 extern void xlog_exit(char *fmt,...);
76 extern void xlog_panic(char *fmt,...);
77
78 /* exports */
79 extern int print_exit;
80 extern int print_skip_uuid;
81 extern int print_record_header;
82
83 /* libxfs parameters */
84 extern libxfs_init_t x;
85
86
87 extern int xlog_is_dirty(struct xfs_mount *, struct xlog *, libxfs_init_t *,
88 int);
89 extern struct xfs_buf *xlog_get_bp(struct xlog *, int);
90 extern void xlog_put_bp(struct xfs_buf *);
91 extern int xlog_bread(struct xlog *log, xfs_daddr_t blk_no, int nbblks,
92 xfs_buf_t *bp, char **offset);
93 extern int xlog_bread_noalign(struct xlog *log, xfs_daddr_t blk_no,
94 int nbblks, xfs_buf_t *bp);
95
96 extern int xlog_find_zeroed(struct xlog *log, xfs_daddr_t *blk_no);
97 extern int xlog_find_cycle_start(struct xlog *log, xfs_buf_t *bp,
98 xfs_daddr_t first_blk, xfs_daddr_t *last_blk,
99 uint cycle);
100 extern int xlog_find_tail(struct xlog *log, xfs_daddr_t *head_blk,
101 xfs_daddr_t *tail_blk);
102
103 extern int xlog_test_footer(struct xlog *log);
104 extern int xlog_recover(struct xlog *log, int readonly);
105 extern void xlog_recover_print_data(char *p, int len);
106 extern void xlog_recover_print_logitem(xlog_recover_item_t *item);
107 extern void xlog_recover_print_trans_head(xlog_recover_t *tr);
108 extern int xlog_print_find_oldest(struct xlog *log, xfs_daddr_t *last_blk);
109
110 /* for transactional view */
111 extern void xlog_recover_print_trans_head(xlog_recover_t *tr);
112 extern void xlog_recover_print_trans(xlog_recover_t *trans,
113 struct list_head *itemq, int print);
114 extern int xlog_do_recovery_pass(struct xlog *log, xfs_daddr_t head_blk,
115 xfs_daddr_t tail_blk, int pass);
116 extern int xlog_recover_do_trans(struct xlog *log, xlog_recover_t *trans,
117 int pass);
118 extern int xlog_header_check_recover(xfs_mount_t *mp,
119 xlog_rec_header_t *head);
120 extern int xlog_header_check_mount(xfs_mount_t *mp,
121 xlog_rec_header_t *head);
122
123 #define xlog_assign_atomic_lsn(l,a,b) ((void) 0)
124 #define xlog_assign_grant_head(l,a,b) ((void) 0)
125 #endif /* LIBXLOG_H */