hammer2 - serialized flush work part 4
[dragonfly.git] / sys / vfs / hammer2 / hammer2.h
CommitLineData
703720e4
MD
1/*
2 * Copyright (c) 2011-2012 The DragonFly Project. All rights reserved.
3 *
4 * This code is derived from software contributed to The DragonFly Project
5 * by Matthew Dillon <dillon@dragonflybsd.org>
6 * by Venkatesh Srinivas <vsrinivas@dragonflybsd.org>
7 *
8 * Redistribution and use in source and binary forms, with or without
9 * modification, are permitted provided that the following conditions
10 * are met:
11 *
12 * 1. Redistributions of source code must retain the above copyright
13 * notice, this list of conditions and the following disclaimer.
14 * 2. Redistributions in binary form must reproduce the above copyright
15 * notice, this list of conditions and the following disclaimer in
16 * the documentation and/or other materials provided with the
17 * distribution.
18 * 3. Neither the name of The DragonFly Project nor the names of its
19 * contributors may be used to endorse or promote products derived
20 * from this software without specific, prior written permission.
21 *
22 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
23 * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
24 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
25 * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
26 * COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
27 * INCIDENTAL, SPECIAL, EXEMPLARY OR CONSEQUENTIAL DAMAGES (INCLUDING,
28 * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
29 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
30 * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
31 * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
32 * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
33 * SUCH DAMAGE.
34 */
35
36/*
37 * This header file contains structures used internally by the HAMMER2
38 * implementation. See hammer2_disk.h for on-disk structures.
39 */
40
41#ifndef _VFS_HAMMER2_HAMMER2_H_
42#define _VFS_HAMMER2_HAMMER2_H_
43
44#include <sys/param.h>
45#include <sys/types.h>
46#include <sys/kernel.h>
47#include <sys/conf.h>
48#include <sys/systm.h>
49#include <sys/tree.h>
50#include <sys/malloc.h>
51#include <sys/mount.h>
52#include <sys/vnode.h>
53#include <sys/proc.h>
54#include <sys/mountctl.h>
55#include <sys/priv.h>
56#include <sys/stat.h>
46558838 57#include <sys/thread.h>
703720e4
MD
58#include <sys/globaldata.h>
59#include <sys/lockf.h>
60#include <sys/buf.h>
61#include <sys/queue.h>
62#include <sys/limits.h>
63#include <sys/buf2.h>
64#include <sys/signal2.h>
65#include <sys/tree.h>
5bc5bca2 66#include <sys/dmsg.h>
703720e4
MD
67
68#include "hammer2_disk.h"
69#include "hammer2_mount.h"
2910a90c 70#include "hammer2_ioctl.h"
1ad77ed9 71#include "hammer2_ccms.h"
703720e4 72
5c23d7f1 73struct hammer2_chain;
703720e4
MD
74struct hammer2_inode;
75struct hammer2_mount;
e4e20f48 76struct hammer2_pfsmount;
10c86c4e 77struct hammer2_span;
26bf1a36
MD
78struct hammer2_state;
79struct hammer2_msg;
703720e4 80
50e4f8f4
MD
81/*
82 * The chain structure tracks blockref recursions all the way to
83 * the root volume. These consist of indirect blocks, inodes,
84 * and eventually the volume header.
85 *
7cfa8da5
MD
86 * The chain structure is embedded in the hammer2_mount, hammer2_inode,
87 * and other system memory structures. The chain structure typically
88 * implements the reference count and busy flag for the larger structure.
89 *
90 * It is always possible to track a chain element all the way back to the
91 * root by following the (parent) links. (index) is a type-dependent index
92 * in the parent indicating where in the parent the chain element resides.
5c23d7f1
MD
93 *
94 * When a blockref is added or deleted the related chain element is marked
95 * modified and all of its parents are marked SUBMODIFIED (the parent
96 * recursion can stop once we hit a node that is already marked SUBMODIFIED).
97 * A deleted chain element must remain intact until synchronized against
98 * its parent.
99 *
100 * The blockref at (parent, index) is not adjusted until the modified chain
101 * element is flushed and unmarked. Until then the child's blockref may
102 * not match the blockref at (parent, index).
50e4f8f4 103 */
ecc33e71 104RB_HEAD(hammer2_chain_tree, hammer2_chain);
a0ed3c24 105TAILQ_HEAD(flush_deferral_list, hammer2_chain);
5c23d7f1 106
50e4f8f4 107struct hammer2_chain {
46558838 108 ccms_cst_t cst; /* attr or data cst */
50e4f8f4 109 struct hammer2_blockref bref;
004f88b4 110 struct hammer2_blockref bref_flush; /* synchronized w/MOVED bit */
26bf1a36 111 struct hammer2_chain *parent; /* return chain to root */
ecc33e71 112 struct hammer2_chain_tree rbhead;
26bf1a36 113 struct hammer2_state *state; /* if active cache msg */
ecc33e71 114 RB_ENTRY(hammer2_chain) rbnode;
1c9f601e 115 TAILQ_ENTRY(hammer2_chain) flush_node; /* flush deferral list */
5c23d7f1
MD
116
117 struct buf *bp; /* buffer cache (ro) */
118 hammer2_media_data_t *data; /* modified copy of data (rw) */
866d5273 119 u_int bytes; /* physical size of data */
5c23d7f1 120 int index; /* index in parent */
5f6853df 121 u_int flushing; /* element undergoing flush (count) */
5c23d7f1 122 u_int refs;
5c23d7f1 123 u_int flags;
50e4f8f4
MD
124};
125
126typedef struct hammer2_chain hammer2_chain_t;
127
5c23d7f1 128int hammer2_chain_cmp(hammer2_chain_t *chain1, hammer2_chain_t *chain2);
ecc33e71 129RB_PROTOTYPE(hammer2_chain_tree, hammer2_chain, rbnode, hammer2_chain_cmp);
5c23d7f1 130
28ee5f14
MD
131/*
132 * MOVED - This bit is set during the flush when the MODIFIED bit is cleared,
133 * indicating that the parent's blocktable must inherit a change to
134 * the bref (typically a block reallocation)
135 *
136 * It must also be set in situations where a chain is not MODIFIED
137 * but whos bref has changed (typically due to fields other than
138 * a block reallocation).
139 */
2910a90c 140#define HAMMER2_CHAIN_MODIFIED 0x00000001 /* active mods */
476d2aad 141#define HAMMER2_CHAIN_UNUSED0002 0x00000002
a92f82c4 142#define HAMMER2_CHAIN_DIRTYBP 0x00000004 /* dirty on unlock */
73e441b9 143#define HAMMER2_CHAIN_SUBMODIFIED 0x00000008 /* 1+ subs modified */
5f6853df 144#define HAMMER2_CHAIN_DELETED 0x00000010 /* deleted chain */
01eabad4 145#define HAMMER2_CHAIN_INITIAL 0x00000020 /* initial create */
c667909f 146#define HAMMER2_CHAIN_FLUSHED 0x00000040 /* flush on unlock */
28ee5f14 147#define HAMMER2_CHAIN_MOVED 0x00000080 /* bref changed */
37aa19df 148#define HAMMER2_CHAIN_IOFLUSH 0x00000100 /* bawrite on put */
1c9f601e 149#define HAMMER2_CHAIN_DEFERRED 0x00000200 /* on a deferral list*/
5f6853df 150#define HAMMER2_CHAIN_DESTROYED 0x00000400 /* destroying inode */
2910a90c 151#define HAMMER2_CHAIN_MODIFIED_AUX 0x00000800 /* hmp->vchain only */
4d5318eb
MD
152#define HAMMER2_CHAIN_MODIFY_TID 0x00001000 /* mod updates field */
153#define HAMMER2_CHAIN_MOUNTED 0x00002000 /* PFS is mounted */
5f6853df 154#define HAMMER2_CHAIN_ONRBTREE 0x00004000 /* on parent RB tree */
c667909f
MD
155
156/*
157 * Flags passed to hammer2_chain_lookup() and hammer2_chain_next()
158 */
159#define HAMMER2_LOOKUP_NOLOCK 0x00000001 /* ref only */
8cce658d 160#define HAMMER2_LOOKUP_NODATA 0x00000002 /* data left NULL */
a0ed3c24 161#define HAMMER2_LOOKUP_SHARED 0x00000100
5c23d7f1 162
01eabad4
MD
163/*
164 * Flags passed to hammer2_chain_modify() and hammer2_chain_resize()
165 *
166 * NOTE: OPTDATA allows us to avoid instantiating buffers for INDIRECT
167 * blocks in the INITIAL-create state.
4d5318eb
MD
168 *
169 * NOTE: NO_MODIFY_TID tells the function to not set HAMMER2_CHAIN_MODIFY_TID
170 * when marking the chain modified (used when a sub-chain modification
171 * propagates upward).
01eabad4
MD
172 */
173#define HAMMER2_MODIFY_NOSUB 0x00000001 /* do not set SUBMOD */
174#define HAMMER2_MODIFY_OPTDATA 0x00000002 /* data can be NULL */
4d5318eb 175#define HAMMER2_MODIFY_NO_MODIFY_TID 0x00000004
01eabad4
MD
176
177/*
178 * Flags passed to hammer2_chain_lock()
179 */
180#define HAMMER2_RESOLVE_NEVER 1
181#define HAMMER2_RESOLVE_MAYBE 2
182#define HAMMER2_RESOLVE_ALWAYS 3
a0ed3c24
MD
183#define HAMMER2_RESOLVE_MASK 0x0F
184
185#define HAMMER2_RESOLVE_SHARED 0x10
01eabad4 186
6ba3b984
MD
187/*
188 * Cluster different types of storage together for allocations
189 */
190#define HAMMER2_FREECACHE_INODE 0
191#define HAMMER2_FREECACHE_INDIR 1
192#define HAMMER2_FREECACHE_DATA 2
193#define HAMMER2_FREECACHE_UNUSED3 3
194#define HAMMER2_FREECACHE_TYPES 4
195
196/*
197 * BMAP read-ahead maximum parameters
198 */
199#define HAMMER2_BMAP_COUNT 16 /* max bmap read-ahead */
200#define HAMMER2_BMAP_BYTES (HAMMER2_PBUFSIZE * HAMMER2_BMAP_COUNT)
201
1c9f601e
MD
202/*
203 * Misc
204 */
205#define HAMMER2_FLUSH_DEPTH_LIMIT 40 /* stack recursion limit */
206
703720e4 207/*
5c23d7f1 208 * HAMMER2 IN-MEMORY CACHE OF MEDIA STRUCTURES
7cfa8da5 209 *
5c23d7f1
MD
210 * There is an in-memory representation of all on-media data structure.
211 *
212 * When accessed read-only the data will be mapped to the related buffer
213 * cache buffer.
214 *
215 * When accessed read-write (marked modified) a kmalloc()'d copy of the
216 * is created which can then be modified. The copy is destroyed when a
217 * filesystem block is allocated to replace it.
218 *
219 * Active inodes (those with vnodes attached) will maintain the kmalloc()'d
220 * copy for both the read-only and the read-write case. The combination of
221 * (bp) and (data) determines whether (data) was allocated or not.
222 *
223 * The in-memory representation may remain cached (for example in order to
224 * placemark clustering locks) even after the related data has been
225 * detached.
226 */
227
228/*
229 * A hammer2 inode.
46558838
MD
230 *
231 * NOTE: The inode's attribute CST which is also used to lock the inode
232 * is embedded in the chain (chain.cst) and aliased w/ attr_cst.
703720e4
MD
233 */
234struct hammer2_inode {
476d2aad 235 ccms_cst_t topo_cst; /* directory topology cst */
e4e20f48
MD
236 struct hammer2_mount *hmp; /* Global mount */
237 struct hammer2_pfsmount *pmp; /* PFS mount */
e028fa74 238 struct hammer2_inode *pip; /* parent inode */
703720e4 239 struct vnode *vp;
476d2aad 240 hammer2_chain_t *chain;
37aa19df 241 struct lockf advlock;
476d2aad
MD
242 u_int flags;
243 u_int refs; /* +vpref, +flushref */
703720e4
MD
244};
245
54eb943b
MD
246typedef struct hammer2_inode hammer2_inode_t;
247
476d2aad
MD
248#define HAMMER2_INODE_MODIFIED 0x0001
249#define HAMMER2_INODE_DIRTYEMBED 0x0002
51bf8e9b 250#define HAMMER2_INODE_RENAME_INPROG 0x0004
5c23d7f1 251
9061bde5
MD
252/*
253 * XXX
254 */
004f88b4
MD
255struct hammer2_freecache {
256 hammer2_off_t bulk;
257 hammer2_off_t single;
258};
259
260typedef struct hammer2_freecache hammer2_freecache_t;
261
703720e4 262/*
e4e20f48 263 * Global (per device) mount structure for device (aka vp->v_mount->hmp)
703720e4
MD
264 */
265struct hammer2_mount {
50e4f8f4 266 struct vnode *devvp; /* device vnode */
50e4f8f4 267 int ronly; /* read-only mount */
e4e20f48
MD
268 int pmp_count; /* PFS mounts backed by us */
269 TAILQ_ENTRY(hammer2_mount) mntentry; /* hammer2_mntlist */
703720e4 270
5c23d7f1 271 struct malloc_type *minode;
54eb943b
MD
272 int ninodes;
273 int maxinodes;
703720e4 274
5c23d7f1 275 struct malloc_type *mchain;
54eb943b
MD
276 int nipstacks;
277 int maxipstacks;
7cfa8da5
MD
278 hammer2_chain_t vchain; /* anchor chain */
279 hammer2_chain_t *schain; /* super-root */
10252dc7 280 hammer2_inode_t *sroot; /* super-root inode */
01eabad4 281 struct lock alloclk; /* lockmgr lock */
2910a90c 282 struct lock voldatalk; /* lockmgr lock */
703720e4 283
3fc4c63d 284 int volhdrno; /* last volhdrno written */
54eb943b 285 hammer2_volume_data_t voldata;
3fc4c63d 286 hammer2_volume_data_t volsync; /* synchronized voldata */
bfc3a7b1
MD
287 hammer2_freecache_t freecache[HAMMER2_FREECACHE_TYPES]
288 [HAMMER2_MAX_RADIX+1];
703720e4
MD
289};
290
54eb943b
MD
291typedef struct hammer2_mount hammer2_mount_t;
292
e4e20f48
MD
293/*
294 * Per-PFS mount structure for device (aka vp->v_mount)
295 */
296struct hammer2_pfsmount {
297 struct mount *mp; /* kernel mount */
298 struct hammer2_mount *hmp; /* device global mount */
299 hammer2_chain_t *rchain; /* PFS root chain */
300 hammer2_inode_t *iroot; /* PFS root inode */
476d2aad 301 hammer2_off_t inode_count; /* copy of inode_count */
609a8021 302 ccms_domain_t ccms_dom;
e4e20f48
MD
303 struct netexport export; /* nfs export */
304 int ronly; /* read-only mount */
3a5aa68f
MD
305 struct malloc_type *mmsg;
306 kdmsg_iocom_t iocom;
e4e20f48
MD
307};
308
309typedef struct hammer2_pfsmount hammer2_pfsmount_t;
310
703720e4
MD
311#if defined(_KERNEL)
312
313MALLOC_DECLARE(M_HAMMER2);
314
e4e20f48
MD
315#define VTOI(vp) ((hammer2_inode_t *)(vp)->v_data)
316#define ITOV(ip) ((ip)->vp)
317
e118c14f 318static __inline
e4e20f48
MD
319hammer2_pfsmount_t *
320MPTOPMP(struct mount *mp)
703720e4 321{
e4e20f48 322 return ((hammer2_pfsmount_t *)mp->mnt_data);
703720e4
MD
323}
324
e118c14f 325static __inline
e4e20f48
MD
326hammer2_mount_t *
327MPTOHMP(struct mount *mp)
47902fef 328{
e4e20f48 329 return (((hammer2_pfsmount_t *)mp->mnt_data)->hmp);
47902fef
VS
330}
331
703720e4
MD
332extern struct vop_ops hammer2_vnode_vops;
333extern struct vop_ops hammer2_spec_vops;
334extern struct vop_ops hammer2_fifo_vops;
335
37aa19df 336extern int hammer2_debug;
01eabad4 337extern int hammer2_cluster_enable;
e708f8b9 338extern int hammer2_hardlink_enable;
01eabad4
MD
339extern long hammer2_iod_file_read;
340extern long hammer2_iod_meta_read;
341extern long hammer2_iod_indr_read;
342extern long hammer2_iod_file_write;
343extern long hammer2_iod_meta_write;
344extern long hammer2_iod_indr_write;
9061bde5 345extern long hammer2_iod_fmap_write;
01eabad4
MD
346extern long hammer2_iod_volu_write;
347extern long hammer2_ioa_file_read;
348extern long hammer2_ioa_meta_read;
349extern long hammer2_ioa_indr_read;
350extern long hammer2_ioa_file_write;
351extern long hammer2_ioa_meta_write;
352extern long hammer2_ioa_indr_write;
9061bde5 353extern long hammer2_ioa_fmap_write;
01eabad4 354extern long hammer2_ioa_volu_write;
37aa19df 355
7cfa8da5
MD
356/*
357 * hammer2_subr.c
358 */
3a5aa68f
MD
359#define hammer2_icrc32(buf, size) iscsi_crc32((buf), (size))
360#define hammer2_icrc32c(buf, size, crc) iscsi_crc32_ext((buf), (size), (crc))
0c3a8cd0 361
e2e9e2db
MD
362hammer2_chain_t *hammer2_inode_lock_ex(hammer2_inode_t *ip);
363hammer2_chain_t *hammer2_inode_lock_sh(hammer2_inode_t *ip);
364void hammer2_inode_unlock_ex(hammer2_inode_t *ip, hammer2_chain_t *chain);
365void hammer2_inode_unlock_sh(hammer2_inode_t *ip, hammer2_chain_t *chain);
2910a90c
MD
366void hammer2_voldata_lock(hammer2_mount_t *hmp);
367void hammer2_voldata_unlock(hammer2_mount_t *hmp);
476d2aad
MD
368ccms_state_t hammer2_inode_lock_temp_release(hammer2_inode_t *ip);
369ccms_state_t hammer2_inode_lock_upgrade(hammer2_inode_t *ip);
370void hammer2_inode_lock_restore(hammer2_inode_t *ip, ccms_state_t ostate);
e118c14f 371
54eb943b
MD
372void hammer2_mount_exlock(hammer2_mount_t *hmp);
373void hammer2_mount_shlock(hammer2_mount_t *hmp);
374void hammer2_mount_unlock(hammer2_mount_t *hmp);
703720e4 375
476d2aad
MD
376int hammer2_get_dtype(hammer2_chain_t *chain);
377int hammer2_get_vtype(hammer2_chain_t *chain);
37494cab 378u_int8_t hammer2_get_obj_type(enum vtype vtype);
cd4b3d92 379void hammer2_time_to_timespec(u_int64_t xtime, struct timespec *ts);
b2b78aaa 380u_int64_t hammer2_timespec_to_time(struct timespec *ts);
37494cab 381u_int32_t hammer2_to_unix_xid(uuid_t *uuid);
b2b78aaa 382void hammer2_guid_to_uuid(uuid_t *uuid, u_int32_t guid);
e028fa74 383
7cfa8da5 384hammer2_key_t hammer2_dirhash(const unsigned char *name, size_t len);
9061bde5 385int hammer2_allocsize(size_t bytes);
7cfa8da5 386
8cce658d
MD
387int hammer2_calc_logical(hammer2_inode_t *ip, hammer2_off_t uoff,
388 hammer2_key_t *lbasep, hammer2_key_t *leofp);
b2b78aaa 389void hammer2_update_time(uint64_t *timep);
8cce658d 390
7cfa8da5
MD
391/*
392 * hammer2_inode.c
393 */
54eb943b 394struct vnode *hammer2_igetv(hammer2_inode_t *ip, int *errorp);
ae183399 395
e708f8b9
MD
396void hammer2_inode_lock_nlinks(hammer2_inode_t *ip);
397void hammer2_inode_unlock_nlinks(hammer2_inode_t *ip);
10252dc7
MD
398hammer2_inode_t *hammer2_inode_get(hammer2_mount_t *hmp,
399 hammer2_pfsmount_t *pmp, hammer2_inode_t *dip,
400 hammer2_chain_t *chain);
401void hammer2_inode_put(hammer2_inode_t *ip, hammer2_chain_t *passed_chain);
7cfa8da5
MD
402void hammer2_inode_free(hammer2_inode_t *ip);
403void hammer2_inode_ref(hammer2_inode_t *ip);
404void hammer2_inode_drop(hammer2_inode_t *ip);
866d5273 405int hammer2_inode_calc_alloc(hammer2_key_t filesize);
6934ae32 406
e4e20f48 407int hammer2_inode_create(hammer2_inode_t *dip,
e708f8b9
MD
408 struct vattr *vap, struct ucred *cred,
409 const uint8_t *name, size_t name_len,
e2e9e2db 410 hammer2_inode_t **nipp, hammer2_chain_t **nchainp);
6934ae32 411
51bf8e9b
MD
412int hammer2_inode_duplicate(hammer2_inode_t *dip,
413 hammer2_chain_t *ochain, hammer2_chain_t **nchainp);
414int hammer2_inode_connect(hammer2_inode_t *dip, hammer2_chain_t **chainp,
db0c2eb3 415 const uint8_t *name, size_t name_len);
f3843dc2
MD
416hammer2_inode_t *hammer2_inode_common_parent(hammer2_mount_t *hmp,
417 hammer2_inode_t *fdip, hammer2_inode_t *tdip);
db0c2eb3 418
ae183399 419int hammer2_unlink_file(hammer2_inode_t *dip,
004f88b4 420 const uint8_t *name, size_t name_len,
10252dc7 421 int isdir, hammer2_chain_t *retain_chain);
51bf8e9b
MD
422int hammer2_hardlink_consolidate(hammer2_inode_t *ip, hammer2_chain_t **chainp,
423 hammer2_inode_t *tdip, int linkcnt);
e708f8b9 424int hammer2_hardlink_deconsolidate(hammer2_inode_t *dip,
476d2aad
MD
425 hammer2_chain_t **chainp, hammer2_chain_t **ochainp);
426int hammer2_hardlink_find(hammer2_inode_t *dip,
427 hammer2_chain_t **chainp, hammer2_chain_t **ochainp);
ae183399 428
7cfa8da5
MD
429/*
430 * hammer2_chain.c
431 */
2910a90c 432void hammer2_modify_volume(hammer2_mount_t *hmp);
5c23d7f1
MD
433hammer2_chain_t *hammer2_chain_alloc(hammer2_mount_t *hmp,
434 hammer2_blockref_t *bref);
435void hammer2_chain_free(hammer2_mount_t *hmp, hammer2_chain_t *chain);
7cfa8da5
MD
436void hammer2_chain_ref(hammer2_mount_t *hmp, hammer2_chain_t *chain);
437void hammer2_chain_drop(hammer2_mount_t *hmp, hammer2_chain_t *chain);
01eabad4
MD
438int hammer2_chain_lock(hammer2_mount_t *hmp, hammer2_chain_t *chain, int how);
439void hammer2_chain_moved(hammer2_mount_t *hmp, hammer2_chain_t *chain);
214f4a77 440void hammer2_chain_modify(hammer2_mount_t *hmp, hammer2_chain_t *chain,
01eabad4 441 int flags);
28ee5f14 442void hammer2_chain_resize(hammer2_inode_t *ip, hammer2_chain_t *chain,
01eabad4 443 int nradix, int flags);
5c23d7f1 444void hammer2_chain_unlock(hammer2_mount_t *hmp, hammer2_chain_t *chain);
5f6853df 445void hammer2_chain_wait(hammer2_mount_t *hmp, hammer2_chain_t *chain);
b7926f31
MD
446hammer2_chain_t *hammer2_chain_find(hammer2_mount_t *hmp,
447 hammer2_chain_t *parent, int index);
232a50f9 448hammer2_chain_t *hammer2_chain_get(hammer2_mount_t *hmp,
c667909f
MD
449 hammer2_chain_t *parent,
450 int index, int flags);
5c23d7f1 451hammer2_chain_t *hammer2_chain_lookup(hammer2_mount_t *hmp,
e028fa74 452 hammer2_chain_t **parentp,
c667909f
MD
453 hammer2_key_t key_beg, hammer2_key_t key_end,
454 int flags);
7cfa8da5 455hammer2_chain_t *hammer2_chain_next(hammer2_mount_t *hmp,
5c23d7f1
MD
456 hammer2_chain_t **parentp,
457 hammer2_chain_t *chain,
c667909f
MD
458 hammer2_key_t key_beg, hammer2_key_t key_end,
459 int flags);
5c23d7f1
MD
460hammer2_chain_t *hammer2_chain_create(hammer2_mount_t *hmp,
461 hammer2_chain_t *parent,
6934ae32 462 hammer2_chain_t *chain,
5c23d7f1 463 hammer2_key_t key, int keybits,
5f6853df
MD
464 int type, size_t bytes,
465 int *errorp);
3ac6a319 466void hammer2_chain_delete(hammer2_mount_t *hmp, hammer2_chain_t *parent,
004f88b4 467 hammer2_chain_t *chain, int retain);
4d5318eb
MD
468void hammer2_chain_flush(hammer2_mount_t *hmp, hammer2_chain_t *chain,
469 hammer2_tid_t modify_tid);
b7926f31 470void hammer2_chain_commit(hammer2_mount_t *hmp, hammer2_chain_t *chain);
32b800e6
MD
471void hammer2_chain_parent_setsubmod(hammer2_mount_t *hmp,
472 hammer2_chain_t *chain);
50e4f8f4 473
2910a90c
MD
474/*
475 * hammer2_ioctl.c
476 */
477int hammer2_ioctl(hammer2_inode_t *ip, u_long com, void *data,
478 int fflag, struct ucred *cred);
479
9b8b748f
MD
480/*
481 * hammer2_msgops.c
482 */
3a5aa68f
MD
483int hammer2_msg_dbg_rcvmsg(kdmsg_msg_t *msg);
484int hammer2_msg_adhoc_input(kdmsg_msg_t *msg);
26bf1a36 485
1a34728c
MD
486/*
487 * hammer2_vfsops.c
488 */
3a5aa68f 489void hammer2_clusterctl_wakeup(kdmsg_iocom_t *iocom);
1a34728c
MD
490void hammer2_volconf_update(hammer2_pfsmount_t *pmp, int index);
491void hammer2_cluster_reconnect(hammer2_pfsmount_t *pmp, struct file *fp);
492
df9ea374
MD
493/*
494 * hammer2_freemap.c
495 */
6ba3b984
MD
496hammer2_off_t hammer2_freemap_alloc(hammer2_mount_t *hmp,
497 int type, size_t bytes);
004f88b4
MD
498void hammer2_freemap_free(hammer2_mount_t *hmp, hammer2_off_t data_off,
499 int type);
df9ea374 500
47902fef
VS
501#endif /* !_KERNEL */
502#endif /* !_VFS_HAMMER2_HAMMER2_H_ */