2 * Copyright (c) 2011-2013 The DragonFly Project. All rights reserved.
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>
8 * Redistribution and use in source and binary forms, with or without
9 * modification, are permitted provided that the following conditions
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
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.
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
37 * This header file contains structures used internally by the HAMMER2
38 * implementation. See hammer2_disk.h for on-disk structures.
41 #ifndef _VFS_HAMMER2_HAMMER2_H_
42 #define _VFS_HAMMER2_HAMMER2_H_
44 #include <sys/param.h>
45 #include <sys/types.h>
46 #include <sys/kernel.h>
48 #include <sys/systm.h>
50 #include <sys/malloc.h>
51 #include <sys/mount.h>
52 #include <sys/vnode.h>
54 #include <sys/mountctl.h>
57 #include <sys/thread.h>
58 #include <sys/globaldata.h>
59 #include <sys/lockf.h>
61 #include <sys/queue.h>
62 #include <sys/limits.h>
64 #include <sys/signal2.h>
68 #include "hammer2_disk.h"
69 #include "hammer2_mount.h"
70 #include "hammer2_ioctl.h"
71 #include "hammer2_ccms.h"
76 struct hammer2_pfsmount;
82 * The chain structure tracks blockref recursions all the way to the root
83 * volume. These consist of indirect blocks, inodes, and eventually the
84 * volume header itself.
86 * In situations where a duplicate is needed to represent different snapshots
87 * or flush points a new chain will be allocated but associated with the
88 * same shared chain_core. The RBTREE is contained in the shared chain_core
89 * and entries in the RBTREE are versioned.
91 * Duplication can occur whenever a chain must be modified. Note that
92 * a deletion is not considered a modification.
94 * (a) General modifications at data leafs
95 * (b) When a chain is resized
96 * (c) When a chain's blockref array is updated
97 * (d) When a chain is renamed
98 * (e) When a chain is moved (when an indirect block is split)
102 * (1) Fully coherent snapshots can be taken without requiring
103 * a pre-flush, resulting in extremely fast (sub-millisecond)
106 * (2) Multiple synchronization points can be in-flight at the same
107 * time, representing multiple snapshots or flushes.
109 * (3) The algorithms needed to keep track of everything are actually
112 * Special Considerations:
114 * A chain is ref-counted on a per-chain basis, but the chain's lock
115 * is associated with the shared chain_core and is not per-chain.
117 * Each chain is representative of a filesystem topology. Even
118 * though the shared chain_core's are effectively multi-homed, the
119 * chain structure is not.
121 * chain->parent is a stable pointer and can be iterated without locking
122 * as long as either the chain or *any* deep child under the chain
125 RB_HEAD(hammer2_chain_tree, hammer2_chain);
126 TAILQ_HEAD(flush_deferral_list, hammer2_chain);
128 struct hammer2_chain_core {
130 struct hammer2_chain_tree rbtree;
131 struct hammer2_chain *first_parent;
136 typedef struct hammer2_chain_core hammer2_chain_core_t;
138 #define HAMMER2_CORE_INDIRECT 0x0001
140 struct hammer2_chain {
141 RB_ENTRY(hammer2_chain) rbnode;
142 hammer2_blockref_t bref;
143 hammer2_chain_core_t *core;
144 hammer2_chain_core_t *above;
145 struct hammer2_chain *next_parent;
146 struct hammer2_state *state; /* if active cache msg */
147 struct hammer2_mount *hmp;
149 struct hammer2_chain *duplink; /* duplication link */
152 hammer2_tid_t modify_tid; /* snapshot/flush filter */
153 hammer2_tid_t delete_tid;
154 struct buf *bp; /* physical data buffer */
155 u_int bytes; /* physical data size */
156 int index; /* blockref index in parent */
160 hammer2_media_data_t *data; /* data pointer shortcut */
161 TAILQ_ENTRY(hammer2_chain) flush_node; /* flush deferral list */
164 typedef struct hammer2_chain hammer2_chain_t;
166 int hammer2_chain_cmp(hammer2_chain_t *chain1, hammer2_chain_t *chain2);
167 RB_PROTOTYPE(hammer2_chain_tree, hammer2_chain, rbnode, hammer2_chain_cmp);
169 #define HAMMER2_CHAIN_MODIFIED 0x00000001 /* dirty chain data */
170 #define HAMMER2_CHAIN_ALLOCATED 0x00000002 /* kmalloc'd chain */
171 #define HAMMER2_CHAIN_DIRTYBP 0x00000004 /* dirty on unlock */
172 #define HAMMER2_CHAIN_SUBMODIFIED 0x00000008 /* recursive flush */
173 #define HAMMER2_CHAIN_DELETED 0x00000010 /* deleted chain */
174 #define HAMMER2_CHAIN_INITIAL 0x00000020 /* initial create */
175 #define HAMMER2_CHAIN_FLUSHED 0x00000040 /* flush on unlock */
176 #define HAMMER2_CHAIN_MOVED 0x00000080 /* bref changed */
177 #define HAMMER2_CHAIN_IOFLUSH 0x00000100 /* bawrite on put */
178 #define HAMMER2_CHAIN_DEFERRED 0x00000200 /* on a deferral list */
179 #define HAMMER2_CHAIN_DESTROYED 0x00000400 /* destroying inode */
180 #define HAMMER2_CHAIN_VOLUMESYNC 0x00000800 /* needs volume sync */
181 #define HAMMER2_CHAIN_RECYCLE 0x00001000 /* force recycle */
182 #define HAMMER2_CHAIN_MOUNTED 0x00002000 /* PFS is mounted */
183 #define HAMMER2_CHAIN_ONRBTREE 0x00004000 /* on parent RB tree */
184 #define HAMMER2_CHAIN_SNAPSHOT 0x00008000 /* snapshot special */
187 * Flags passed to hammer2_chain_lookup() and hammer2_chain_next()
189 #define HAMMER2_LOOKUP_NOLOCK 0x00000001 /* ref only */
190 #define HAMMER2_LOOKUP_NODATA 0x00000002 /* data left NULL */
191 #define HAMMER2_LOOKUP_SHARED 0x00000100
194 * Flags passed to hammer2_chain_modify() and hammer2_chain_resize()
196 * NOTE: OPTDATA allows us to avoid instantiating buffers for INDIRECT
197 * blocks in the INITIAL-create state.
199 #define HAMMER2_MODIFY_OPTDATA 0x00000002 /* data can be NULL */
200 #define HAMMER2_MODIFY_NO_MODIFY_TID 0x00000004
201 #define HAMMER2_MODIFY_ASSERTNOCOPY 0x00000008
204 * Flags passed to hammer2_chain_lock()
206 #define HAMMER2_RESOLVE_NEVER 1
207 #define HAMMER2_RESOLVE_MAYBE 2
208 #define HAMMER2_RESOLVE_ALWAYS 3
209 #define HAMMER2_RESOLVE_MASK 0x0F
211 #define HAMMER2_RESOLVE_SHARED 0x10
212 #define HAMMER2_RESOLVE_NOREF 0x20
215 * Cluster different types of storage together for allocations
217 #define HAMMER2_FREECACHE_INODE 0
218 #define HAMMER2_FREECACHE_INDIR 1
219 #define HAMMER2_FREECACHE_DATA 2
220 #define HAMMER2_FREECACHE_UNUSED3 3
221 #define HAMMER2_FREECACHE_TYPES 4
224 * BMAP read-ahead maximum parameters
226 #define HAMMER2_BMAP_COUNT 16 /* max bmap read-ahead */
227 #define HAMMER2_BMAP_BYTES (HAMMER2_PBUFSIZE * HAMMER2_BMAP_COUNT)
232 #define HAMMER2_FLUSH_DEPTH_LIMIT 40 /* stack recursion limit */
235 * HAMMER2 IN-MEMORY CACHE OF MEDIA STRUCTURES
237 * There is an in-memory representation of all on-media data structure.
239 * When accessed read-only the data will be mapped to the related buffer
242 * When accessed read-write (marked modified) a kmalloc()'d copy of the
243 * is created which can then be modified. The copy is destroyed when a
244 * filesystem block is allocated to replace it.
246 * Active inodes (those with vnodes attached) will maintain the kmalloc()'d
247 * copy for both the read-only and the read-write case. The combination of
248 * (bp) and (data) determines whether (data) was allocated or not.
250 * The in-memory representation may remain cached (for example in order to
251 * placemark clustering locks) even after the related data has been
255 RB_HEAD(hammer2_inode_tree, hammer2_inode);
260 * NOTE: The inode's attribute CST which is also used to lock the inode
261 * is embedded in the chain (chain.cst) and aliased w/ attr_cst.
263 struct hammer2_inode {
264 RB_ENTRY(hammer2_inode) rbnode; /* inumber lookup (HL) */
265 ccms_cst_t topo_cst; /* directory topology cst */
266 struct hammer2_mount *hmp; /* Global mount */
267 struct hammer2_pfsmount *pmp; /* PFS mount */
268 struct hammer2_inode *pip; /* parent inode */
270 hammer2_chain_t *chain; /* NOTE: rehomed on rename */
271 struct lockf advlock;
274 u_int refs; /* +vpref, +flushref */
277 typedef struct hammer2_inode hammer2_inode_t;
279 #define HAMMER2_INODE_MODIFIED 0x0001
280 #define HAMMER2_INODE_UNUSED0002 0x0002
281 #define HAMMER2_INODE_RENAME_INPROG 0x0004
282 #define HAMMER2_INODE_ONRBTREE 0x0008
284 int hammer2_inode_cmp(hammer2_inode_t *ip1, hammer2_inode_t *ip2);
285 RB_PROTOTYPE2(hammer2_inode_tree, hammer2_inode, rbnode, hammer2_inode_cmp,
289 * A hammer2 transaction and flush sequencing structure.
291 * This global structure is tied into hammer2_mount and is used
292 * to sequence modifying operations and flushes.
294 * (a) Any modifying operations with sync_tid >= flush_tid will stall until
295 * all modifying operating with sync_tid < flush_tid complete.
297 * The flush related to flush_tid stalls until all modifying operations
298 * with sync_tid < flush_tid complete.
300 * (b) Once unstalled, modifying operations with sync_tid > flush_tid are
301 * allowed to run. All modifications cause modify/duplicate operations
302 * to occur on the related chains. Note that most INDIRECT blocks will
303 * be unaffected because the modifications just overload the RBTREE
304 * structurally instead of actually modifying the indirect blocks.
306 * (c) The actual flush unstalls and RUNS CONCURRENTLY with (b), but only
307 * utilizes the chain structures with sync_tid <= flush_tid. The
308 * flush will modify related indirect blocks and inodes in-place
309 * (rather than duplicate) since the adjustments are compatible with
310 * (b)'s RBTREE overloading
312 * SPECIAL NOTE: Inode modifications have to also propagate along any
313 * modify/duplicate chains. File writes detect the flush
314 * and force out the conflicting buffer cache buffer(s)
315 * before reusing them.
317 * (d) Snapshots can be made instantly but must be flushed and disconnected
318 * from their duplicative source before they can be mounted. This is
319 * because while H2's on-media structure supports forks, its in-memory
320 * structure only supports very simple forking for background flushing
323 * TODO: Flush merging. When fsync() is called on multiple discrete files
324 * concurrently there is no reason to stall the second fsync.
325 * The final flush that reaches to root can cover both fsync()s.
327 * The chains typically terminate as they fly onto the disk. The flush
328 * ultimately reaches the volume header.
330 struct hammer2_trans {
331 TAILQ_ENTRY(hammer2_trans) entry;
332 struct hammer2_mount *hmp;
333 hammer2_tid_t sync_tid;
337 uint8_t inodes_created;
341 typedef struct hammer2_trans hammer2_trans_t;
343 #define HAMMER2_TRANS_ISFLUSH 0x0001
344 #define HAMMER2_TRANS_RESTRICTED 0x0002 /* snapshot flush restrict */
349 struct hammer2_freecache {
351 hammer2_off_t single;
354 typedef struct hammer2_freecache hammer2_freecache_t;
357 * Global (per device) mount structure for device (aka vp->v_mount->hmp)
359 TAILQ_HEAD(hammer2_trans_queue, hammer2_trans);
361 struct hammer2_mount {
362 struct vnode *devvp; /* device vnode */
363 int ronly; /* read-only mount */
364 int pmp_count; /* PFS mounts backed by us */
365 TAILQ_ENTRY(hammer2_mount) mntentry; /* hammer2_mntlist */
367 struct malloc_type *minode;
371 struct malloc_type *mchain;
374 hammer2_chain_t vchain; /* anchor chain */
375 hammer2_chain_t *schain; /* super-root */
376 hammer2_inode_t *sroot; /* super-root inode */
377 struct lock alloclk; /* lockmgr lock */
378 struct lock voldatalk; /* lockmgr lock */
379 struct hammer2_trans_queue transq; /* all in-progress transactions */
380 hammer2_trans_t *curflush; /* current flush in progress */
381 hammer2_tid_t flush_tid; /* currently synchronizing flush pt */
382 int flushcnt; /* #of flush trans on the list */
384 int volhdrno; /* last volhdrno written */
385 hammer2_volume_data_t voldata;
386 hammer2_volume_data_t volsync; /* synchronized voldata */
387 hammer2_freecache_t freecache[HAMMER2_FREECACHE_TYPES]
388 [HAMMER2_MAX_RADIX+1];
391 typedef struct hammer2_mount hammer2_mount_t;
394 * Per-PFS mount structure for device (aka vp->v_mount)
396 struct hammer2_pfsmount {
397 struct mount *mp; /* kernel mount */
398 struct hammer2_mount *hmp; /* device global mount */
399 hammer2_chain_t *rchain; /* PFS root chain */
400 hammer2_inode_t *iroot; /* PFS root inode */
401 hammer2_off_t inode_count; /* copy of inode_count */
402 ccms_domain_t ccms_dom;
403 struct netexport export; /* nfs export */
404 int ronly; /* read-only mount */
405 struct malloc_type *mmsg;
407 struct spinlock inum_spin; /* inumber lookup */
408 struct hammer2_inode_tree inum_tree;
411 typedef struct hammer2_pfsmount hammer2_pfsmount_t;
415 MALLOC_DECLARE(M_HAMMER2);
417 #define VTOI(vp) ((hammer2_inode_t *)(vp)->v_data)
418 #define ITOV(ip) ((ip)->vp)
422 MPTOPMP(struct mount *mp)
424 return ((hammer2_pfsmount_t *)mp->mnt_data);
429 MPTOHMP(struct mount *mp)
431 return (((hammer2_pfsmount_t *)mp->mnt_data)->hmp);
436 hammer2_chain_refactor_test(hammer2_chain_t *chain, int traverse_hlink)
438 if ((chain->flags & HAMMER2_CHAIN_DELETED) &&
439 chain->next_parent &&
440 (chain->next_parent->flags & HAMMER2_CHAIN_SNAPSHOT) == 0) {
443 if (traverse_hlink &&
444 chain->bref.type == HAMMER2_BREF_TYPE_INODE &&
445 chain->data->ipdata.type == HAMMER2_OBJTYPE_HARDLINK &&
446 chain->next_parent &&
447 (chain->next_parent->flags & HAMMER2_CHAIN_SNAPSHOT) == 0) {
454 extern struct vop_ops hammer2_vnode_vops;
455 extern struct vop_ops hammer2_spec_vops;
456 extern struct vop_ops hammer2_fifo_vops;
458 extern int hammer2_debug;
459 extern int hammer2_cluster_enable;
460 extern int hammer2_hardlink_enable;
461 extern long hammer2_iod_file_read;
462 extern long hammer2_iod_meta_read;
463 extern long hammer2_iod_indr_read;
464 extern long hammer2_iod_file_write;
465 extern long hammer2_iod_meta_write;
466 extern long hammer2_iod_indr_write;
467 extern long hammer2_iod_fmap_write;
468 extern long hammer2_iod_volu_write;
469 extern long hammer2_ioa_file_read;
470 extern long hammer2_ioa_meta_read;
471 extern long hammer2_ioa_indr_read;
472 extern long hammer2_ioa_file_write;
473 extern long hammer2_ioa_meta_write;
474 extern long hammer2_ioa_indr_write;
475 extern long hammer2_ioa_fmap_write;
476 extern long hammer2_ioa_volu_write;
481 #define hammer2_icrc32(buf, size) iscsi_crc32((buf), (size))
482 #define hammer2_icrc32c(buf, size, crc) iscsi_crc32_ext((buf), (size), (crc))
484 hammer2_chain_t *hammer2_inode_lock_ex(hammer2_inode_t *ip);
485 hammer2_chain_t *hammer2_inode_lock_sh(hammer2_inode_t *ip);
486 void hammer2_inode_unlock_ex(hammer2_inode_t *ip, hammer2_chain_t *chain);
487 void hammer2_inode_unlock_sh(hammer2_inode_t *ip, hammer2_chain_t *chain);
488 void hammer2_voldata_lock(hammer2_mount_t *hmp);
489 void hammer2_voldata_unlock(hammer2_mount_t *hmp, int modify);
490 ccms_state_t hammer2_inode_lock_temp_release(hammer2_inode_t *ip);
491 void hammer2_inode_lock_temp_restore(hammer2_inode_t *ip, ccms_state_t ostate);
492 ccms_state_t hammer2_inode_lock_upgrade(hammer2_inode_t *ip);
493 void hammer2_inode_lock_downgrade(hammer2_inode_t *ip, ccms_state_t ostate);
495 void hammer2_mount_exlock(hammer2_mount_t *hmp);
496 void hammer2_mount_shlock(hammer2_mount_t *hmp);
497 void hammer2_mount_unlock(hammer2_mount_t *hmp);
499 int hammer2_get_dtype(hammer2_chain_t *chain);
500 int hammer2_get_vtype(hammer2_chain_t *chain);
501 u_int8_t hammer2_get_obj_type(enum vtype vtype);
502 void hammer2_time_to_timespec(u_int64_t xtime, struct timespec *ts);
503 u_int64_t hammer2_timespec_to_time(struct timespec *ts);
504 u_int32_t hammer2_to_unix_xid(uuid_t *uuid);
505 void hammer2_guid_to_uuid(uuid_t *uuid, u_int32_t guid);
507 hammer2_key_t hammer2_dirhash(const unsigned char *name, size_t len);
508 int hammer2_allocsize(size_t bytes);
510 int hammer2_calc_logical(hammer2_inode_t *ip, hammer2_off_t uoff,
511 hammer2_key_t *lbasep, hammer2_key_t *leofp);
512 void hammer2_update_time(uint64_t *timep);
517 struct vnode *hammer2_igetv(hammer2_inode_t *ip, int *errorp);
519 void hammer2_inode_lock_nlinks(hammer2_inode_t *ip);
520 void hammer2_inode_unlock_nlinks(hammer2_inode_t *ip);
521 hammer2_inode_t *hammer2_inode_lookup(hammer2_pfsmount_t *pmp,
523 hammer2_inode_t *hammer2_inode_get(hammer2_mount_t *hmp,
524 hammer2_pfsmount_t *pmp, hammer2_inode_t *dip,
525 hammer2_chain_t *chain);
526 void hammer2_inode_put(hammer2_inode_t *ip, hammer2_chain_t *chain);
527 void hammer2_inode_free(hammer2_inode_t *ip);
528 void hammer2_inode_ref(hammer2_inode_t *ip);
529 void hammer2_inode_drop(hammer2_inode_t *ip);
530 void hammer2_inode_repoint(hammer2_inode_t *ip, hammer2_inode_t *pip,
531 hammer2_chain_t *chain);
532 int hammer2_inode_calc_alloc(hammer2_key_t filesize);
534 hammer2_inode_t *hammer2_inode_create(hammer2_trans_t *trans,
535 hammer2_inode_t *dip,
536 struct vattr *vap, struct ucred *cred,
537 const uint8_t *name, size_t name_len,
538 hammer2_chain_t **chainp, int *errorp);
539 int hammer2_inode_connect(hammer2_trans_t *trans, int hlink,
540 hammer2_inode_t *dip, hammer2_chain_t **chainp,
541 const uint8_t *name, size_t name_len);
542 hammer2_inode_t *hammer2_inode_common_parent(hammer2_inode_t *fdip,
543 hammer2_inode_t *tdip);
545 int hammer2_unlink_file(hammer2_trans_t *trans, hammer2_inode_t *dip,
546 const uint8_t *name, size_t name_len, int isdir,
548 int hammer2_hardlink_consolidate(hammer2_trans_t *trans, hammer2_inode_t *ip,
549 hammer2_chain_t **chainp,
550 hammer2_inode_t *tdip, int linkcnt);
551 int hammer2_hardlink_deconsolidate(hammer2_trans_t *trans, hammer2_inode_t *dip,
552 hammer2_chain_t **chainp, hammer2_chain_t **ochainp);
553 int hammer2_hardlink_find(hammer2_inode_t *dip,
554 hammer2_chain_t **chainp, hammer2_chain_t **ochainp);
559 void hammer2_modify_volume(hammer2_mount_t *hmp);
560 hammer2_chain_t *hammer2_chain_alloc(hammer2_mount_t *hmp,
561 hammer2_trans_t *trans,
562 hammer2_blockref_t *bref);
563 void hammer2_chain_core_alloc(hammer2_chain_t *chain,
564 hammer2_chain_core_t *core);
565 void hammer2_chain_ref(hammer2_chain_t *chain);
566 void hammer2_chain_drop(hammer2_chain_t *chain);
567 int hammer2_chain_lock(hammer2_chain_t *chain, int how);
568 void hammer2_chain_moved(hammer2_chain_t *chain);
569 void hammer2_chain_modify(hammer2_trans_t *trans,
570 hammer2_chain_t **chainp, int flags);
571 hammer2_inode_data_t *hammer2_chain_modify_ip(hammer2_trans_t *trans,
572 hammer2_inode_t *ip, hammer2_chain_t **chainp,
574 void hammer2_chain_resize(hammer2_trans_t *trans, hammer2_inode_t *ip,
576 hammer2_chain_t *parent,
577 hammer2_chain_t **chainp,
578 int nradix, int flags);
579 void hammer2_chain_unlock(hammer2_chain_t *chain);
580 void hammer2_chain_wait(hammer2_chain_t *chain);
581 hammer2_chain_t *hammer2_chain_find(hammer2_chain_t *parent, int index);
582 hammer2_chain_t *hammer2_chain_get(hammer2_chain_t *parent, int index,
584 hammer2_chain_t *hammer2_chain_lookup_init(hammer2_chain_t *parent, int flags);
585 void hammer2_chain_lookup_done(hammer2_chain_t *parent);
586 hammer2_chain_t *hammer2_chain_lookup(hammer2_chain_t **parentp,
587 hammer2_key_t key_beg, hammer2_key_t key_end,
589 hammer2_chain_t *hammer2_chain_next(hammer2_chain_t **parentp,
590 hammer2_chain_t *chain,
591 hammer2_key_t key_beg, hammer2_key_t key_end,
593 int hammer2_chain_create(hammer2_trans_t *trans,
594 hammer2_chain_t **parentp,
595 hammer2_chain_t **chainp,
596 hammer2_key_t key, int keybits,
597 int type, size_t bytes);
598 void hammer2_chain_duplicate(hammer2_trans_t *trans, hammer2_chain_t *parent,
600 hammer2_chain_t **chainp,
601 hammer2_blockref_t *bref);
602 int hammer2_chain_snapshot(hammer2_trans_t *trans, hammer2_inode_t *ip,
603 hammer2_ioc_pfs_t *pfs);
604 void hammer2_chain_delete(hammer2_trans_t *trans, hammer2_chain_t *chain);
605 void hammer2_chain_delete_duplicate(hammer2_trans_t *trans,
606 hammer2_chain_t **chainp);
607 void hammer2_chain_flush(hammer2_trans_t *trans, hammer2_chain_t *chain);
608 void hammer2_chain_commit(hammer2_trans_t *trans, hammer2_chain_t *chain);
609 void hammer2_chain_setsubmod(hammer2_trans_t *trans, hammer2_chain_t *chain);
614 void hammer2_trans_init(hammer2_mount_t *hmp, hammer2_trans_t *trans,
616 void hammer2_trans_done(hammer2_trans_t *trans);
621 int hammer2_ioctl(hammer2_inode_t *ip, u_long com, void *data,
622 int fflag, struct ucred *cred);
627 int hammer2_msg_dbg_rcvmsg(kdmsg_msg_t *msg);
628 int hammer2_msg_adhoc_input(kdmsg_msg_t *msg);
633 void hammer2_clusterctl_wakeup(kdmsg_iocom_t *iocom);
634 void hammer2_volconf_update(hammer2_pfsmount_t *pmp, int index);
635 void hammer2_cluster_reconnect(hammer2_pfsmount_t *pmp, struct file *fp);
636 void hammer2_dump_chain(hammer2_chain_t *chain, int tab, int *countp);
641 hammer2_off_t hammer2_freemap_alloc(hammer2_mount_t *hmp,
642 int type, size_t bytes);
643 void hammer2_freemap_free(hammer2_mount_t *hmp, hammer2_off_t data_off,
646 #endif /* !_KERNEL */
647 #endif /* !_VFS_HAMMER2_HAMMER2_H_ */