HAMMER 46/Many: Performance pass, media changes, bug fixes.
[dragonfly.git] / sys / vfs / hammer / hammer.h
CommitLineData
8750964d 1/*
1f07f686 2 * Copyright (c) 2007-2008 The DragonFly Project. All rights reserved.
8750964d
MD
3 *
4 * This code is derived from software contributed to The DragonFly Project
5 * by Matthew Dillon <dillon@backplane.com>
6 *
7 * Redistribution and use in source and binary forms, with or without
8 * modification, are permitted provided that the following conditions
9 * are met:
10 *
11 * 1. Redistributions of source code must retain the above copyright
12 * notice, this list of conditions and the following disclaimer.
13 * 2. Redistributions in binary form must reproduce the above copyright
14 * notice, this list of conditions and the following disclaimer in
15 * the documentation and/or other materials provided with the
16 * distribution.
17 * 3. Neither the name of The DragonFly Project nor the names of its
18 * contributors may be used to endorse or promote products derived
19 * from this software without specific, prior written permission.
20 *
21 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
22 * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
23 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
24 * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
25 * COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
26 * INCIDENTAL, SPECIAL, EXEMPLARY OR CONSEQUENTIAL DAMAGES (INCLUDING,
27 * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
28 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
29 * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
30 * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
31 * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
32 * SUCH DAMAGE.
33 *
2f85fa4d 34 * $DragonFly: src/sys/vfs/hammer/hammer.h,v 1.69 2008/05/18 01:48:50 dillon Exp $
8750964d
MD
35 */
36/*
37 * This header file contains structures used internally by the HAMMERFS
c60bb2c5 38 * implementation. See hammer_disk.h for on-disk structures.
8750964d
MD
39 */
40
427e5fc6
MD
41#include <sys/param.h>
42#include <sys/types.h>
43#include <sys/kernel.h>
42c7d26b 44#include <sys/conf.h>
427e5fc6 45#include <sys/systm.h>
8750964d
MD
46#include <sys/tree.h>
47#include <sys/malloc.h>
427e5fc6 48#include <sys/mount.h>
513ca7d7 49#include <sys/mountctl.h>
427e5fc6 50#include <sys/vnode.h>
42c7d26b 51#include <sys/proc.h>
427e5fc6 52#include <sys/globaldata.h>
66325755
MD
53#include <sys/lockf.h>
54#include <sys/buf.h>
8cd0a023 55#include <sys/queue.h>
66325755
MD
56#include <sys/globaldata.h>
57
58#include <sys/buf2.h>
855942b6 59#include <sys/signal2.h>
427e5fc6 60#include "hammer_disk.h"
8750964d 61#include "hammer_mount.h"
7dc57964 62#include "hammer_ioctl.h"
8750964d
MD
63
64#if defined(_KERNEL) || defined(_KERNEL_STRUCTURES)
65
66MALLOC_DECLARE(M_HAMMER);
67
66325755
MD
68struct hammer_mount;
69
8750964d
MD
70/*
71 * Key structure used for custom RB tree inode lookups. This prototypes
72 * the function hammer_ino_rb_tree_RB_LOOKUP_INFO(root, info).
73 */
74typedef struct hammer_inode_info {
513ca7d7 75 int64_t obj_id; /* (key) object identifier */
8750964d
MD
76 hammer_tid_t obj_asof; /* (key) snapshot transid or 0 */
77} *hammer_inode_info_t;
78
b84de5af
MD
79typedef enum hammer_transaction_type {
80 HAMMER_TRANS_RO,
81 HAMMER_TRANS_STD,
82 HAMMER_TRANS_FLS
83} hammer_transaction_type_t;
84
66325755
MD
85/*
86 * HAMMER Transaction tracking
87 */
88struct hammer_transaction {
b84de5af 89 hammer_transaction_type_t type;
66325755
MD
90 struct hammer_mount *hmp;
91 hammer_tid_t tid;
b84de5af 92 hammer_tid_t time;
2f85fa4d 93 int sync_lock_refs;
a89aec1b 94 struct hammer_volume *rootvol;
66325755
MD
95};
96
8cd0a023
MD
97typedef struct hammer_transaction *hammer_transaction_t;
98
66325755
MD
99/*
100 * HAMMER locks
101 */
427e5fc6 102struct hammer_lock {
0b075555 103 int refs; /* active references delay writes */
0b075555 104 int lockcount; /* lock count for exclusive/shared access */
427e5fc6
MD
105 int wanted;
106 struct thread *locktd;
8750964d
MD
107};
108
427e5fc6
MD
109static __inline int
110hammer_islocked(struct hammer_lock *lock)
111{
8cd0a023 112 return(lock->lockcount != 0);
427e5fc6
MD
113}
114
0b075555
MD
115static __inline int
116hammer_isactive(struct hammer_lock *lock)
117{
118 return(lock->refs != 0);
119}
120
427e5fc6
MD
121static __inline int
122hammer_islastref(struct hammer_lock *lock)
123{
124 return(lock->refs == 1);
125}
c60bb2c5 126
6a37e7e4 127/*
7aa3b8a6 128 * Return if we specifically own the lock exclusively.
6a37e7e4
MD
129 */
130static __inline int
7aa3b8a6 131hammer_lock_excl_owned(struct hammer_lock *lock, thread_t td)
6a37e7e4 132{
7aa3b8a6
MD
133 if (lock->lockcount > 0 && lock->locktd == td)
134 return(1);
135 return(0);
6a37e7e4
MD
136}
137
ec4e8497 138/*
1f07f686 139 * Flush state, used by various structures
ec4e8497 140 */
1f07f686
MD
141typedef enum hammer_inode_state {
142 HAMMER_FST_IDLE,
143 HAMMER_FST_SETUP,
144 HAMMER_FST_FLUSH
145} hammer_inode_state_t;
ec4e8497 146
1f07f686 147TAILQ_HEAD(hammer_record_list, hammer_record);
ec4e8497 148
0729c8c8
MD
149/*
150 * Cache object ids. A fixed number of objid cache structures are
151 * created to reserve object id's for newly created files in multiples
152 * of 100,000, localized to a particular directory, and recycled as
153 * needed. This allows parallel create operations in different
154 * directories to retain fairly localized object ids which in turn
155 * improves reblocking performance and layout.
156 */
157#define OBJID_CACHE_SIZE 128
158#define OBJID_CACHE_BULK 100000
159
160typedef struct hammer_objid_cache {
161 TAILQ_ENTRY(hammer_objid_cache) entry;
162 struct hammer_inode *dip;
163 hammer_tid_t next_tid;
164 int count;
165} *hammer_objid_cache_t;
166
8750964d 167/*
8cd0a023
MD
168 * Structure used to represent an inode in-memory.
169 *
170 * The record and data associated with an inode may be out of sync with
171 * the disk (xDIRTY flags), or not even on the disk at all (ONDISK flag
172 * clear).
173 *
174 * An inode may also hold a cache of unsynchronized records, used for
175 * database and directories only. Unsynchronized regular file data is
176 * stored in the buffer cache.
177 *
178 * NOTE: A file which is created and destroyed within the initial
179 * synchronization period can wind up not doing any disk I/O at all.
180 *
181 * Finally, an inode may cache numerous disk-referencing B-Tree cursors.
8750964d
MD
182 */
183struct hammer_ino_rb_tree;
184struct hammer_inode;
185RB_HEAD(hammer_ino_rb_tree, hammer_inode);
186RB_PROTOTYPEX(hammer_ino_rb_tree, INFO, hammer_inode, rb_node,
8cd0a023
MD
187 hammer_ino_rb_compare, hammer_inode_info_t);
188
189struct hammer_rec_rb_tree;
190struct hammer_record;
191RB_HEAD(hammer_rec_rb_tree, hammer_record);
192RB_PROTOTYPEX(hammer_rec_rb_tree, INFO, hammer_record, rb_node,
193 hammer_rec_rb_compare, hammer_base_elm_t);
194
195TAILQ_HEAD(hammer_node_list, hammer_node);
8750964d
MD
196
197struct hammer_inode {
1f07f686
MD
198 RB_ENTRY(hammer_inode) rb_node;
199 hammer_inode_state_t flush_state;
200 int flush_group;
059819e3 201 TAILQ_ENTRY(hammer_inode) flush_entry;
1f07f686 202 struct hammer_record_list target_list; /* target of dependant recs */
b84de5af
MD
203 u_int64_t obj_id; /* (key) object identifier */
204 hammer_tid_t obj_asof; /* (key) snapshot or 0 */
205 struct hammer_mount *hmp;
0729c8c8 206 hammer_objid_cache_t objid_cache;
b84de5af
MD
207 int flags;
208 int error; /* flush error */
209 int cursor_ip_refs; /* sanity */
210 struct vnode *vp;
211 struct lockf advlock;
212 struct hammer_lock lock; /* sync copy interlock */
213 TAILQ_HEAD(, bio) bio_list; /* BIOs to flush out */
214 TAILQ_HEAD(, bio) bio_alt_list; /* BIOs to flush out */
215 off_t trunc_off;
11ad5ade 216 struct hammer_btree_leaf_elm ino_leaf; /* in-memory cache */
b84de5af
MD
217 struct hammer_inode_data ino_data; /* in-memory cache */
218 struct hammer_rec_rb_tree rec_tree; /* in-memory cache */
61aeeb33 219 struct hammer_node *cache[2]; /* search initiate cache */
b84de5af
MD
220
221 /*
222 * When a demark is created to synchronize an inode to
223 * disk, certain fields are copied so the front-end VOPs
224 * can continue to run in parallel with the synchronization
225 * occuring in the background.
226 */
227 int sync_flags; /* to-sync flags cache */
228 off_t sync_trunc_off; /* to-sync truncation */
11ad5ade 229 struct hammer_btree_leaf_elm sync_ino_leaf; /* to-sync cache */
b84de5af 230 struct hammer_inode_data sync_ino_data; /* to-sync cache */
8750964d
MD
231};
232
8cd0a023
MD
233typedef struct hammer_inode *hammer_inode_t;
234
66325755
MD
235#define VTOI(vp) ((struct hammer_inode *)(vp)->v_data)
236
8cd0a023 237#define HAMMER_INODE_DDIRTY 0x0001 /* in-memory ino_data is dirty */
11ad5ade 238#define HAMMER_INODE_UNUSED0002 0x0002
8cd0a023 239#define HAMMER_INODE_ITIMES 0x0004 /* in-memory mtime/atime modified */
1f07f686 240#define HAMMER_INODE_XDIRTY 0x0008 /* in-memory records */
8cd0a023 241#define HAMMER_INODE_ONDISK 0x0010 /* inode is on-disk (else not yet) */
a89aec1b 242#define HAMMER_INODE_FLUSH 0x0020 /* flush on last ref */
869e8f55 243#define HAMMER_INODE_DELETED 0x0080 /* inode delete (backend) */
76376933 244#define HAMMER_INODE_DELONDISK 0x0100 /* delete synchronized to disk */
d113fda1 245#define HAMMER_INODE_RO 0x0200 /* read-only (because of as-of) */
e8599db1 246#define HAMMER_INODE_VHELD 0x0400 /* vnode held on sync */
0a72edae 247#define HAMMER_INODE_DONDISK 0x0800 /* data records may be on disk */
f3b0f382 248#define HAMMER_INODE_BUFS 0x1000 /* dirty high level bps present */
b84de5af 249#define HAMMER_INODE_REFLUSH 0x2000 /* pipelined flush during flush */
1f07f686 250#define HAMMER_INODE_WRITE_ALT 0x4000 /* strategy writes to alt bioq */
059819e3 251#define HAMMER_INODE_FLUSHW 0x8000 /* Someone waiting for flush */
8cd0a023 252
b84de5af 253#define HAMMER_INODE_TRUNCATED 0x00010000
869e8f55 254#define HAMMER_INODE_DELETING 0x00020000 /* inode delete request (frontend)*/
4e17f465 255#define HAMMER_INODE_RESIGNAL 0x00040000 /* re-signal on re-flush */
19619882 256#define HAMMER_INODE_RESIGNAL 0x00040000 /* re-signal on re-flush */
b84de5af 257
11ad5ade
MD
258#define HAMMER_INODE_MODMASK (HAMMER_INODE_DDIRTY| \
259 HAMMER_INODE_XDIRTY|HAMMER_INODE_BUFS| \
1f07f686
MD
260 HAMMER_INODE_ITIMES|HAMMER_INODE_TRUNCATED|\
261 HAMMER_INODE_DELETING)
262
263#define HAMMER_INODE_MODMASK_NOXDIRTY \
264 (HAMMER_INODE_MODMASK & ~HAMMER_INODE_XDIRTY)
0b075555 265
8cd0a023 266#define HAMMER_MAX_INODE_CURSORS 4
66325755 267
f90dde4c 268#define HAMMER_FLUSH_SIGNAL 0x0001
4e17f465 269#define HAMMER_FLUSH_RECURSION 0x0002
f90dde4c 270
8750964d 271/*
1f07f686
MD
272 * Structure used to represent an unsynchronized record in-memory. These
273 * records typically represent directory entries. Only non-historical
274 * records are kept in-memory.
275 *
276 * Records are organized as a per-inode RB-Tree. If the inode is not
8cd0a023
MD
277 * on disk then neither are any records and the in-memory record tree
278 * represents the entire contents of the inode. If the inode is on disk
279 * then the on-disk B-Tree is scanned in parallel with the in-memory
280 * RB-Tree to synthesize the current state of the file.
281 *
1f07f686
MD
282 * Records are also used to enforce the ordering of directory create/delete
283 * operations. A new inode will not be flushed to disk unless its related
284 * directory entry is also being flushed at the same time. A directory entry
285 * will not be removed unless its related inode is also being removed at the
286 * same time.
8750964d 287 */
1f07f686 288typedef enum hammer_record_type {
e8599db1 289 HAMMER_MEM_RECORD_GENERAL, /* misc record */
930bf163 290 HAMMER_MEM_RECORD_INODE, /* inode record */
1f07f686
MD
291 HAMMER_MEM_RECORD_ADD, /* positive memory cache record */
292 HAMMER_MEM_RECORD_DEL /* negative delete-on-disk record */
293} hammer_record_type_t;
294
8cd0a023
MD
295struct hammer_record {
296 RB_ENTRY(hammer_record) rb_node;
1f07f686
MD
297 TAILQ_ENTRY(hammer_record) target_entry;
298 hammer_inode_state_t flush_state;
299 int flush_group;
300 hammer_record_type_t type;
a89aec1b 301 struct hammer_lock lock;
8cd0a023 302 struct hammer_inode *ip;
1f07f686 303 struct hammer_inode *target_ip;
11ad5ade 304 struct hammer_btree_leaf_elm leaf;
8cd0a023 305 union hammer_data_ondisk *data;
8cd0a023
MD
306 int flags;
307};
8750964d 308
8cd0a023
MD
309typedef struct hammer_record *hammer_record_t;
310
d36ec43b
MD
311/*
312 * Record flags. Note that FE can only be set by the frontend if the
313 * record has not been interlocked by the backend w/ BE.
314 */
8cd0a023
MD
315#define HAMMER_RECF_ALLOCDATA 0x0001
316#define HAMMER_RECF_ONRBTREE 0x0002
b84de5af 317#define HAMMER_RECF_DELETED_FE 0x0004 /* deleted (frontend) */
d36ec43b 318#define HAMMER_RECF_DELETED_BE 0x0008 /* deleted (backend) */
11ad5ade 319#define HAMMER_RECF_UNUSED0010 0x0010
d36ec43b
MD
320#define HAMMER_RECF_INTERLOCK_BE 0x0020 /* backend interlock */
321#define HAMMER_RECF_WANTED 0x0040
1f07f686 322#define HAMMER_RECF_CONVERT_DELETE 0x0100 /* special case */
8cd0a023
MD
323
324/*
47197d71 325 * In-memory structures representing on-disk structures.
8cd0a023 326 */
8750964d 327struct hammer_volume;
427e5fc6 328struct hammer_buffer;
8cd0a023 329struct hammer_node;
e8599db1 330struct hammer_undo;
8750964d 331RB_HEAD(hammer_vol_rb_tree, hammer_volume);
427e5fc6 332RB_HEAD(hammer_buf_rb_tree, hammer_buffer);
8cd0a023 333RB_HEAD(hammer_nod_rb_tree, hammer_node);
e8599db1 334RB_HEAD(hammer_und_rb_tree, hammer_undo);
8750964d
MD
335
336RB_PROTOTYPE2(hammer_vol_rb_tree, hammer_volume, rb_node,
337 hammer_vol_rb_compare, int32_t);
427e5fc6 338RB_PROTOTYPE2(hammer_buf_rb_tree, hammer_buffer, rb_node,
47197d71 339 hammer_buf_rb_compare, hammer_off_t);
8cd0a023 340RB_PROTOTYPE2(hammer_nod_rb_tree, hammer_node, rb_node,
47197d71 341 hammer_nod_rb_compare, hammer_off_t);
e8599db1
MD
342RB_PROTOTYPE2(hammer_und_rb_tree, hammer_undo, rb_node,
343 hammer_und_rb_compare, hammer_off_t);
8750964d 344
66325755
MD
345/*
346 * IO management - embedded at the head of various in-memory structures
10a5d1ba
MD
347 *
348 * VOLUME - hammer_volume containing meta-data
349 * META_BUFFER - hammer_buffer containing meta-data
350 * DATA_BUFFER - hammer_buffer containing pure-data
351 *
352 * Dirty volume headers and dirty meta-data buffers are locked until the
353 * flusher can sequence them out. Dirty pure-data buffers can be written.
354 * Clean buffers can be passively released.
66325755 355 */
10a5d1ba
MD
356typedef enum hammer_io_type {
357 HAMMER_STRUCTURE_VOLUME,
358 HAMMER_STRUCTURE_META_BUFFER,
359 HAMMER_STRUCTURE_UNDO_BUFFER,
360 HAMMER_STRUCTURE_DATA_BUFFER
361} hammer_io_type_t;
66325755
MD
362
363union hammer_io_structure;
055f5ff8 364struct hammer_io;
66325755
MD
365
366struct worklist {
367 LIST_ENTRY(worklist) node;
368};
369
10a5d1ba
MD
370TAILQ_HEAD(hammer_io_list, hammer_io);
371typedef struct hammer_io_list *hammer_io_list_t;
055f5ff8 372
66325755 373struct hammer_io {
10a5d1ba
MD
374 struct worklist worklist;
375 struct hammer_lock lock;
376 enum hammer_io_type type;
377 struct hammer_mount *hmp;
378 TAILQ_ENTRY(hammer_io) mod_entry; /* list entry if modified */
379 hammer_io_list_t mod_list;
380 struct buf *bp;
381 int64_t offset;
382 int loading; /* loading/unloading interlock */
383 int modify_refs;
384
66325755
MD
385 u_int modified : 1; /* bp's data was modified */
386 u_int released : 1; /* bp released (w/ B_LOCKED set) */
055f5ff8
MD
387 u_int running : 1; /* bp write IO in progress */
388 u_int waiting : 1; /* someone is waiting on us */
b33e2cc0 389 u_int validated : 1; /* ondisk has been validated */
b58c6388 390 u_int waitdep : 1; /* flush waits for dependancies */
66325755
MD
391};
392
8cd0a023
MD
393typedef struct hammer_io *hammer_io_t;
394
66325755 395/*
8cd0a023 396 * In-memory volume representing on-disk buffer
66325755 397 */
8750964d 398struct hammer_volume {
66325755 399 struct hammer_io io;
8750964d 400 RB_ENTRY(hammer_volume) rb_node;
47197d71 401 struct hammer_buf_rb_tree rb_bufs_root;
8750964d
MD
402 struct hammer_volume_ondisk *ondisk;
403 int32_t vol_no;
fbc6e32a 404 int64_t nblocks; /* note: special calculation for statfs */
47197d71 405 int64_t buffer_base; /* base offset of buffer 0 */
2f85fa4d
MD
406 hammer_off_t maxbuf_off; /* Maximum buffer offset (zone-2) */
407 hammer_off_t maxraw_off; /* Maximum raw offset for device */
c60bb2c5 408 char *vol_name;
8750964d 409 struct vnode *devvp;
427e5fc6 410 int vol_flags;
8750964d
MD
411};
412
8cd0a023
MD
413typedef struct hammer_volume *hammer_volume_t;
414
66325755 415/*
8cd0a023
MD
416 * In-memory buffer (other then volume, super-cluster, or cluster),
417 * representing an on-disk buffer.
66325755 418 */
427e5fc6 419struct hammer_buffer {
66325755 420 struct hammer_io io;
427e5fc6 421 RB_ENTRY(hammer_buffer) rb_node;
47197d71 422 void *ondisk;
427e5fc6 423 struct hammer_volume *volume;
34d829f7
MD
424 hammer_off_t zone2_offset;
425 hammer_off_t zoneX_offset;
8cd0a023 426 struct hammer_node_list clist;
66325755
MD
427};
428
8cd0a023
MD
429typedef struct hammer_buffer *hammer_buffer_t;
430
431/*
432 * In-memory B-Tree node, representing an on-disk B-Tree node.
433 *
434 * This is a hang-on structure which is backed by a hammer_buffer,
435 * indexed by a hammer_cluster, and used for fine-grained locking of
436 * B-Tree nodes in order to properly control lock ordering. A hammer_buffer
437 * can contain multiple nodes representing wildly disassociated portions
438 * of the B-Tree so locking cannot be done on a buffer-by-buffer basis.
439 *
440 * This structure uses a cluster-relative index to reduce the number
441 * of layers required to access it, and also because all on-disk B-Tree
442 * references are cluster-relative offsets.
443 */
444struct hammer_node {
445 struct hammer_lock lock; /* node-by-node lock */
446 TAILQ_ENTRY(hammer_node) entry; /* per-buffer linkage */
447 RB_ENTRY(hammer_node) rb_node; /* per-cluster linkage */
47197d71 448 hammer_off_t node_offset; /* full offset spec */
40043e7f 449 struct hammer_mount *hmp;
8cd0a023
MD
450 struct hammer_buffer *buffer; /* backing buffer */
451 hammer_node_ondisk_t ondisk; /* ptr to on-disk structure */
452 struct hammer_node **cache1; /* passive cache(s) */
453 struct hammer_node **cache2;
b3deaf57 454 int flags;
740d8317 455 int loading; /* load interlock */
8cd0a023
MD
456};
457
b3deaf57
MD
458#define HAMMER_NODE_DELETED 0x0001
459#define HAMMER_NODE_FLUSH 0x0002
b3deaf57 460
8cd0a023
MD
461typedef struct hammer_node *hammer_node_t;
462
b33e2cc0
MD
463/*
464 * List of locked nodes.
465 */
466struct hammer_node_locklist {
467 struct hammer_node_locklist *next;
468 hammer_node_t node;
469};
470
471typedef struct hammer_node_locklist *hammer_node_locklist_t;
472
473
8cd0a023
MD
474/*
475 * Common I/O management structure - embedded in in-memory structures
476 * which are backed by filesystem buffers.
477 */
66325755
MD
478union hammer_io_structure {
479 struct hammer_io io;
480 struct hammer_volume volume;
66325755 481 struct hammer_buffer buffer;
8750964d
MD
482};
483
055f5ff8
MD
484typedef union hammer_io_structure *hammer_io_structure_t;
485
bf686dbe
MD
486/*
487 * Allocation holes are recorded for a short period of time in an attempt
488 * to use up the space.
489 */
490
491#define HAMMER_MAX_HOLES 8
492
493struct hammer_hole;
494
495struct hammer_holes {
496 TAILQ_HEAD(, hammer_hole) list;
497 int count;
498};
499
500typedef struct hammer_holes *hammer_holes_t;
501
502struct hammer_hole {
503 TAILQ_ENTRY(hammer_hole) entry;
504 hammer_off_t offset;
505 int bytes;
506};
507
508typedef struct hammer_hole *hammer_hole_t;
427e5fc6 509
8cd0a023
MD
510#include "hammer_cursor.h"
511
e8599db1
MD
512/*
513 * Undo history tracking
514 */
515#define HAMMER_MAX_UNDOS 256
516
517struct hammer_undo {
518 RB_ENTRY(hammer_undo) rb_node;
519 TAILQ_ENTRY(hammer_undo) lru_entry;
520 hammer_off_t offset;
521 int bytes;
522};
523
524typedef struct hammer_undo *hammer_undo_t;
525
8750964d
MD
526/*
527 * Internal hammer mount data structure
528 */
529struct hammer_mount {
530 struct mount *mp;
27ea2398 531 /*struct vnode *rootvp;*/
8750964d
MD
532 struct hammer_ino_rb_tree rb_inos_root;
533 struct hammer_vol_rb_tree rb_vols_root;
40043e7f 534 struct hammer_nod_rb_tree rb_nods_root;
e8599db1 535 struct hammer_und_rb_tree rb_undo_root;
8750964d 536 struct hammer_volume *rootvol;
47197d71
MD
537 struct hammer_base_elm root_btree_beg;
538 struct hammer_base_elm root_btree_end;
d26d0ae9 539 char *zbuf; /* HAMMER_BUFSIZE bytes worth of all-zeros */
195c19a1
MD
540 int hflags;
541 int ronly;
542 int nvolumes;
d26d0ae9 543 int volume_iterator;
1f07f686
MD
544 int flusher_signal; /* flusher thread sequencer */
545 int flusher_act; /* currently active flush group */
546 int flusher_done; /* set to act when complete */
547 int flusher_next; /* next flush group */
4e17f465 548 int flusher_lock; /* lock sequencing of the next flush */
059819e3 549 int flusher_exiting;
f36a9737 550 hammer_tid_t flusher_tid; /* last flushed transaction id */
c9b9e29d 551 hammer_off_t flusher_undo_start; /* UNDO window for flushes */
f90dde4c 552 int reclaim_count;
059819e3 553 thread_t flusher_td;
855942b6 554 u_int check_interrupt;
8750964d 555 uuid_t fsid;
66325755 556 udev_t fsid_udev;
10a5d1ba
MD
557 struct hammer_io_list volu_list; /* dirty undo buffers */
558 struct hammer_io_list undo_list; /* dirty undo buffers */
559 struct hammer_io_list data_list; /* dirty data buffers */
560 struct hammer_io_list meta_list; /* dirty meta bufs */
561 struct hammer_io_list lose_list; /* loose buffers */
562 int locked_dirty_count; /* meta/volu count */
f90dde4c 563 int io_running_count;
0729c8c8 564 int objid_cache_count;
7f7c1f84 565 hammer_tid_t asof;
b84de5af 566 hammer_off_t next_tid;
66325755 567 u_int32_t namekey_iterator;
f03c9cf4 568 hammer_off_t zone_limits[HAMMER_MAX_ZONES];
513ca7d7 569 struct netexport export;
9480ff55 570 struct hammer_lock sync_lock;
c9b9e29d 571 struct hammer_lock free_lock;
40043e7f 572 struct lock blockmap_lock;
0729c8c8 573 struct hammer_blockmap blockmap[HAMMER_MAX_ZONES];
e8599db1
MD
574 struct hammer_holes holes[HAMMER_MAX_ZONES];
575 struct hammer_undo undos[HAMMER_MAX_UNDOS];
576 int undo_alloc;
577 TAILQ_HEAD(, hammer_undo) undo_lru_list;
059819e3 578 TAILQ_HEAD(, hammer_inode) flush_list;
0729c8c8 579 TAILQ_HEAD(, hammer_objid_cache) objid_cache_list;
8750964d
MD
580};
581
8cd0a023 582typedef struct hammer_mount *hammer_mount_t;
8750964d 583
fbc6e32a
MD
584struct hammer_sync_info {
585 int error;
586 int waitfor;
587};
588
8750964d
MD
589#endif
590
591#if defined(_KERNEL)
592
593extern struct vop_ops hammer_vnode_vops;
7a04d74f
MD
594extern struct vop_ops hammer_spec_vops;
595extern struct vop_ops hammer_fifo_vops;
66325755 596extern struct bio_ops hammer_bioops;
427e5fc6 597
2f85fa4d 598extern int hammer_debug_io;
d5ef456e 599extern int hammer_debug_general;
77062c8a 600extern int hammer_debug_debug;
e8599db1 601extern int hammer_debug_inode;
7d683b0f 602extern int hammer_debug_locks;
b3deaf57 603extern int hammer_debug_btree;
d113fda1 604extern int hammer_debug_tid;
b33e2cc0 605extern int hammer_debug_recover;
46fe7ae1 606extern int hammer_debug_recover_faults;
b3deaf57
MD
607extern int hammer_count_inodes;
608extern int hammer_count_records;
609extern int hammer_count_record_datas;
610extern int hammer_count_volumes;
b3deaf57
MD
611extern int hammer_count_buffers;
612extern int hammer_count_nodes;
9480ff55
MD
613extern int hammer_count_dirtybufs;
614extern int hammer_limit_dirtybufs;
1f07f686 615extern int hammer_bio_count;
7d683b0f 616extern int64_t hammer_contention_count;
b3deaf57 617
8750964d
MD
618int hammer_vop_inactive(struct vop_inactive_args *);
619int hammer_vop_reclaim(struct vop_reclaim_args *);
e8599db1 620int hammer_get_vnode(struct hammer_inode *ip, struct vnode **vpp);
36f82b23 621struct hammer_inode *hammer_get_inode(hammer_transaction_t trans,
61aeeb33 622 struct hammer_node **cache,
d113fda1
MD
623 u_int64_t obj_id, hammer_tid_t asof, int flags,
624 int *errorp);
66325755
MD
625void hammer_put_inode(struct hammer_inode *ip);
626void hammer_put_inode_ref(struct hammer_inode *ip);
627
8cd0a023 628int hammer_unload_volume(hammer_volume_t volume, void *data __unused);
a89aec1b 629int hammer_unload_buffer(hammer_buffer_t buffer, void *data __unused);
8cd0a023
MD
630int hammer_install_volume(hammer_mount_t hmp, const char *volname);
631
45a014dc 632int hammer_ip_lookup(hammer_cursor_t cursor);
4e17f465 633int hammer_ip_first(hammer_cursor_t cursor);
a89aec1b 634int hammer_ip_next(hammer_cursor_t cursor);
8cd0a023 635int hammer_ip_resolve_data(hammer_cursor_t cursor);
195c19a1 636int hammer_ip_delete_record(hammer_cursor_t cursor, hammer_tid_t tid);
7dc57964 637int hammer_delete_at_cursor(hammer_cursor_t cursor, int64_t *stat_bytes);
b3deaf57 638int hammer_ip_check_directory_empty(hammer_transaction_t trans,
98f7132d 639 hammer_inode_t ip);
fbc6e32a 640int hammer_sync_hmp(hammer_mount_t hmp, int waitfor);
f36a9737
MD
641int hammer_queue_inodes_flusher(hammer_mount_t hmp, int waitfor);
642
fbc6e32a 643
8cd0a023 644hammer_record_t
11ad5ade 645 hammer_alloc_mem_record(hammer_inode_t ip, int data_len);
d36ec43b 646void hammer_flush_record_done(hammer_record_t record, int error);
b84de5af 647void hammer_wait_mem_record(hammer_record_t record);
b3deaf57 648void hammer_rel_mem_record(hammer_record_t record);
b84de5af 649
6a37e7e4 650int hammer_cursor_up(hammer_cursor_t cursor);
f36a9737 651int hammer_cursor_up_locked(hammer_cursor_t cursor);
8cd0a023 652int hammer_cursor_down(hammer_cursor_t cursor);
6a37e7e4
MD
653int hammer_cursor_upgrade(hammer_cursor_t cursor);
654void hammer_cursor_downgrade(hammer_cursor_t cursor);
32c90105
MD
655int hammer_cursor_seek(hammer_cursor_t cursor, hammer_node_t node,
656 int index);
8cd0a023
MD
657void hammer_lock_ex(struct hammer_lock *lock);
658int hammer_lock_ex_try(struct hammer_lock *lock);
659void hammer_lock_sh(struct hammer_lock *lock);
6a37e7e4
MD
660int hammer_lock_upgrade(struct hammer_lock *lock);
661void hammer_lock_downgrade(struct hammer_lock *lock);
427e5fc6 662void hammer_unlock(struct hammer_lock *lock);
66325755
MD
663void hammer_ref(struct hammer_lock *lock);
664void hammer_unref(struct hammer_lock *lock);
8cd0a023 665
2f85fa4d
MD
666void hammer_sync_lock_ex(hammer_transaction_t trans);
667void hammer_sync_lock_sh(hammer_transaction_t trans);
668void hammer_sync_unlock(hammer_transaction_t trans);
669
66325755 670u_int32_t hammer_to_unix_xid(uuid_t *uuid);
8cd0a023
MD
671void hammer_guid_to_uuid(uuid_t *uuid, u_int32_t guid);
672void hammer_to_timespec(hammer_tid_t tid, struct timespec *ts);
673hammer_tid_t hammer_timespec_to_transid(struct timespec *ts);
7f7c1f84 674hammer_tid_t hammer_now_tid(void);
d113fda1 675hammer_tid_t hammer_str_to_tid(const char *str);
0729c8c8
MD
676hammer_tid_t hammer_alloc_objid(hammer_transaction_t trans, hammer_inode_t dip);
677void hammer_clear_objid(hammer_inode_t dip);
678void hammer_destroy_objid_cache(hammer_mount_t hmp);
8cd0a023 679
e8599db1
MD
680int hammer_enter_undo_history(hammer_mount_t hmp, hammer_off_t offset,
681 int bytes);
682void hammer_clear_undo_history(hammer_mount_t hmp);
66325755 683enum vtype hammer_get_vnode_type(u_int8_t obj_type);
6b4f890b 684int hammer_get_dtype(u_int8_t obj_type);
66325755
MD
685u_int8_t hammer_get_obj_type(enum vtype vtype);
686int64_t hammer_directory_namekey(void *name, int len);
427e5fc6 687
36f82b23 688int hammer_init_cursor(hammer_transaction_t trans, hammer_cursor_t cursor,
4e17f465
MD
689 struct hammer_node **cache, hammer_inode_t ip);
690int hammer_reinit_cursor(hammer_cursor_t cursor);
691void hammer_normalize_cursor(hammer_cursor_t cursor);
8cd0a023 692void hammer_done_cursor(hammer_cursor_t cursor);
6b4f890b 693void hammer_mem_done(hammer_cursor_t cursor);
8cd0a023
MD
694
695int hammer_btree_lookup(hammer_cursor_t cursor);
d26d0ae9 696int hammer_btree_first(hammer_cursor_t cursor);
32c90105 697int hammer_btree_last(hammer_cursor_t cursor);
8cd0a023
MD
698int hammer_btree_extract(hammer_cursor_t cursor, int flags);
699int hammer_btree_iterate(hammer_cursor_t cursor);
32c90105 700int hammer_btree_iterate_reverse(hammer_cursor_t cursor);
11ad5ade
MD
701int hammer_btree_insert(hammer_cursor_t cursor,
702 hammer_btree_leaf_elm_t elm);
8cd0a023
MD
703int hammer_btree_delete(hammer_cursor_t cursor);
704int hammer_btree_cmp(hammer_base_elm_t key1, hammer_base_elm_t key2);
d26d0ae9 705int hammer_btree_chkts(hammer_tid_t ts, hammer_base_elm_t key);
32c90105
MD
706int hammer_btree_correct_rhb(hammer_cursor_t cursor, hammer_tid_t tid);
707int hammer_btree_correct_lhb(hammer_cursor_t cursor, hammer_tid_t tid);
708
2f85fa4d
MD
709int btree_set_parent(hammer_transaction_t trans, hammer_node_t node,
710 hammer_btree_elm_t elm);
b33e2cc0
MD
711int hammer_btree_lock_children(hammer_cursor_t cursor,
712 struct hammer_node_locklist **locklistp);
2f85fa4d
MD
713void hammer_btree_unlock_children(struct hammer_node_locklist **locklistp);
714
b33e2cc0 715
c0ade690
MD
716void hammer_print_btree_node(hammer_node_ondisk_t ondisk);
717void hammer_print_btree_elm(hammer_btree_elm_t elm, u_int8_t type, int i);
8750964d 718
47197d71
MD
719void *hammer_bread(struct hammer_mount *hmp, hammer_off_t off,
720 int *errorp, struct hammer_buffer **bufferp);
721void *hammer_bnew(struct hammer_mount *hmp, hammer_off_t off,
722 int *errorp, struct hammer_buffer **bufferp);
8cd0a023
MD
723
724hammer_volume_t hammer_get_root_volume(hammer_mount_t hmp, int *errorp);
4e17f465 725int hammer_dowrite(hammer_cursor_t cursor, hammer_inode_t ip,
059819e3 726 struct bio *bio);
427e5fc6 727
8cd0a023 728hammer_volume_t hammer_get_volume(hammer_mount_t hmp,
427e5fc6 729 int32_t vol_no, int *errorp);
47197d71
MD
730hammer_buffer_t hammer_get_buffer(hammer_mount_t hmp,
731 hammer_off_t buf_offset, int isnew, int *errorp);
2f85fa4d
MD
732void hammer_clrxlate_buffer(hammer_mount_t hmp,
733 hammer_off_t buf_offset);
b58c6388 734void hammer_uncache_buffer(struct hammer_mount *hmp, hammer_off_t off);
8cd0a023 735
fbc6e32a 736int hammer_ref_volume(hammer_volume_t volume);
8cd0a023
MD
737int hammer_ref_buffer(hammer_buffer_t buffer);
738void hammer_flush_buffer_nodes(hammer_buffer_t buffer);
739
8cd0a023 740void hammer_rel_volume(hammer_volume_t volume, int flush);
8cd0a023
MD
741void hammer_rel_buffer(hammer_buffer_t buffer, int flush);
742
513ca7d7
MD
743int hammer_vfs_export(struct mount *mp, int op,
744 const struct export_args *export);
19619882
MD
745hammer_node_t hammer_get_node(hammer_mount_t hmp, hammer_off_t node_offset,
746 int isnew, int *errorp);
740d8317 747void hammer_ref_node(hammer_node_t node);
055f5ff8
MD
748hammer_node_t hammer_ref_node_safe(struct hammer_mount *hmp,
749 struct hammer_node **cache, int *errorp);
8cd0a023 750void hammer_rel_node(hammer_node_t node);
36f82b23
MD
751void hammer_delete_node(hammer_transaction_t trans,
752 hammer_node_t node);
8cd0a023
MD
753void hammer_cache_node(hammer_node_t node,
754 struct hammer_node **cache);
755void hammer_uncache_node(struct hammer_node **cache);
756void hammer_flush_node(hammer_node_t node);
757
427e5fc6
MD
758void hammer_dup_buffer(struct hammer_buffer **bufferp,
759 struct hammer_buffer *buffer);
36f82b23
MD
760hammer_node_t hammer_alloc_btree(hammer_transaction_t trans, int *errorp);
761void *hammer_alloc_record(hammer_transaction_t trans,
bf686dbe 762 hammer_off_t *rec_offp, u_int16_t rec_type,
40043e7f
MD
763 struct hammer_buffer **rec_bufferp,
764 int32_t data_len, void **datap,
19619882 765 hammer_off_t *data_offp,
40043e7f 766 struct hammer_buffer **data_bufferp, int *errorp);
36f82b23 767void *hammer_alloc_data(hammer_transaction_t trans, int32_t data_len,
bf686dbe
MD
768 hammer_off_t *data_offsetp,
769 struct hammer_buffer **data_bufferp, int *errorp);
770
059819e3
MD
771int hammer_generate_undo(hammer_transaction_t trans, hammer_io_t io,
772 hammer_off_t zone1_offset, void *base, int len);
427e5fc6 773
66325755 774void hammer_put_volume(struct hammer_volume *volume, int flush);
66325755 775void hammer_put_buffer(struct hammer_buffer *buffer, int flush);
427e5fc6 776
36f82b23
MD
777hammer_off_t hammer_freemap_alloc(hammer_transaction_t trans,
778 hammer_off_t owner, int *errorp);
779void hammer_freemap_free(hammer_transaction_t trans, hammer_off_t phys_offset,
c3be93f2 780 hammer_off_t owner, int *errorp);
36f82b23 781hammer_off_t hammer_blockmap_alloc(hammer_transaction_t trans, int zone,
40043e7f 782 int bytes, int *errorp);
36f82b23
MD
783void hammer_blockmap_free(hammer_transaction_t trans,
784 hammer_off_t bmap_off, int bytes);
bf686dbe
MD
785int hammer_blockmap_getfree(hammer_mount_t hmp, hammer_off_t bmap_off,
786 int *curp, int *errorp);
40043e7f
MD
787hammer_off_t hammer_blockmap_lookup(hammer_mount_t hmp, hammer_off_t bmap_off,
788 int *errorp);
bf686dbe
MD
789hammer_off_t hammer_undo_lookup(hammer_mount_t hmp, hammer_off_t bmap_off,
790 int *errorp);
c9b9e29d 791int64_t hammer_undo_used(hammer_mount_t hmp);
1f07f686
MD
792int64_t hammer_undo_space(hammer_mount_t hmp);
793int64_t hammer_undo_max(hammer_mount_t hmp);
794
40043e7f 795
8cd0a023
MD
796void hammer_start_transaction(struct hammer_transaction *trans,
797 struct hammer_mount *hmp);
36f82b23
MD
798void hammer_simple_transaction(struct hammer_transaction *trans,
799 struct hammer_mount *hmp);
b84de5af
MD
800void hammer_start_transaction_fls(struct hammer_transaction *trans,
801 struct hammer_mount *hmp);
802void hammer_done_transaction(struct hammer_transaction *trans);
66325755
MD
803
804void hammer_modify_inode(struct hammer_transaction *trans,
8cd0a023 805 hammer_inode_t ip, int flags);
f90dde4c 806void hammer_flush_inode(hammer_inode_t ip, int flags);
b84de5af
MD
807void hammer_flush_inode_done(hammer_inode_t ip);
808void hammer_wait_inode(hammer_inode_t ip);
809
8cd0a023
MD
810int hammer_create_inode(struct hammer_transaction *trans, struct vattr *vap,
811 struct ucred *cred, struct hammer_inode *dip,
812 struct hammer_inode **ipp);
a89aec1b 813void hammer_rel_inode(hammer_inode_t ip, int flush);
1f07f686
MD
814int hammer_sync_inode(hammer_inode_t ip);
815void hammer_test_inode(hammer_inode_t ip);
e8599db1 816void hammer_inode_unloadable_check(hammer_inode_t ip, int getvp);
8cd0a023 817
a89aec1b 818int hammer_ip_add_directory(struct hammer_transaction *trans,
8cd0a023
MD
819 hammer_inode_t dip, struct namecache *ncp,
820 hammer_inode_t nip);
a89aec1b 821int hammer_ip_del_directory(struct hammer_transaction *trans,
8cd0a023
MD
822 hammer_cursor_t cursor, hammer_inode_t dip,
823 hammer_inode_t ip);
7a04d74f
MD
824int hammer_ip_add_record(struct hammer_transaction *trans,
825 hammer_record_t record);
4e17f465
MD
826int hammer_ip_delete_range(hammer_cursor_t cursor, hammer_inode_t ip,
827 int64_t ran_beg, int64_t ran_end);
828int hammer_ip_delete_range_all(hammer_cursor_t cursor, hammer_inode_t ip,
829 int *countp);
830int hammer_ip_sync_data(hammer_cursor_t cursor, hammer_inode_t ip,
831 int64_t offset, void *data, int bytes);
36f82b23 832int hammer_ip_sync_record(hammer_transaction_t trans, hammer_record_t rec);
4e17f465 833int hammer_ip_sync_record_cursor(hammer_cursor_t cursor, hammer_record_t rec);
66325755 834
7dc57964
MD
835int hammer_ioctl(hammer_inode_t ip, u_long com, caddr_t data, int fflag,
836 struct ucred *cred);
837
10a5d1ba
MD
838void hammer_io_init(hammer_io_t io, hammer_mount_t hmp,
839 enum hammer_io_type type);
840void hammer_io_reinit(hammer_io_t io, enum hammer_io_type type);
2f85fa4d
MD
841int hammer_io_read(struct vnode *devvp, struct hammer_io *io,
842 hammer_off_t limit);
66325755 843int hammer_io_new(struct vnode *devvp, struct hammer_io *io);
09ac686b 844void hammer_io_release(struct hammer_io *io, int flush);
055f5ff8 845void hammer_io_flush(struct hammer_io *io);
8cd0a023 846int hammer_io_checkflush(hammer_io_t io);
61aeeb33 847void hammer_io_clear_modify(struct hammer_io *io);
055f5ff8 848void hammer_io_waitdep(struct hammer_io *io);
66325755 849
36f82b23
MD
850void hammer_modify_volume(hammer_transaction_t trans, hammer_volume_t volume,
851 void *base, int len);
852void hammer_modify_buffer(hammer_transaction_t trans, hammer_buffer_t buffer,
853 void *base, int len);
10a5d1ba
MD
854void hammer_modify_volume_done(hammer_volume_t volume);
855void hammer_modify_buffer_done(hammer_buffer_t buffer);
0b075555 856
36f82b23
MD
857int hammer_ioc_reblock(hammer_transaction_t trans, hammer_inode_t ip,
858 struct hammer_ioc_reblock *reblock);
11ad5ade
MD
859int hammer_ioc_prune(hammer_transaction_t trans, hammer_inode_t ip,
860 struct hammer_ioc_prune *prune);
bf686dbe
MD
861
862void hammer_init_holes(hammer_mount_t hmp, hammer_holes_t holes);
863void hammer_free_holes(hammer_mount_t hmp, hammer_holes_t holes);
855942b6 864int hammer_signal_check(hammer_mount_t hmp);
bf686dbe 865
059819e3
MD
866void hammer_flusher_create(hammer_mount_t hmp);
867void hammer_flusher_destroy(hammer_mount_t hmp);
868void hammer_flusher_sync(hammer_mount_t hmp);
869void hammer_flusher_async(hammer_mount_t hmp);
870
f90dde4c
MD
871int hammer_recover(hammer_mount_t hmp, hammer_volume_t rootvol);
872
19619882
MD
873void hammer_crc_set_blockmap(hammer_blockmap_t blockmap);
874void hammer_crc_set_volume(hammer_volume_ondisk_t ondisk);
875
876int hammer_crc_test_blockmap(hammer_blockmap_t blockmap);
877int hammer_crc_test_volume(hammer_volume_ondisk_t ondisk);
19619882 878int hammer_crc_test_btree(hammer_node_ondisk_t ondisk);
77062c8a 879void hkprintf(const char *ctl, ...);
19619882 880
055f5ff8 881#endif
427e5fc6 882
8cd0a023 883static __inline void
36f82b23 884hammer_modify_node_noundo(hammer_transaction_t trans, hammer_node_t node)
bf686dbe 885{
36f82b23 886 hammer_modify_buffer(trans, node->buffer, NULL, 0);
bf686dbe
MD
887}
888
889static __inline void
36f82b23 890hammer_modify_node_all(hammer_transaction_t trans, struct hammer_node *node)
8cd0a023 891{
36f82b23
MD
892 hammer_modify_buffer(trans, node->buffer,
893 node->ondisk, sizeof(*node->ondisk));
427e5fc6
MD
894}
895
bf686dbe 896static __inline void
36f82b23
MD
897hammer_modify_node(hammer_transaction_t trans, hammer_node_t node,
898 void *base, int len)
bf686dbe 899{
19619882
MD
900 hammer_crc_t *crcptr;
901
bf686dbe
MD
902 KKASSERT((char *)base >= (char *)node->ondisk &&
903 (char *)base + len <=
904 (char *)node->ondisk + sizeof(*node->ondisk));
36f82b23 905 hammer_modify_buffer(trans, node->buffer, base, len);
19619882
MD
906 crcptr = &node->ondisk->crc;
907 hammer_modify_buffer(trans, node->buffer, crcptr, sizeof(hammer_crc_t));
908 --node->buffer->io.modify_refs; /* only want one ref */
bf686dbe
MD
909}
910
10a5d1ba
MD
911static __inline void
912hammer_modify_node_done(hammer_node_t node)
913{
19619882 914 node->ondisk->crc = crc32(&node->ondisk->crc + 1, HAMMER_BTREE_CRCSIZE);
10a5d1ba
MD
915 hammer_modify_buffer_done(node->buffer);
916}
917
e8599db1
MD
918#define hammer_modify_volume_field(trans, vol, field) \
919 hammer_modify_volume(trans, vol, &(vol)->ondisk->field, \
920 sizeof((vol)->ondisk->field))
921
c9b9e29d
MD
922#define hammer_modify_node_field(trans, node, field) \
923 hammer_modify_node(trans, node, &(node)->ondisk->field, \
924 sizeof((node)->ondisk->field))
925