]> git.proxmox.com Git - mirror_ubuntu-zesty-kernel.git/blame - fs/xfs/xfs_log.h
xfs: introduce xlog_copy_iovec
[mirror_ubuntu-zesty-kernel.git] / fs / xfs / xfs_log.h
CommitLineData
1da177e4 1/*
7b718769
NS
2 * Copyright (c) 2000-2003,2005 Silicon Graphics, Inc.
3 * All Rights Reserved.
1da177e4 4 *
7b718769
NS
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
1da177e4
LT
7 * published by the Free Software Foundation.
8 *
7b718769
NS
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.
1da177e4 13 *
7b718769
NS
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
1da177e4
LT
17 */
18#ifndef __XFS_LOG_H__
19#define __XFS_LOG_H__
20
fc06c6d0
DC
21struct xfs_log_vec {
22 struct xfs_log_vec *lv_next; /* next lv in build list */
23 int lv_niovecs; /* number of iovecs in lv */
24 struct xfs_log_iovec *lv_iovecp; /* iovec array */
25 struct xfs_log_item *lv_item; /* owner */
26 char *lv_buf; /* formatted buffer */
27 int lv_buf_len; /* size of formatted buffer */
7492c5b4 28 int lv_size; /* size of allocated lv */
fc06c6d0
DC
29};
30
31#define XFS_LOG_VEC_ORDERED (-1)
32
1234351c
CH
33static inline void *
34xlog_copy_iovec(struct xfs_log_iovec **vecp, uint type, void *data, int len)
35{
36 struct xfs_log_iovec *vec = *vecp;
37
38 vec->i_type = type;
39 vec->i_addr = data;
40 vec->i_len = len;
41
42 *vecp = vec + 1;
43 return vec->i_addr;
44}
45
fc06c6d0
DC
46/*
47 * Structure used to pass callback function and the function's argument
48 * to the log manager.
49 */
50typedef struct xfs_log_callback {
51 struct xfs_log_callback *cb_next;
52 void (*cb_func)(void *, int);
53 void *cb_arg;
54} xfs_log_callback_t;
1da177e4 55
1da177e4 56/*
c41564b5 57 * By comparing each component, we don't have to worry about extra
1da177e4
LT
58 * endian issues in treating two 32 bit numbers as one 64 bit number
59 */
a1365647 60static inline xfs_lsn_t _lsn_cmp(xfs_lsn_t lsn1, xfs_lsn_t lsn2)
1da177e4
LT
61{
62 if (CYCLE_LSN(lsn1) != CYCLE_LSN(lsn2))
63 return (CYCLE_LSN(lsn1)<CYCLE_LSN(lsn2))? -999 : 999;
64
65 if (BLOCK_LSN(lsn1) != BLOCK_LSN(lsn2))
66 return (BLOCK_LSN(lsn1)<BLOCK_LSN(lsn2))? -999 : 999;
67
68 return 0;
69}
70
71#define XFS_LSN_CMP(x,y) _lsn_cmp(x,y)
72
73/*
74 * Macros, structures, prototypes for interface to the log manager.
75 */
76
1da177e4
LT
77/*
78 * Flags to xfs_log_done()
79 */
80#define XFS_LOG_REL_PERM_RESERV 0x1
81
1da177e4
LT
82/*
83 * Flags to xfs_log_force()
84 *
85 * XFS_LOG_SYNC: Synchronous force in-core log to disk
1da177e4
LT
86 */
87#define XFS_LOG_SYNC 0x1
1da177e4 88
1da177e4
LT
89/* Log manager interfaces */
90struct xfs_mount;
35a8a72f 91struct xlog_in_core;
cc09c0dc 92struct xlog_ticket;
43f5efc5
DC
93struct xfs_log_item;
94struct xfs_item_ops;
955833cf 95struct xfs_trans;
239880ef 96struct xfs_log_callback;
35a8a72f 97
1da177e4 98xfs_lsn_t xfs_log_done(struct xfs_mount *mp,
35a8a72f
CH
99 struct xlog_ticket *ticket,
100 struct xlog_in_core **iclog,
1da177e4 101 uint flags);
f538d4da 102int _xfs_log_force(struct xfs_mount *mp,
f538d4da
CH
103 uint flags,
104 int *log_forced);
b911ca04 105void xfs_log_force(struct xfs_mount *mp,
b911ca04 106 uint flags);
a14a348b
CH
107int _xfs_log_force_lsn(struct xfs_mount *mp,
108 xfs_lsn_t lsn,
109 uint flags,
110 int *log_forced);
111void xfs_log_force_lsn(struct xfs_mount *mp,
112 xfs_lsn_t lsn,
113 uint flags);
1da177e4
LT
114int xfs_log_mount(struct xfs_mount *mp,
115 struct xfs_buftarg *log_target,
116 xfs_daddr_t start_block,
117 int num_bblocks);
4249023a 118int xfs_log_mount_finish(struct xfs_mount *mp);
09a423a3 119xfs_lsn_t xlog_assign_tail_lsn(struct xfs_mount *mp);
1c304625 120xfs_lsn_t xlog_assign_tail_lsn_locked(struct xfs_mount *mp);
cfb7cdca 121void xfs_log_space_wake(struct xfs_mount *mp);
1da177e4 122int xfs_log_notify(struct xfs_mount *mp,
35a8a72f 123 struct xlog_in_core *iclog,
239880ef 124 struct xfs_log_callback *callback_entry);
1da177e4 125int xfs_log_release_iclog(struct xfs_mount *mp,
35a8a72f 126 struct xlog_in_core *iclog);
1da177e4
LT
127int xfs_log_reserve(struct xfs_mount *mp,
128 int length,
129 int count,
35a8a72f 130 struct xlog_ticket **ticket,
1da177e4 131 __uint8_t clientid,
9006fb91 132 bool permanent,
7e9c6396 133 uint t_type);
9006fb91 134int xfs_log_regrant(struct xfs_mount *mp, struct xlog_ticket *tic);
1da177e4 135int xfs_log_unmount_write(struct xfs_mount *mp);
21b699c8 136void xfs_log_unmount(struct xfs_mount *mp);
1da177e4
LT
137int xfs_log_force_umount(struct xfs_mount *mp, int logerror);
138int xfs_log_need_covered(struct xfs_mount *mp);
139
140void xlog_iodone(struct xfs_buf *);
141
71e330b5 142struct xlog_ticket *xfs_log_ticket_get(struct xlog_ticket *ticket);
cc09c0dc
DC
143void xfs_log_ticket_put(struct xlog_ticket *ticket);
144
0244b960 145int xfs_log_commit_cil(struct xfs_mount *mp, struct xfs_trans *tp,
71e330b5 146 xfs_lsn_t *commit_lsn, int flags);
ccf7c23f 147bool xfs_log_item_in_current_chkpt(struct xfs_log_item *lip);
71e330b5 148
f661f1e0
DC
149void xfs_log_work_queue(struct xfs_mount *mp);
150void xfs_log_worker(struct work_struct *work);
c75921a7 151void xfs_log_quiesce(struct xfs_mount *mp);
f661f1e0 152
1da177e4 153#endif /* __XFS_LOG_H__ */