| Commit | Line | Data |
|---|---|---|
| 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> | |
| 57 | #include <sys/globaldata.h> | |
| 58 | #include <sys/lockf.h> | |
| 59 | #include <sys/buf.h> | |
| 60 | #include <sys/queue.h> | |
| 61 | #include <sys/limits.h> | |
| 62 | #include <sys/buf2.h> | |
| 63 | #include <sys/signal2.h> | |
| 64 | #include <sys/tree.h> | |
| 65 | ||
| 66 | #include "hammer2_disk.h" | |
| 67 | #include "hammer2_mount.h" | |
| 2910a90c | 68 | #include "hammer2_ioctl.h" |
| 1ad77ed9 | 69 | #include "hammer2_ccms.h" |
| 703720e4 | 70 | |
| 5c23d7f1 | 71 | struct hammer2_chain; |
| 703720e4 MD |
72 | struct hammer2_inode; |
| 73 | struct hammer2_mount; | |
| e4e20f48 | 74 | struct hammer2_pfsmount; |
| 703720e4 | 75 | |
| 703720e4 | 76 | /* |
| 50e4f8f4 MD |
77 | * The chain structure tracks blockref recursions all the way to |
| 78 | * the root volume. These consist of indirect blocks, inodes, | |
| 79 | * and eventually the volume header. | |
| 80 | * | |
| 7cfa8da5 MD |
81 | * The chain structure is embedded in the hammer2_mount, hammer2_inode, |
| 82 | * and other system memory structures. The chain structure typically | |
| 83 | * implements the reference count and busy flag for the larger structure. | |
| 84 | * | |
| 85 | * It is always possible to track a chain element all the way back to the | |
| 86 | * root by following the (parent) links. (index) is a type-dependent index | |
| 87 | * in the parent indicating where in the parent the chain element resides. | |
| 5c23d7f1 MD |
88 | * |
| 89 | * When a blockref is added or deleted the related chain element is marked | |
| 90 | * modified and all of its parents are marked SUBMODIFIED (the parent | |
| 91 | * recursion can stop once we hit a node that is already marked SUBMODIFIED). | |
| 92 | * A deleted chain element must remain intact until synchronized against | |
| 93 | * its parent. | |
| 94 | * | |
| 95 | * The blockref at (parent, index) is not adjusted until the modified chain | |
| 96 | * element is flushed and unmarked. Until then the child's blockref may | |
| 97 | * not match the blockref at (parent, index). | |
| 50e4f8f4 | 98 | */ |
| 5c23d7f1 MD |
99 | SPLAY_HEAD(hammer2_chain_splay, hammer2_chain); |
| 100 | ||
| 50e4f8f4 MD |
101 | struct hammer2_chain { |
| 102 | struct hammer2_blockref bref; | |
| 004f88b4 | 103 | struct hammer2_blockref bref_flush; /* synchronized w/MOVED bit */ |
| 1c9f601e | 104 | struct hammer2_chain *parent; /* return chain to root */ |
| 5c23d7f1 MD |
105 | struct hammer2_chain_splay shead; |
| 106 | SPLAY_ENTRY(hammer2_chain) snode; | |
| 1c9f601e | 107 | TAILQ_ENTRY(hammer2_chain) flush_node; /* flush deferral list */ |
| 7cfa8da5 MD |
108 | union { |
| 109 | struct hammer2_inode *ip; | |
| 5c23d7f1 MD |
110 | struct hammer2_indblock *np; |
| 111 | struct hammer2_data *dp; | |
| 112 | void *mem; | |
| 7cfa8da5 | 113 | } u; |
| 5c23d7f1 MD |
114 | |
| 115 | struct buf *bp; /* buffer cache (ro) */ | |
| 116 | hammer2_media_data_t *data; /* modified copy of data (rw) */ | |
| 866d5273 | 117 | u_int bytes; /* physical size of data */ |
| 5c23d7f1 MD |
118 | struct lock lk; /* lockmgr lock */ |
| 119 | int index; /* index in parent */ | |
| 120 | u_int refs; | |
| 121 | u_int busy; /* soft-busy */ | |
| 122 | u_int flags; | |
| 50e4f8f4 MD |
123 | }; |
| 124 | ||
| 125 | typedef struct hammer2_chain hammer2_chain_t; | |
| 126 | ||
| 5c23d7f1 MD |
127 | int hammer2_chain_cmp(hammer2_chain_t *chain1, hammer2_chain_t *chain2); |
| 128 | SPLAY_PROTOTYPE(hammer2_chain_splay, hammer2_chain, snode, hammer2_chain_cmp); | |
| 129 | ||
| 28ee5f14 MD |
130 | /* |
| 131 | * MOVED - This bit is set during the flush when the MODIFIED bit is cleared, | |
| 132 | * indicating that the parent's blocktable must inherit a change to | |
| 133 | * the bref (typically a block reallocation) | |
| 134 | * | |
| 135 | * It must also be set in situations where a chain is not MODIFIED | |
| 136 | * but whos bref has changed (typically due to fields other than | |
| 137 | * a block reallocation). | |
| 138 | */ | |
| 2910a90c | 139 | #define HAMMER2_CHAIN_MODIFIED 0x00000001 /* active mods */ |
| 214f4a77 | 140 | #define HAMMER2_CHAIN_DIRTYEMBED 0x00000002 /* inode embedded */ |
| a92f82c4 | 141 | #define HAMMER2_CHAIN_DIRTYBP 0x00000004 /* dirty on unlock */ |
| 73e441b9 | 142 | #define HAMMER2_CHAIN_SUBMODIFIED 0x00000008 /* 1+ subs modified */ |
| b7926f31 | 143 | #define HAMMER2_CHAIN_DELETED 0x00000010 |
| 01eabad4 | 144 | #define HAMMER2_CHAIN_INITIAL 0x00000020 /* initial create */ |
| c667909f | 145 | #define HAMMER2_CHAIN_FLUSHED 0x00000040 /* flush on unlock */ |
| 28ee5f14 | 146 | #define HAMMER2_CHAIN_MOVED 0x00000080 /* bref changed */ |
| 37aa19df | 147 | #define HAMMER2_CHAIN_IOFLUSH 0x00000100 /* bawrite on put */ |
| 1c9f601e | 148 | #define HAMMER2_CHAIN_DEFERRED 0x00000200 /* on a deferral list*/ |
| 222d9e22 | 149 | #define HAMMER2_CHAIN_DESTROYED 0x00000400 /* destroying */ |
| 2910a90c | 150 | #define HAMMER2_CHAIN_MODIFIED_AUX 0x00000800 /* hmp->vchain only */ |
| 4d5318eb MD |
151 | #define HAMMER2_CHAIN_MODIFY_TID 0x00001000 /* mod updates field */ |
| 152 | #define HAMMER2_CHAIN_MOUNTED 0x00002000 /* PFS is mounted */ | |
| c667909f MD |
153 | |
| 154 | /* | |
| 155 | * Flags passed to hammer2_chain_lookup() and hammer2_chain_next() | |
| 156 | */ | |
| 157 | #define HAMMER2_LOOKUP_NOLOCK 0x00000001 /* ref only */ | |
| 8cce658d | 158 | #define HAMMER2_LOOKUP_NODATA 0x00000002 /* data left NULL */ |
| 5c23d7f1 | 159 | |
| 50e4f8f4 | 160 | /* |
| 01eabad4 MD |
161 | * Flags passed to hammer2_chain_modify() and hammer2_chain_resize() |
| 162 | * | |
| 163 | * NOTE: OPTDATA allows us to avoid instantiating buffers for INDIRECT | |
| 164 | * blocks in the INITIAL-create state. | |
| 4d5318eb MD |
165 | * |
| 166 | * NOTE: NO_MODIFY_TID tells the function to not set HAMMER2_CHAIN_MODIFY_TID | |
| 167 | * when marking the chain modified (used when a sub-chain modification | |
| 168 | * propagates upward). | |
| 01eabad4 MD |
169 | */ |
| 170 | #define HAMMER2_MODIFY_NOSUB 0x00000001 /* do not set SUBMOD */ | |
| 171 | #define HAMMER2_MODIFY_OPTDATA 0x00000002 /* data can be NULL */ | |
| 4d5318eb | 172 | #define HAMMER2_MODIFY_NO_MODIFY_TID 0x00000004 |
| 01eabad4 MD |
173 | |
| 174 | /* | |
| 175 | * Flags passed to hammer2_chain_lock() | |
| 176 | */ | |
| 177 | #define HAMMER2_RESOLVE_NEVER 1 | |
| 178 | #define HAMMER2_RESOLVE_MAYBE 2 | |
| 179 | #define HAMMER2_RESOLVE_ALWAYS 3 | |
| 180 | ||
| 181 | /* | |
| 6ba3b984 MD |
182 | * Cluster different types of storage together for allocations |
| 183 | */ | |
| 184 | #define HAMMER2_FREECACHE_INODE 0 | |
| 185 | #define HAMMER2_FREECACHE_INDIR 1 | |
| 186 | #define HAMMER2_FREECACHE_DATA 2 | |
| 187 | #define HAMMER2_FREECACHE_UNUSED3 3 | |
| 188 | #define HAMMER2_FREECACHE_TYPES 4 | |
| 189 | ||
| 190 | /* | |
| 191 | * BMAP read-ahead maximum parameters | |
| 192 | */ | |
| 193 | #define HAMMER2_BMAP_COUNT 16 /* max bmap read-ahead */ | |
| 194 | #define HAMMER2_BMAP_BYTES (HAMMER2_PBUFSIZE * HAMMER2_BMAP_COUNT) | |
| 195 | ||
| 196 | /* | |
| 1c9f601e MD |
197 | * Misc |
| 198 | */ | |
| 199 | #define HAMMER2_FLUSH_DEPTH_LIMIT 40 /* stack recursion limit */ | |
| 200 | ||
| 201 | /* | |
| 5c23d7f1 | 202 | * HAMMER2 IN-MEMORY CACHE OF MEDIA STRUCTURES |
| 7cfa8da5 | 203 | * |
| 5c23d7f1 MD |
204 | * There is an in-memory representation of all on-media data structure. |
| 205 | * | |
| 206 | * When accessed read-only the data will be mapped to the related buffer | |
| 207 | * cache buffer. | |
| 208 | * | |
| 209 | * When accessed read-write (marked modified) a kmalloc()'d copy of the | |
| 210 | * is created which can then be modified. The copy is destroyed when a | |
| 211 | * filesystem block is allocated to replace it. | |
| 212 | * | |
| 213 | * Active inodes (those with vnodes attached) will maintain the kmalloc()'d | |
| 214 | * copy for both the read-only and the read-write case. The combination of | |
| 215 | * (bp) and (data) determines whether (data) was allocated or not. | |
| 216 | * | |
| 217 | * The in-memory representation may remain cached (for example in order to | |
| 218 | * placemark clustering locks) even after the related data has been | |
| 219 | * detached. | |
| 220 | */ | |
| 221 | ||
| 222 | /* | |
| 223 | * A hammer2 inode. | |
| 703720e4 MD |
224 | */ |
| 225 | struct hammer2_inode { | |
| e4e20f48 MD |
226 | struct hammer2_mount *hmp; /* Global mount */ |
| 227 | struct hammer2_pfsmount *pmp; /* PFS mount */ | |
| e028fa74 | 228 | struct hammer2_inode *pip; /* parent inode */ |
| 703720e4 | 229 | struct vnode *vp; |
| 50e4f8f4 | 230 | hammer2_chain_t chain; |
| 5c23d7f1 | 231 | struct hammer2_inode_data ip_data; |
| 37aa19df | 232 | struct lockf advlock; |
| 99535653 | 233 | u_int depth; /* directory depth */ |
| 28ee5f14 MD |
234 | hammer2_off_t delta_dcount; /* adjust data_count */ |
| 235 | hammer2_off_t delta_icount; /* adjust inode_count */ | |
| 703720e4 MD |
236 | }; |
| 237 | ||
| 54eb943b MD |
238 | typedef struct hammer2_inode hammer2_inode_t; |
| 239 | ||
| 703720e4 | 240 | /* |
| 7cfa8da5 MD |
241 | * A hammer2 indirect block |
| 242 | */ | |
| 243 | struct hammer2_indblock { | |
| 244 | hammer2_chain_t chain; | |
| 7cfa8da5 MD |
245 | }; |
| 246 | ||
| 247 | typedef struct hammer2_indblock hammer2_indblock_t; | |
| 248 | ||
| 5c23d7f1 MD |
249 | /* |
| 250 | * A hammer2 data block | |
| 251 | */ | |
| 252 | struct hammer2_data { | |
| 253 | hammer2_chain_t chain; | |
| 254 | }; | |
| 255 | ||
| 5c23d7f1 MD |
256 | typedef struct hammer2_data hammer2_data_t; |
| 257 | ||
| 004f88b4 MD |
258 | struct hammer2_freecache { |
| 259 | hammer2_off_t bulk; | |
| 260 | hammer2_off_t single; | |
| 261 | }; | |
| 262 | ||
| 263 | typedef struct hammer2_freecache hammer2_freecache_t; | |
| 264 | ||
| 7cfa8da5 | 265 | /* |
| e4e20f48 | 266 | * Global (per device) mount structure for device (aka vp->v_mount->hmp) |
| 703720e4 MD |
267 | */ |
| 268 | struct hammer2_mount { | |
| 50e4f8f4 | 269 | struct vnode *devvp; /* device vnode */ |
| 50e4f8f4 | 270 | int ronly; /* read-only mount */ |
| e4e20f48 MD |
271 | int pmp_count; /* PFS mounts backed by us */ |
| 272 | TAILQ_ENTRY(hammer2_mount) mntentry; /* hammer2_mntlist */ | |
| 703720e4 | 273 | |
| 5c23d7f1 | 274 | struct malloc_type *minode; |
| 54eb943b MD |
275 | int ninodes; |
| 276 | int maxinodes; | |
| 703720e4 | 277 | |
| 5c23d7f1 | 278 | struct malloc_type *mchain; |
| 54eb943b MD |
279 | int nipstacks; |
| 280 | int maxipstacks; | |
| 7cfa8da5 MD |
281 | hammer2_chain_t vchain; /* anchor chain */ |
| 282 | hammer2_chain_t *schain; /* super-root */ | |
| 01eabad4 | 283 | struct lock alloclk; /* lockmgr lock */ |
| 2910a90c | 284 | struct lock voldatalk; /* lockmgr lock */ |
| 703720e4 | 285 | |
| 54eb943b | 286 | hammer2_volume_data_t voldata; |
| 004f88b4 | 287 | hammer2_freecache_t freecache[HAMMER2_FREECACHE_TYPES][HAMMER2_MAX_RADIX+1]; |
| 703720e4 MD |
288 | }; |
| 289 | ||
| 54eb943b MD |
290 | typedef struct hammer2_mount hammer2_mount_t; |
| 291 | ||
| e4e20f48 MD |
292 | /* |
| 293 | * Per-PFS mount structure for device (aka vp->v_mount) | |
| 294 | */ | |
| 295 | struct hammer2_pfsmount { | |
| 296 | struct mount *mp; /* kernel mount */ | |
| 297 | struct hammer2_mount *hmp; /* device global mount */ | |
| 298 | hammer2_chain_t *rchain; /* PFS root chain */ | |
| 299 | hammer2_inode_t *iroot; /* PFS root inode */ | |
| 300 | struct netexport export; /* nfs export */ | |
| 301 | int ronly; /* read-only mount */ | |
| 302 | }; | |
| 303 | ||
| 304 | typedef struct hammer2_pfsmount hammer2_pfsmount_t; | |
| 305 | ||
| 703720e4 MD |
306 | #if defined(_KERNEL) |
| 307 | ||
| 308 | MALLOC_DECLARE(M_HAMMER2); | |
| 309 | ||
| e4e20f48 MD |
310 | #define VTOI(vp) ((hammer2_inode_t *)(vp)->v_data) |
| 311 | #define ITOV(ip) ((ip)->vp) | |
| 312 | ||
| e118c14f | 313 | static __inline |
| e4e20f48 MD |
314 | hammer2_pfsmount_t * |
| 315 | MPTOPMP(struct mount *mp) | |
| 703720e4 | 316 | { |
| e4e20f48 | 317 | return ((hammer2_pfsmount_t *)mp->mnt_data); |
| 703720e4 MD |
318 | } |
| 319 | ||
| e118c14f | 320 | static __inline |
| e4e20f48 MD |
321 | hammer2_mount_t * |
| 322 | MPTOHMP(struct mount *mp) | |
| 47902fef | 323 | { |
| e4e20f48 | 324 | return (((hammer2_pfsmount_t *)mp->mnt_data)->hmp); |
| 47902fef VS |
325 | } |
| 326 | ||
| 703720e4 MD |
327 | extern struct vop_ops hammer2_vnode_vops; |
| 328 | extern struct vop_ops hammer2_spec_vops; | |
| 329 | extern struct vop_ops hammer2_fifo_vops; | |
| 330 | ||
| 37aa19df | 331 | extern int hammer2_debug; |
| 01eabad4 | 332 | extern int hammer2_cluster_enable; |
| e708f8b9 | 333 | extern int hammer2_hardlink_enable; |
| 01eabad4 MD |
334 | extern long hammer2_iod_file_read; |
| 335 | extern long hammer2_iod_meta_read; | |
| 336 | extern long hammer2_iod_indr_read; | |
| 337 | extern long hammer2_iod_file_write; | |
| 338 | extern long hammer2_iod_meta_write; | |
| 339 | extern long hammer2_iod_indr_write; | |
| 340 | extern long hammer2_iod_volu_write; | |
| 341 | extern long hammer2_ioa_file_read; | |
| 342 | extern long hammer2_ioa_meta_read; | |
| 343 | extern long hammer2_ioa_indr_read; | |
| 344 | extern long hammer2_ioa_file_write; | |
| 345 | extern long hammer2_ioa_meta_write; | |
| 346 | extern long hammer2_ioa_indr_write; | |
| 347 | extern long hammer2_ioa_volu_write; | |
| 37aa19df | 348 | |
| 7cfa8da5 MD |
349 | /* |
| 350 | * hammer2_subr.c | |
| 351 | */ | |
| 54eb943b MD |
352 | void hammer2_inode_lock_ex(hammer2_inode_t *ip); |
| 353 | void hammer2_inode_unlock_ex(hammer2_inode_t *ip); | |
| 9c2e0de0 | 354 | void hammer2_inode_lock_sh(hammer2_inode_t *ip); |
| 54eb943b | 355 | void hammer2_inode_unlock_sh(hammer2_inode_t *ip); |
| 9c2e0de0 MD |
356 | void hammer2_inode_busy(hammer2_inode_t *ip); |
| 357 | void hammer2_inode_unbusy(hammer2_inode_t *ip); | |
| 2910a90c MD |
358 | void hammer2_voldata_lock(hammer2_mount_t *hmp); |
| 359 | void hammer2_voldata_unlock(hammer2_mount_t *hmp); | |
| e118c14f | 360 | |
| 54eb943b MD |
361 | void hammer2_mount_exlock(hammer2_mount_t *hmp); |
| 362 | void hammer2_mount_shlock(hammer2_mount_t *hmp); | |
| 363 | void hammer2_mount_unlock(hammer2_mount_t *hmp); | |
| 703720e4 | 364 | |
| e028fa74 | 365 | int hammer2_get_dtype(hammer2_inode_t *ip); |
| cd4b3d92 | 366 | int hammer2_get_vtype(hammer2_inode_t *ip); |
| 37494cab | 367 | u_int8_t hammer2_get_obj_type(enum vtype vtype); |
| cd4b3d92 | 368 | void hammer2_time_to_timespec(u_int64_t xtime, struct timespec *ts); |
| b2b78aaa | 369 | u_int64_t hammer2_timespec_to_time(struct timespec *ts); |
| 37494cab | 370 | u_int32_t hammer2_to_unix_xid(uuid_t *uuid); |
| b2b78aaa | 371 | void hammer2_guid_to_uuid(uuid_t *uuid, u_int32_t guid); |
| e028fa74 | 372 | |
| 7cfa8da5 | 373 | hammer2_key_t hammer2_dirhash(const unsigned char *name, size_t len); |
| 6ba3b984 | 374 | int hammer2_bytes_to_radix(size_t bytes); |
| 7cfa8da5 | 375 | |
| 8cce658d MD |
376 | int hammer2_calc_logical(hammer2_inode_t *ip, hammer2_off_t uoff, |
| 377 | hammer2_key_t *lbasep, hammer2_key_t *leofp); | |
| b2b78aaa | 378 | void hammer2_update_time(uint64_t *timep); |
| 8cce658d | 379 | |
| 7cfa8da5 MD |
380 | /* |
| 381 | * hammer2_inode.c | |
| 382 | */ | |
| 54eb943b | 383 | struct vnode *hammer2_igetv(hammer2_inode_t *ip, int *errorp); |
| ae183399 | 384 | |
| e708f8b9 MD |
385 | void hammer2_inode_lock_nlinks(hammer2_inode_t *ip); |
| 386 | void hammer2_inode_unlock_nlinks(hammer2_inode_t *ip); | |
| e4e20f48 | 387 | hammer2_inode_t *hammer2_inode_alloc(hammer2_pfsmount_t *pmp, void *data); |
| 7cfa8da5 MD |
388 | void hammer2_inode_free(hammer2_inode_t *ip); |
| 389 | void hammer2_inode_ref(hammer2_inode_t *ip); | |
| 390 | void hammer2_inode_drop(hammer2_inode_t *ip); | |
| 866d5273 | 391 | int hammer2_inode_calc_alloc(hammer2_key_t filesize); |
| 6934ae32 | 392 | |
| e4e20f48 | 393 | int hammer2_inode_create(hammer2_inode_t *dip, |
| e708f8b9 MD |
394 | struct vattr *vap, struct ucred *cred, |
| 395 | const uint8_t *name, size_t name_len, | |
| 396 | hammer2_inode_t **nipp); | |
| 6934ae32 | 397 | |
| 99535653 MD |
398 | int hammer2_inode_duplicate(hammer2_inode_t *dip, |
| 399 | hammer2_inode_t *oip, hammer2_inode_t **nipp, | |
| 400 | const uint8_t *name, size_t name_len); | |
| 401 | int hammer2_inode_connect(hammer2_inode_t *dip, hammer2_inode_t *oip, | |
| db0c2eb3 MD |
402 | const uint8_t *name, size_t name_len); |
| 403 | ||
| ae183399 | 404 | int hammer2_unlink_file(hammer2_inode_t *dip, |
| 004f88b4 MD |
405 | const uint8_t *name, size_t name_len, |
| 406 | int isdir, hammer2_inode_t *retain_ip); | |
| 99535653 | 407 | int hammer2_hardlink_consolidate(hammer2_inode_t **ipp, hammer2_inode_t *tdip); |
| e708f8b9 MD |
408 | int hammer2_hardlink_deconsolidate(hammer2_inode_t *dip, |
| 409 | hammer2_chain_t **chainp, hammer2_inode_t **ipp); | |
| 410 | int hammer2_hardlink_find(hammer2_inode_t *dip, hammer2_chain_t **chainp, | |
| 411 | hammer2_inode_t **ipp); | |
| ae183399 | 412 | |
| 7cfa8da5 MD |
413 | /* |
| 414 | * hammer2_chain.c | |
| 415 | */ | |
| 2910a90c | 416 | void hammer2_modify_volume(hammer2_mount_t *hmp); |
| 5c23d7f1 MD |
417 | hammer2_chain_t *hammer2_chain_alloc(hammer2_mount_t *hmp, |
| 418 | hammer2_blockref_t *bref); | |
| 419 | void hammer2_chain_free(hammer2_mount_t *hmp, hammer2_chain_t *chain); | |
| 7cfa8da5 MD |
420 | void hammer2_chain_ref(hammer2_mount_t *hmp, hammer2_chain_t *chain); |
| 421 | void hammer2_chain_drop(hammer2_mount_t *hmp, hammer2_chain_t *chain); | |
| 01eabad4 MD |
422 | int hammer2_chain_lock(hammer2_mount_t *hmp, hammer2_chain_t *chain, int how); |
| 423 | void hammer2_chain_moved(hammer2_mount_t *hmp, hammer2_chain_t *chain); | |
| 214f4a77 | 424 | void hammer2_chain_modify(hammer2_mount_t *hmp, hammer2_chain_t *chain, |
| 01eabad4 | 425 | int flags); |
| 28ee5f14 | 426 | void hammer2_chain_resize(hammer2_inode_t *ip, hammer2_chain_t *chain, |
| 01eabad4 | 427 | int nradix, int flags); |
| 5c23d7f1 | 428 | void hammer2_chain_unlock(hammer2_mount_t *hmp, hammer2_chain_t *chain); |
| b7926f31 MD |
429 | hammer2_chain_t *hammer2_chain_find(hammer2_mount_t *hmp, |
| 430 | hammer2_chain_t *parent, int index); | |
| 232a50f9 | 431 | hammer2_chain_t *hammer2_chain_get(hammer2_mount_t *hmp, |
| c667909f MD |
432 | hammer2_chain_t *parent, |
| 433 | int index, int flags); | |
| 5c23d7f1 | 434 | hammer2_chain_t *hammer2_chain_lookup(hammer2_mount_t *hmp, |
| e028fa74 | 435 | hammer2_chain_t **parentp, |
| c667909f MD |
436 | hammer2_key_t key_beg, hammer2_key_t key_end, |
| 437 | int flags); | |
| 7cfa8da5 | 438 | hammer2_chain_t *hammer2_chain_next(hammer2_mount_t *hmp, |
| 5c23d7f1 MD |
439 | hammer2_chain_t **parentp, |
| 440 | hammer2_chain_t *chain, | |
| c667909f MD |
441 | hammer2_key_t key_beg, hammer2_key_t key_end, |
| 442 | int flags); | |
| 5c23d7f1 MD |
443 | hammer2_chain_t *hammer2_chain_create(hammer2_mount_t *hmp, |
| 444 | hammer2_chain_t *parent, | |
| 6934ae32 | 445 | hammer2_chain_t *chain, |
| 5c23d7f1 MD |
446 | hammer2_key_t key, int keybits, |
| 447 | int type, size_t bytes); | |
| 3ac6a319 | 448 | void hammer2_chain_delete(hammer2_mount_t *hmp, hammer2_chain_t *parent, |
| 004f88b4 | 449 | hammer2_chain_t *chain, int retain); |
| 4d5318eb MD |
450 | void hammer2_chain_flush(hammer2_mount_t *hmp, hammer2_chain_t *chain, |
| 451 | hammer2_tid_t modify_tid); | |
| b7926f31 | 452 | void hammer2_chain_commit(hammer2_mount_t *hmp, hammer2_chain_t *chain); |
| 50e4f8f4 | 453 | |
| df9ea374 | 454 | /* |
| 2910a90c MD |
455 | * hammer2_ioctl.c |
| 456 | */ | |
| 457 | int hammer2_ioctl(hammer2_inode_t *ip, u_long com, void *data, | |
| 458 | int fflag, struct ucred *cred); | |
| 459 | ||
| 460 | /* | |
| df9ea374 MD |
461 | * hammer2_freemap.c |
| 462 | */ | |
| 6ba3b984 MD |
463 | hammer2_off_t hammer2_freemap_alloc(hammer2_mount_t *hmp, |
| 464 | int type, size_t bytes); | |
| 004f88b4 MD |
465 | void hammer2_freemap_free(hammer2_mount_t *hmp, hammer2_off_t data_off, |
| 466 | int type); | |
| df9ea374 | 467 | |
| 47902fef VS |
468 | #endif /* !_KERNEL */ |
| 469 | #endif /* !_VFS_HAMMER2_HAMMER2_H_ */ |