ufs_inode.h revision 7c478bd95313f5f23a4c958a745db2134aa03244
fa9e4066f08beec538e775443c5be79dd423fcabahrens * CDDL HEADER START
fa9e4066f08beec538e775443c5be79dd423fcabahrens * The contents of this file are subject to the terms of the
ea8dc4b6d2251b437950c0056bc626b311c73c27eschrock * Common Development and Distribution License, Version 1.0 only
ea8dc4b6d2251b437950c0056bc626b311c73c27eschrock * (the "License"). You may not use this file except in compliance
fa9e4066f08beec538e775443c5be79dd423fcabahrens * with the License.
fa9e4066f08beec538e775443c5be79dd423fcabahrens * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
fa9e4066f08beec538e775443c5be79dd423fcabahrens * See the License for the specific language governing permissions
fa9e4066f08beec538e775443c5be79dd423fcabahrens * and limitations under the License.
fa9e4066f08beec538e775443c5be79dd423fcabahrens * When distributing Covered Code, include this CDDL HEADER in each
fa9e4066f08beec538e775443c5be79dd423fcabahrens * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
fa9e4066f08beec538e775443c5be79dd423fcabahrens * If applicable, add the following below this CDDL HEADER, with the
fa9e4066f08beec538e775443c5be79dd423fcabahrens * fields enclosed by brackets "[]" replaced with your own identifying
fa9e4066f08beec538e775443c5be79dd423fcabahrens * information: Portions Copyright [yyyy] [name of copyright owner]
fa9e4066f08beec538e775443c5be79dd423fcabahrens * CDDL HEADER END
daec38ecb4fb5e73e4ca9e99be84f6b8c50c02faJoe Stein * Copyright 2005 Sun Microsystems, Inc. All rights reserved.
9dc3941c735ef88de46e850f745aa556d3a071a5Sašo Kiselkov * Use is subject to license terms.
fa9e4066f08beec538e775443c5be79dd423fcabahrens/* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */
fa9e4066f08beec538e775443c5be79dd423fcabahrens/* All Rights Reserved */
fa9e4066f08beec538e775443c5be79dd423fcabahrens * University Copyright- Copyright (c) 1982, 1986, 1988
fa9e4066f08beec538e775443c5be79dd423fcabahrens * The Regents of the University of California
fa9e4066f08beec538e775443c5be79dd423fcabahrens * All Rights Reserved
0713e232b7712cd27d99e1e935ebb8d5de61c57dGeorge Wilson * University Acknowledgment- Portions of this document are derived from
2e4c998613148111f2fc5371085331ffb39122ffGeorge Wilson * software developed by the University of California, Berkeley, and its
fa9e4066f08beec538e775443c5be79dd423fcabahrens * contributors.
13506d1eefbbc37e2f12a0528831d9f6d4c361d7maybee#pragma ident "%Z%%M% %I% %E% SMI"
22e30981d82a0b6dc89253596ededafae8655e00George Wilson * The I node is the focus of all local file activity in UNIX.
22e30981d82a0b6dc89253596ededafae8655e00George Wilson * There is a unique inode allocated for each active file,
2e4c998613148111f2fc5371085331ffb39122ffGeorge Wilson * each current directory, each mounted-on file, each mapping,
22e30981d82a0b6dc89253596ededafae8655e00George Wilson * and the root. An inode is `named' by its dev/inumber pair.
22e30981d82a0b6dc89253596ededafae8655e00George Wilson * Data in icommon is read in from permanent inode on volume.
22e30981d82a0b6dc89253596ededafae8655e00George Wilson * Each inode has 5 locks associated with it:
22e30981d82a0b6dc89253596ededafae8655e00George Wilson * i_rwlock: Serializes ufs_write and ufs_setattr request
22e30981d82a0b6dc89253596ededafae8655e00George Wilson * and allows ufs_read requests to proceed in parallel.
22e30981d82a0b6dc89253596ededafae8655e00George Wilson * Serializes reads/updates to directories.
22e30981d82a0b6dc89253596ededafae8655e00George Wilson * vfs_dqrwlock: Manages quota sub-system quiescence. See below.
22e30981d82a0b6dc89253596ededafae8655e00George Wilson * i_contents: Protects almost all of the fields in the inode
22e30981d82a0b6dc89253596ededafae8655e00George Wilson * except for those listed below. When held
09c9d376e8ccb8fbba74f33cc268964464092b62George Wilson * in writer mode also protects those fields
2e4c998613148111f2fc5371085331ffb39122ffGeorge Wilson * listed under i_tlock.
2e4c998613148111f2fc5371085331ffb39122ffGeorge Wilson * i_tlock: When i_tlock is held with the i_contents reader
2e4c998613148111f2fc5371085331ffb39122ffGeorge Wilson * lock the i_atime, i_mtime, i_ctime,
2e4c998613148111f2fc5371085331ffb39122ffGeorge Wilson * i_delayoff, i_delaylen, i_nextrio, i_writes, i_flag
2e4c998613148111f2fc5371085331ffb39122ffGeorge Wilson * i_seq, i_writer & i_mapcnt fields are protected.
2e4c998613148111f2fc5371085331ffb39122ffGeorge Wilson * For more i_flag locking info see below.
2e4c998613148111f2fc5371085331ffb39122ffGeorge Wilson * ih_lock: Protects inode hash chain buckets
2e4c998613148111f2fc5371085331ffb39122ffGeorge Wilson * ifree_lock: Protects inode freelist
2e4c998613148111f2fc5371085331ffb39122ffGeorge Wilson * Lock ordering:
2e4c998613148111f2fc5371085331ffb39122ffGeorge Wilson * i_rwlock > i_contents > i_tlock
2e4c998613148111f2fc5371085331ffb39122ffGeorge Wilson * i_rwlock > vfs_dqrwlock > i_contents(writer) > i_tlock
2e4c998613148111f2fc5371085331ffb39122ffGeorge Wilson * i_contents > i_tlock
2e4c998613148111f2fc5371085331ffb39122ffGeorge Wilson * vfs_dqrwlock > i_contents(writer) > i_tlock
2e4c998613148111f2fc5371085331ffb39122ffGeorge Wilson * ih_lock > i_contents > i_tlock
2e4c998613148111f2fc5371085331ffb39122ffGeorge Wilson * Making major changes to quota sub-system state, while the file
b24ab6762772a3f6a89393947930c7fa61306783Jeff Bonwick * system is mounted required the addition of another lock. The
0713e232b7712cd27d99e1e935ebb8d5de61c57dGeorge Wilson * primary lock in the quota sub-system is vfs_dqrwlock in the ufsvfs
b24ab6762772a3f6a89393947930c7fa61306783Jeff Bonwick * structure. This lock is used to manage quota sub-system quiescence
0713e232b7712cd27d99e1e935ebb8d5de61c57dGeorge Wilson * for a particular file system. Major changes to quota sub-system
0713e232b7712cd27d99e1e935ebb8d5de61c57dGeorge Wilson * state (disabling quotas, enabling quotas, and setting new quota
0713e232b7712cd27d99e1e935ebb8d5de61c57dGeorge Wilson * limits) all require the file system to be quiescent and grabbing
0713e232b7712cd27d99e1e935ebb8d5de61c57dGeorge Wilson * vfs_dqrwlock as writer accomplishes this. On the other hand,
0713e232b7712cd27d99e1e935ebb8d5de61c57dGeorge Wilson * grabbing vfs_dqrwlock as reader makes the quota sub-system
0713e232b7712cd27d99e1e935ebb8d5de61c57dGeorge Wilson * non-quiescent and lets the quota sub-system know that now is not a
b24ab6762772a3f6a89393947930c7fa61306783Jeff Bonwick * good time to change major quota sub-system state. Typically
d6e555bdd793b8bc8fe57d5f12c3d69c813d0661George Wilson * vfs_dqrwlock is grabbed for reading before i_contents is grabbed for
d6e555bdd793b8bc8fe57d5f12c3d69c813d0661George Wilson * writing. However, there are cases where vfs_dqrwlock is grabbed for
80eb36f241abf8c076119fb4c49a55fd61ebc710George Wilson * reading without a corresponding i_contents write grab because there
d6e555bdd793b8bc8fe57d5f12c3d69c813d0661George Wilson * is no relevant inode. There are also cases where i_contents is
d6e555bdd793b8bc8fe57d5f12c3d69c813d0661George Wilson * grabbed for writing when a vfs_dqrwlock read grab is not needed
d6e555bdd793b8bc8fe57d5f12c3d69c813d0661George Wilson * because the inode changes do not affect quotas.
d6e555bdd793b8bc8fe57d5f12c3d69c813d0661George Wilson * Unfortunately, performance considerations have required that we be more
d6e555bdd793b8bc8fe57d5f12c3d69c813d0661George Wilson * intelligent about using i_tlock when updating i_flag. Ideally, we would
d6e555bdd793b8bc8fe57d5f12c3d69c813d0661George Wilson * have simply separated out several of the bits in i_flag into their own
d6e555bdd793b8bc8fe57d5f12c3d69c813d0661George Wilson * ints to avoid problems. But, instead, we have implemented the following
d6e555bdd793b8bc8fe57d5f12c3d69c813d0661George Wilson * o You can update any i_flag field while holding the writer-contents,
80eb36f241abf8c076119fb4c49a55fd61ebc710George Wilson * or by holding the reader-contents AND holding i_tlock.
80eb36f241abf8c076119fb4c49a55fd61ebc710George Wilson * You can only call ITIMES_NOLOCK while holding the writer-contents,
80eb36f241abf8c076119fb4c49a55fd61ebc710George Wilson * or by holding the reader-contents AND holding i_tlock.
80eb36f241abf8c076119fb4c49a55fd61ebc710George Wilson * o For a directory, holding the reader-rw_lock is sufficient for setting
80eb36f241abf8c076119fb4c49a55fd61ebc710George Wilson * o Races with IREF are avoided by holding the reader contents lock
80eb36f241abf8c076119fb4c49a55fd61ebc710George Wilson * and by holding i_tlock in ufs_rmidle, ufs_putapage, and ufs_getpage.
0713e232b7712cd27d99e1e935ebb8d5de61c57dGeorge Wilson * And by holding the writer-contents in ufs_iinactive.
0713e232b7712cd27d99e1e935ebb8d5de61c57dGeorge Wilson * o The callers are no longer required to handle the calls to ITIMES
80eb36f241abf8c076119fb4c49a55fd61ebc710George Wilson * and ITIMES_NOLOCK. The functions that set the i_flag bits are
80eb36f241abf8c076119fb4c49a55fd61ebc710George Wilson * responsible for managing those calls. The exceptions are the
0713e232b7712cd27d99e1e935ebb8d5de61c57dGeorge Wilson * bmap routines.
0713e232b7712cd27d99e1e935ebb8d5de61c57dGeorge Wilson * SVR4 Extended Fundamental Type (EFT) support:
80eb36f241abf8c076119fb4c49a55fd61ebc710George Wilson * The inode structure has been enhanced to support
0713e232b7712cd27d99e1e935ebb8d5de61c57dGeorge Wilson * 32-bit user-id, 32-bit group-id, and 32-bit device number.
d6e555bdd793b8bc8fe57d5f12c3d69c813d0661George Wilson * Standard SVR4 ufs also supports 32-bit mode field. For the reason
0713e232b7712cd27d99e1e935ebb8d5de61c57dGeorge Wilson * of backward compatibility with the previous ufs disk format,
0713e232b7712cd27d99e1e935ebb8d5de61c57dGeorge Wilson * 32-bit mode field is not supported.
0713e232b7712cd27d99e1e935ebb8d5de61c57dGeorge Wilson * The current inode structure is 100% backward compatible with
0713e232b7712cd27d99e1e935ebb8d5de61c57dGeorge Wilson * the previous inode structure if no user-id or group-id exceeds
0713e232b7712cd27d99e1e935ebb8d5de61c57dGeorge Wilson * USHRT_MAX, and no major or minor number of a device number
0713e232b7712cd27d99e1e935ebb8d5de61c57dGeorge Wilson * stored in an inode exceeds 255.
0713e232b7712cd27d99e1e935ebb8d5de61c57dGeorge Wilson * Rules for managing i_seq:
0713e232b7712cd27d99e1e935ebb8d5de61c57dGeorge Wilson * o i_seq is locked under the same rules as i_flag
0713e232b7712cd27d99e1e935ebb8d5de61c57dGeorge Wilson * o The i_ctime or i_mtime MUST never change without increasing
2e4c998613148111f2fc5371085331ffb39122ffGeorge Wilson * the value of i_seq.
2e4c998613148111f2fc5371085331ffb39122ffGeorge Wilson * o You may increase the value of i_seq without the timestamps
2e4c998613148111f2fc5371085331ffb39122ffGeorge Wilson * changing, this may decrease the callers performance but will
2e4c998613148111f2fc5371085331ffb39122ffGeorge Wilson * be functionally correct.
2e4c998613148111f2fc5371085331ffb39122ffGeorge Wilson * o The common case is when IUPD or ICHG is set, increase i_seq
2e4c998613148111f2fc5371085331ffb39122ffGeorge Wilson * and immediately call ITIMES* or ufs_iupdat to create a new timestamp.
2e4c998613148111f2fc5371085331ffb39122ffGeorge Wilson * o A less common case is the setting of IUPD or ICHG and while still
2e4c998613148111f2fc5371085331ffb39122ffGeorge Wilson * holding the correct lock defer the timestamp and i_seq update
2e4c998613148111f2fc5371085331ffb39122ffGeorge Wilson * until later, but it must still be done before the lock is released.
2e4c998613148111f2fc5371085331ffb39122ffGeorge Wilson * bmap_write is an example of this, where the caller does the update.
2e4c998613148111f2fc5371085331ffb39122ffGeorge Wilson * o If multiple changes are being made with the timestamps being
0713e232b7712cd27d99e1e935ebb8d5de61c57dGeorge Wilson * updated only at the end, a single increase of i_seq is allowed.
2e4c998613148111f2fc5371085331ffb39122ffGeorge Wilson * o If changes are made with IUPD or ICHG being set, but
0713e232b7712cd27d99e1e935ebb8d5de61c57dGeorge Wilson * the controlling lock is being dropped before the timestamp is
8363e80ae72609660f6090766ca8c2c18aa53f0cGeorge Wilson * updated, there is a risk that another thread will also change
8363e80ae72609660f6090766ca8c2c18aa53f0cGeorge Wilson * the file, update i_flag, and push just one timestamp update.
8363e80ae72609660f6090766ca8c2c18aa53f0cGeorge Wilson * There is also the risk that another thread calls ITIMES or
8363e80ae72609660f6090766ca8c2c18aa53f0cGeorge Wilson * ufs_iupdat without setting IUPD|ICHG and thus not changing i_seq,
8363e80ae72609660f6090766ca8c2c18aa53f0cGeorge Wilson * this will cause ufs_imark to change the timestamps without changing
8363e80ae72609660f6090766ca8c2c18aa53f0cGeorge Wilson * i_seq. If the controlling lock is dropped, ISEQ must be set to
8363e80ae72609660f6090766ca8c2c18aa53f0cGeorge Wilson * force i_seq to be increased on next ufs_imark, but i_seq MUST still
8363e80ae72609660f6090766ca8c2c18aa53f0cGeorge Wilson * be increased by the original setting thread before its deferred
8363e80ae72609660f6090766ca8c2c18aa53f0cGeorge Wilson * call to ITIMES to insure it is increased the correct number of times.
8363e80ae72609660f6090766ca8c2c18aa53f0cGeorge Wilson /* flag value to indicate uid is 32-bit long */
8363e80ae72609660f6090766ca8c2c18aa53f0cGeorge Wilson /* flag value to indicate gid is 32-bit long */
8363e80ae72609660f6090766ca8c2c18aa53f0cGeorge Wilson#define NDADDR 12 /* direct addresses in inode */
8363e80ae72609660f6090766ca8c2c18aa53f0cGeorge Wilson#define NIADDR 3 /* indirect addresses in inode */
8363e80ae72609660f6090766ca8c2c18aa53f0cGeorge Wilson#define FSL_SIZE (NDADDR + NIADDR - 1) * sizeof (daddr32_t)
8363e80ae72609660f6090766ca8c2c18aa53f0cGeorge Wilson /* max fast symbolic name length is 56 */
8363e80ae72609660f6090766ca8c2c18aa53f0cGeorge Wilson o_mode_t ic_smode; /* 0: mode and type of file */
8363e80ae72609660f6090766ca8c2c18aa53f0cGeorge Wilson short ic_nlink; /* 2: number of links to file */
8363e80ae72609660f6090766ca8c2c18aa53f0cGeorge Wilson u_offset_t ic_lsize; /* 8: number of bytes in file */
8363e80ae72609660f6090766ca8c2c18aa53f0cGeorge Wilson struct timeval32 ic_atime; /* 16: time last accessed */
0713e232b7712cd27d99e1e935ebb8d5de61c57dGeorge Wilson struct timeval32 ic_mtime; /* 24: time last modified */
fa9e4066f08beec538e775443c5be79dd423fcabahrens struct timeval32 ic_ctime; /* 32: last time inode changed */
0713e232b7712cd27d99e1e935ebb8d5de61c57dGeorge Wilson time32_t ic_ctime; /* 32: last time inode changed */
fa9e4066f08beec538e775443c5be79dd423fcabahrens daddr32_t ic_db[NDADDR]; /* 40: disk block addresses */
88ecc943b4eb72f7c4fbbd8435997b85ef171fc3George Wilson int32_t ic_blocks; /* 104: 512 byte blocks actually held */
0f7643c7376dd69a08acbfc9d1d7d548b10c846aGeorge Wilson uid_t ic_uid; /* 116: long EFT version of uid */
0f7643c7376dd69a08acbfc9d1d7d548b10c846aGeorge Wilson gid_t ic_gid; /* 120: long EFT version of gid */
fa9e4066f08beec538e775443c5be79dd423fcabahrens uint32_t ic_oeftflag; /* 124: extended attr directory ino, 0 = none */
fa9e4066f08beec538e775443c5be79dd423fcabahrens * Large Files: Note we use the inline functions load_double, store_double
fa9e4066f08beec538e775443c5be79dd423fcabahrens * to load and store the long long values of i_size. Therefore the
fa9e4066f08beec538e775443c5be79dd423fcabahrens * address of i_size must be eight byte aligned. Kmem_alloc of incore
a15215608b8bd90f714f6db21ee623b584607cb6Jeff Bonwick * inode structure makes sure that the structure is 8-byte aligned.
a15215608b8bd90f714f6db21ee623b584607cb6Jeff Bonwick * XX64 - reorder this structure?
a15215608b8bd90f714f6db21ee623b584607cb6Jeff Bonwicktypedef struct inode {
fa9e4066f08beec538e775443c5be79dd423fcabahrens struct inode *i_freef; /* free list forward - must be before i_ic */
0f7643c7376dd69a08acbfc9d1d7d548b10c846aGeorge Wilson struct inode *i_freeb; /* free list back - must be before i_ic */
fa9e4066f08beec538e775443c5be79dd423fcabahrens struct vnode *i_vnode; /* vnode associated with this inode */
88ecc943b4eb72f7c4fbbd8435997b85ef171fc3George Wilson ino_t i_number; /* i number, 1-to-1 with device address */
88ecc943b4eb72f7c4fbbd8435997b85ef171fc3George Wilson off_t i_diroff; /* offset in dir, where we found last entry */
88ecc943b4eb72f7c4fbbd8435997b85ef171fc3George Wilson /* just a hint - no locking needed */
88ecc943b4eb72f7c4fbbd8435997b85ef171fc3George Wilson struct ufsvfs *i_ufsvfs; /* incore fs associated with inode */
88ecc943b4eb72f7c4fbbd8435997b85ef171fc3George Wilson struct dquot *i_dquot; /* quota structure controlling this file */
88ecc943b4eb72f7c4fbbd8435997b85ef171fc3George Wilson krwlock_t i_rwlock; /* serializes write/setattr requests */
88ecc943b4eb72f7c4fbbd8435997b85ef171fc3George Wilson krwlock_t i_contents; /* protects (most of) inode contents */
88ecc943b4eb72f7c4fbbd8435997b85ef171fc3George Wilson kmutex_t i_tlock; /* protects time fields, i_flag */
88ecc943b4eb72f7c4fbbd8435997b85ef171fc3George Wilson /* next byte read offset (read-ahead) */
88ecc943b4eb72f7c4fbbd8435997b85ef171fc3George Wilson /* No lock required */
88ecc943b4eb72f7c4fbbd8435997b85ef171fc3George Wilson uint_t i_seq; /* modification sequence number */
88ecc943b4eb72f7c4fbbd8435997b85ef171fc3George Wilson boolean_t i_cachedir; /* Cache this directory on next lookup */
88ecc943b4eb72f7c4fbbd8435997b85ef171fc3George Wilson /* - no locking needed */
88ecc943b4eb72f7c4fbbd8435997b85ef171fc3George Wilson int *i_map; /* block list for the corresponding file */
88ecc943b4eb72f7c4fbbd8435997b85ef171fc3George Wilson dev_t i_rdev; /* INCORE rdev from i_oldrdev by ufs_iget */
88ecc943b4eb72f7c4fbbd8435997b85ef171fc3George Wilson size_t i_delaylen; /* delayed writes, units=bytes */
88ecc943b4eb72f7c4fbbd8435997b85ef171fc3George Wilson offset_t i_delayoff; /* where we started delaying */
88ecc943b4eb72f7c4fbbd8435997b85ef171fc3George Wilson offset_t i_nextrio; /* where to start the next clust */
88ecc943b4eb72f7c4fbbd8435997b85ef171fc3George Wilson long i_writes; /* number of outstanding bytes in write q */
88ecc943b4eb72f7c4fbbd8435997b85ef171fc3George Wilson kcondvar_t i_wrcv; /* sleep/wakeup for write throttle */
88ecc943b4eb72f7c4fbbd8435997b85ef171fc3George Wilson offset_t i_doff; /* dinode byte offset in file system */
b24ab6762772a3f6a89393947930c7fa61306783Jeff Bonwick dcanchor_t i_danchor; /* directory cache anchor */
b24ab6762772a3f6a89393947930c7fa61306783Jeff Bonwick kthread_t *i_writer; /* thread which is in window in wrip() */
b24ab6762772a3f6a89393947930c7fa61306783Jeff Bonwick * Originally done on x86, but carried on to all other little
2e4c998613148111f2fc5371085331ffb39122ffGeorge Wilson * architectures, which provides for file system compatibility.
2e4c998613148111f2fc5371085331ffb39122ffGeorge Wilson#define i_ordev i_ic.ic_db[1] /* USL SVR4 compatibility */
2e4c998613148111f2fc5371085331ffb39122ffGeorge Wilson#define i_ordev i_ic.ic_db[0] /* was i_oldrdev */
2e4c998613148111f2fc5371085331ffb39122ffGeorge Wilson/* EFT transition aids - obsolete */
2e4c998613148111f2fc5371085331ffb39122ffGeorge Wilson#define IUPD 0x0001 /* file has been modified */
2e4c998613148111f2fc5371085331ffb39122ffGeorge Wilson#define IACC 0x0002 /* inode access time to be updated */
2e4c998613148111f2fc5371085331ffb39122ffGeorge Wilson#define IMOD 0x0004 /* inode has been modified */
2e4c998613148111f2fc5371085331ffb39122ffGeorge Wilson#define ICHG 0x0008 /* inode has been changed */
2e4c998613148111f2fc5371085331ffb39122ffGeorge Wilson#define INOACC 0x0010 /* no access time update in getpage */
2e4c998613148111f2fc5371085331ffb39122ffGeorge Wilson#define IMODTIME 0x0020 /* mod time already set */
2e4c998613148111f2fc5371085331ffb39122ffGeorge Wilson#define IREF 0x0040 /* inode is being referenced */
2e4c998613148111f2fc5371085331ffb39122ffGeorge Wilson#define ISYNC 0x0080 /* do all allocation synchronously */
2e4c998613148111f2fc5371085331ffb39122ffGeorge Wilson#define IFASTSYMLNK 0x0100 /* fast symbolic link */
2e4c998613148111f2fc5371085331ffb39122ffGeorge Wilson#define IMODACC 0x0200 /* only access time changed; */
2e4c998613148111f2fc5371085331ffb39122ffGeorge Wilson /* filesystem won't become active */
2e4c998613148111f2fc5371085331ffb39122ffGeorge Wilson#define IATTCHG 0x0400 /* only size/blocks have changed */
2e4c998613148111f2fc5371085331ffb39122ffGeorge Wilson#define IBDWRITE 0x0800 /* the inode has been scheduled for */
2e4c998613148111f2fc5371085331ffb39122ffGeorge Wilson /* write operation asynchronously */
2e4c998613148111f2fc5371085331ffb39122ffGeorge Wilson#define ISTALE 0x1000 /* inode couldn't be read from disk */
2e4c998613148111f2fc5371085331ffb39122ffGeorge Wilson#define IDEL 0x2000 /* inode is being deleted */
2e4c998613148111f2fc5371085331ffb39122ffGeorge Wilson#define IDIRECTIO 0x4000 /* attempt directio */
2e4c998613148111f2fc5371085331ffb39122ffGeorge Wilson#define ISEQ 0x8000 /* deferred i_seq increase */
2e4c998613148111f2fc5371085331ffb39122ffGeorge Wilson#define IJUNKIQ 0x10000 /* on junk idle queue */
2e4c998613148111f2fc5371085331ffb39122ffGeorge Wilson#define IQUIET 0x20000 /* No file system full messages */
2e4c998613148111f2fc5371085331ffb39122ffGeorge Wilson#define IFATTRDIR 0160000 /* Attribute directory */
2e4c998613148111f2fc5371085331ffb39122ffGeorge Wilson#define ISUID 04000 /* set user id on execution */
2e4c998613148111f2fc5371085331ffb39122ffGeorge Wilson#define ISGID 02000 /* set group id on execution */
2e4c998613148111f2fc5371085331ffb39122ffGeorge Wilson#define ISVTX 01000 /* save swapped text even after use */
2e4c998613148111f2fc5371085331ffb39122ffGeorge Wilson#define IREAD 0400 /* read, write, execute permissions */
2e4c998613148111f2fc5371085331ffb39122ffGeorge Wilson/* specify how the inode info is written in ufs_syncip() */
2e4c998613148111f2fc5371085331ffb39122ffGeorge Wilson#define I_SYNC 1 /* wait for the inode written to disk */
2e4c998613148111f2fc5371085331ffb39122ffGeorge Wilson#define I_DSYNC 2 /* wait for the inode written to disk */
2e4c998613148111f2fc5371085331ffb39122ffGeorge Wilson /* only if IATTCHG is set */
2e4c998613148111f2fc5371085331ffb39122ffGeorge Wilson#define I_ASYNC 0 /* don't wait for the inode written */
2e4c998613148111f2fc5371085331ffb39122ffGeorge Wilson/* flags passed to ufs_itrunc(), indirtrunc(), and free() */
2e4c998613148111f2fc5371085331ffb39122ffGeorge Wilson#define I_FREE 0x00000001 /* inode is being freed */
2e4c998613148111f2fc5371085331ffb39122ffGeorge Wilson#define I_DIR 0x00000002 /* inode is a directory */
2e4c998613148111f2fc5371085331ffb39122ffGeorge Wilson#define I_SHAD 0x00000010 /* inode is a shadow inode */
2e4c998613148111f2fc5371085331ffb39122ffGeorge Wilson#define I_NOCANCEL 0x40 /* Don't cancel these fragments */
2e4c998613148111f2fc5371085331ffb39122ffGeorge Wilson * Statistics on inodes
2e4c998613148111f2fc5371085331ffb39122ffGeorge Wilson * Not protected by locks
2e4c998613148111f2fc5371085331ffb39122ffGeorge Wilson kstat_named_t in_size; /* current cache size */
2e4c998613148111f2fc5371085331ffb39122ffGeorge Wilson kstat_named_t in_maxsize; /* maximum cache size */
c39a2aae1e2c439d156021edfc20910dad7f9891George Wilson kstat_named_t in_maxreached; /* Largest size reached by cache */
c39a2aae1e2c439d156021edfc20910dad7f9891George Wilson kstat_named_t in_frfront; /* # put at front of freelist */
c39a2aae1e2c439d156021edfc20910dad7f9891George Wilson kstat_named_t in_frback; /* # put at back of freelist */
c39a2aae1e2c439d156021edfc20910dad7f9891George Wilson kstat_named_t in_qfree; /* q's to delete thread */
c39a2aae1e2c439d156021edfc20910dad7f9891George Wilson kstat_named_t in_tidles; /* # inodes idled by idle thread */
2e4c998613148111f2fc5371085331ffb39122ffGeorge Wilson kstat_named_t in_lidles; /* # inodes idled by ufs_lookup */
2e4c998613148111f2fc5371085331ffb39122ffGeorge Wilson kstat_named_t in_vidles; /* # inodes idled by ufs_vget */
2e4c998613148111f2fc5371085331ffb39122ffGeorge Wilson kstat_named_t in_kcalloc; /* # inodes kmem_cache_alloced */
2e4c998613148111f2fc5371085331ffb39122ffGeorge Wilson kstat_named_t in_kcfree; /* # inodes kmem_cache_freed */
fa9e4066f08beec538e775443c5be79dd423fcabahrens * Extended attributes
fa9e4066f08beec538e775443c5be79dd423fcabahrensextern int ufs_ninode; /* high-water mark for inode cache */
fa9e4066f08beec538e775443c5be79dd423fcabahrensextern struct vnodeops *ufs_vnodeops; /* vnode operations for ufs */
fa9e4066f08beec538e775443c5be79dd423fcabahrensextern const struct fs_operation_def ufs_vnodeops_template[];
fa9e4066f08beec538e775443c5be79dd423fcabahrens * Convert between inode pointers and vnode pointers
fa9e4066f08beec538e775443c5be79dd423fcabahrens * convert to fs
8363e80ae72609660f6090766ca8c2c18aa53f0cGeorge Wilson * Convert between vnode types and inode formats
8363e80ae72609660f6090766ca8c2c18aa53f0cGeorge Wilson/* Look at sys/mode.h and os/vnode.c */
8363e80ae72609660f6090766ca8c2c18aa53f0cGeorge Wilson * Mark an inode with the current (unique) timestamp.
8363e80ae72609660f6090766ca8c2c18aa53f0cGeorge Wilson * (Note that UFS's concept of time only keeps 32 bits of seconds
8363e80ae72609660f6090766ca8c2c18aa53f0cGeorge Wilson * in the on-disk format).
8363e80ae72609660f6090766ca8c2c18aa53f0cGeorge Wilson#define ITIMES_NOLOCK(ip) ufs_itimes_nolock(ip)
8363e80ae72609660f6090766ca8c2c18aa53f0cGeorge Wilson * The following interfaces are used to do atomic loads and stores
8363e80ae72609660f6090766ca8c2c18aa53f0cGeorge Wilson * of an inode's i_size, which is a long long data type.
8363e80ae72609660f6090766ca8c2c18aa53f0cGeorge Wilson * For LP64, we just to a load or a store - atomicity and alignment
8363e80ae72609660f6090766ca8c2c18aa53f0cGeorge Wilson * are 8-byte guaranteed. For x86 there are no such instructions,
8363e80ae72609660f6090766ca8c2c18aa53f0cGeorge Wilson * so we grab i_contents as reader to get the size; we already hold
8363e80ae72609660f6090766ca8c2c18aa53f0cGeorge Wilson * it as writer when we're setting the size.
8363e80ae72609660f6090766ca8c2c18aa53f0cGeorge Wilson#define UFS_GET_ISIZE(resultp, ip) *(resultp) = (ip)->i_size
8363e80ae72609660f6090766ca8c2c18aa53f0cGeorge Wilson#define UFS_SET_ISIZE(value, ip) (ip)->i_size = (value)
8363e80ae72609660f6090766ca8c2c18aa53f0cGeorge Wilson#else /* _LP64 */
22e30981d82a0b6dc89253596ededafae8655e00George Wilson#endif /* _LP64 */
22e30981d82a0b6dc89253596ededafae8655e00George Wilson * Allocate the specified block in the inode
22e30981d82a0b6dc89253596ededafae8655e00George Wilson * and make sure any in-core pages are initialized.
0f7643c7376dd69a08acbfc9d1d7d548b10c846aGeorge Wilson bmap_write((ip), (u_offset_t)(off), (size), 0, cr)
22e30981d82a0b6dc89253596ededafae8655e00George Wilson#define ESAME (-1) /* trying to rename linked files (special) */
22e30981d82a0b6dc89253596ededafae8655e00George Wilson#define UFS_HOLE (daddr32_t)-1 /* value used when no block allocated */
22e30981d82a0b6dc89253596ededafae8655e00George Wilson/* direnter ops */
0f7643c7376dd69a08acbfc9d1d7d548b10c846aGeorge Wilsonenum de_op { DE_CREATE, DE_MKDIR, DE_LINK, DE_RENAME, DE_SYMLINK, DE_ATTRDIR};
0f7643c7376dd69a08acbfc9d1d7d548b10c846aGeorge Wilson/* dirremove ops */
0f7643c7376dd69a08acbfc9d1d7d548b10c846aGeorge Wilson * This overlays the fid structure (see vfs.h)
0f7643c7376dd69a08acbfc9d1d7d548b10c846aGeorge Wilson * LP64 note: we use int32_t instead of ino_t since UFS does not use
0f7643c7376dd69a08acbfc9d1d7d548b10c846aGeorge Wilson * inode numbers larger than 32-bits and ufid's are passed to NFS
0f7643c7376dd69a08acbfc9d1d7d548b10c846aGeorge Wilson * which expects them to not grow in size beyond 10 bytes (12 including
0f7643c7376dd69a08acbfc9d1d7d548b10c846aGeorge Wilson * the length).
2e4c998613148111f2fc5371085331ffb39122ffGeorge Wilson * each ufs thread (see ufs_thread.c) is managed by this struct
22e30981d82a0b6dc89253596ededafae8655e00George Wilson int uq_lowat; /* thread runs when ne == lowat */
22e30981d82a0b6dc89253596ededafae8655e00George Wilson int uq_hiwat; /* synchronous idle if ne >= hiwat */
22e30981d82a0b6dc89253596ededafae8655e00George Wilson kthread_id_t uq_threadp; /* thread managing this q */
22e30981d82a0b6dc89253596ededafae8655e00George Wilson#define UQ_EXIT (0x0001) /* q server exits at its convenience */
22e30981d82a0b6dc89253596ededafae8655e00George Wilson#define UQ_WAIT (0x0002) /* thread is waiting on q server */
22e30981d82a0b6dc89253596ededafae8655e00George Wilson#define UQ_SUSPEND (0x0004) /* request for suspension */
22e30981d82a0b6dc89253596ededafae8655e00George Wilson#define UQ_SUSPENDED (0x0008) /* thread has suspended itself */
2e4c998613148111f2fc5371085331ffb39122ffGeorge Wilson * global idle queues
22e30981d82a0b6dc89253596ededafae8655e00George Wilson * The queues are sized dynamically in proportion to ufs_ninode
22e30981d82a0b6dc89253596ededafae8655e00George Wilson * which, unless overridden, scales with the amount of memory.
22e30981d82a0b6dc89253596ededafae8655e00George Wilson * The idle queue is halved whenever it hits the low water mark
fa9e4066f08beec538e775443c5be79dd423fcabahrens * (1/4 of ufs_ninode), but can burst to sizes much larger. The number
fa9e4066f08beec538e775443c5be79dd423fcabahrens * of hash queues is currently maintained to give on average IQHASHQLEN
fa9e4066f08beec538e775443c5be79dd423fcabahrens * entries when the idle queue is at the low water mark.
fa9e4066f08beec538e775443c5be79dd423fcabahrens * Note, we do not need to search along the hash queues, but use them
fa9e4066f08beec538e775443c5be79dd423fcabahrens * in order to batch together geographically local inodes to allow
fa9e4066f08beec538e775443c5be79dd423fcabahrens * their updates (via the log or buffer cache) to require less disk seeks.
fa9e4066f08beec538e775443c5be79dd423fcabahrens * This gives an incredible performance boost for logging and a boost for
fa9e4066f08beec538e775443c5be79dd423fcabahrens * non logging file systems.
fa9e4066f08beec538e775443c5be79dd423fcabahrenstypedef struct {
a15215608b8bd90f714f6db21ee623b584607cb6Jeff Bonwick inode_t *i_chain[2]; /* must match inode_t, but unused */
a15215608b8bd90f714f6db21ee623b584607cb6Jeff Bonwick inode_t *i_freef; /* must match inode_t, idle list forward */
0f7643c7376dd69a08acbfc9d1d7d548b10c846aGeorge Wilson inode_t *i_freeb; /* must match inode_t, idle list back */
fa9e4066f08beec538e775443c5be79dd423fcabahrensextern struct ufs_q ufs_idle_q; /* used by global ufs idle thread */
be082110c08433beadb738ad3be035a73d995ea8George Wilsonextern iqhead_t *ufs_junk_iq; /* junk idle queues */
0713e232b7712cd27d99e1e935ebb8d5de61c57dGeorge Wilsonextern iqhead_t *ufs_useful_iq; /* useful idle queues */
0713e232b7712cd27d99e1e935ebb8d5de61c57dGeorge Wilsonextern int ufs_njunk_iq; /* number of entries in junk iq */
fa9e4066f08beec538e775443c5be79dd423fcabahrensextern int ufs_nuseful_iq; /* number of entries in useful iq */
fa9e4066f08beec538e775443c5be79dd423fcabahrensextern int ufs_niqhash; /* number of iq hash qs - power of 2 */
fa9e4066f08beec538e775443c5be79dd423fcabahrensextern int ufs_iqhashmask; /* iq hash mask = ufs_niqhash - 1 */
fa9e4066f08beec538e775443c5be79dd423fcabahrens#define INOCGSHIFT 7 /* 128 inodes per cylinder group */
a15215608b8bd90f714f6db21ee623b584607cb6Jeff Bonwick#define IQHASH(ip) (((ip)->i_number >> INOCGSHIFT) & ufs_iqhashmask)
a15215608b8bd90f714f6db21ee623b584607cb6Jeff Bonwick#define IQNEXT(i) ((i) + 1) & ufs_iqhashmask /* next idle queue */
a33cae9802e94744efee12a7a77c89360645eae8Tim Haleyextern struct ufs_q ufs_hlock; /* used by global ufs hlock thread */
a33cae9802e94744efee12a7a77c89360645eae8Tim Haley * vfs_lfflags flags
a15215608b8bd90f714f6db21ee623b584607cb6Jeff Bonwick#define UFS_LARGEFILES ((ushort_t)0x1) /* set if mount allows largefiles */
fa9e4066f08beec538e775443c5be79dd423fcabahrens * vfs_dfritime flags
a15215608b8bd90f714f6db21ee623b584607cb6Jeff Bonwick * UFS VFS private data.
a15215608b8bd90f714f6db21ee623b584607cb6Jeff Bonwick * UFS file system instances may be linked on several lists.
a15215608b8bd90f714f6db21ee623b584607cb6Jeff Bonwick * - The vfs_next field chains together every extant ufs instance; this
a15215608b8bd90f714f6db21ee623b584607cb6Jeff Bonwick * list is rooted at ufs_instances and should be used in preference to
a15215608b8bd90f714f6db21ee623b584607cb6Jeff Bonwick * the overall vfs list (which is properly the province of the generic
a15215608b8bd90f714f6db21ee623b584607cb6Jeff Bonwick * file system code, not of file system implementations). This same list
a15215608b8bd90f714f6db21ee623b584607cb6Jeff Bonwick * link is used during forcible unmounts to chain together instances that
a15215608b8bd90f714f6db21ee623b584607cb6Jeff Bonwick * can't yet be completely dismantled,
a15215608b8bd90f714f6db21ee623b584607cb6Jeff Bonwick * - The vfs_wnext field is used within ufs_update to form a work list of
a15215608b8bd90f714f6db21ee623b584607cb6Jeff Bonwick * UFS instances to be synced out.
a15215608b8bd90f714f6db21ee623b584607cb6Jeff Bonwicktypedef struct ufsvfs {
a15215608b8bd90f714f6db21ee623b584607cb6Jeff Bonwick struct ufsvfs *vfs_next; /* instance list link */
22e30981d82a0b6dc89253596ededafae8655e00George Wilson struct ufsvfs *vfs_wnext; /* work list link */
a15215608b8bd90f714f6db21ee623b584607cb6Jeff Bonwick struct buf *vfs_bufp; /* buffer containing superblock */
a15215608b8bd90f714f6db21ee623b584607cb6Jeff Bonwick struct vnode *vfs_devvp; /* block device vnode */
a15215608b8bd90f714f6db21ee623b584607cb6Jeff Bonwick ushort_t vfs_lfflags; /* Large files (set by mount) */
a15215608b8bd90f714f6db21ee623b584607cb6Jeff Bonwick ushort_t vfs_qflags; /* QUOTA: filesystem flags */
a15215608b8bd90f714f6db21ee623b584607cb6Jeff Bonwick struct inode *vfs_qinod; /* QUOTA: pointer to quota file */
a15215608b8bd90f714f6db21ee623b584607cb6Jeff Bonwick uint_t vfs_btimelimit; /* QUOTA: block time limit */
a15215608b8bd90f714f6db21ee623b584607cb6Jeff Bonwick uint_t vfs_ftimelimit; /* QUOTA: file time limit */
a15215608b8bd90f714f6db21ee623b584607cb6Jeff Bonwick krwlock_t vfs_dqrwlock; /* QUOTA: protects quota fields */
a15215608b8bd90f714f6db21ee623b584607cb6Jeff Bonwick * some fs local threads
a15215608b8bd90f714f6db21ee623b584607cb6Jeff Bonwick struct ufs_q vfs_delete; /* delayed inode delete */
a15215608b8bd90f714f6db21ee623b584607cb6Jeff Bonwick struct ufs_q vfs_reclaim; /* reclaim open, deleted files */
a15215608b8bd90f714f6db21ee623b584607cb6Jeff Bonwick * This is copied from the super block at mount time.
a15215608b8bd90f714f6db21ee623b584607cb6Jeff Bonwick * This lock protects cg's and super block pointed at by
a15215608b8bd90f714f6db21ee623b584607cb6Jeff Bonwick * vfs_bufp->b_fs. Locks contents of fs and cg's and contents
a15215608b8bd90f714f6db21ee623b584607cb6Jeff Bonwick * of vfs_dio.
a15215608b8bd90f714f6db21ee623b584607cb6Jeff Bonwick struct ulockfs vfs_ulockfs; /* ufs lockfs support */
a15215608b8bd90f714f6db21ee623b584607cb6Jeff Bonwick uint_t vfs_nointr; /* disallow lockfs interrupts */
a15215608b8bd90f714f6db21ee623b584607cb6Jeff Bonwick uint_t vfs_nosetsec; /* disallow ufs_setsecattr */
a15215608b8bd90f714f6db21ee623b584607cb6Jeff Bonwick uint_t vfs_syncdir; /* synchronous local directory ops */
a15215608b8bd90f714f6db21ee623b584607cb6Jeff Bonwick uint_t vfs_dontblock; /* don't block on forced umount */
0713e232b7712cd27d99e1e935ebb8d5de61c57dGeorge Wilson * trans (logging ufs) stuff
a15215608b8bd90f714f6db21ee623b584607cb6Jeff Bonwick uint_t vfs_domatamap; /* set if matamap enabled */
a15215608b8bd90f714f6db21ee623b584607cb6Jeff Bonwick ulong_t vfs_maxacl; /* transaction stuff - max acl size */
a15215608b8bd90f714f6db21ee623b584607cb6Jeff Bonwick ulong_t vfs_dirsize; /* logspace for directory creation */
a15215608b8bd90f714f6db21ee623b584607cb6Jeff Bonwick ulong_t vfs_avgbfree; /* average free blks in cg (blkpref) */
a15215608b8bd90f714f6db21ee623b584607cb6Jeff Bonwick * Some useful constants
a15215608b8bd90f714f6db21ee623b584607cb6Jeff Bonwick int vfs_nindirshift; /* calc. from fs_nindir */
a15215608b8bd90f714f6db21ee623b584607cb6Jeff Bonwick int vfs_nindiroffset; /* calc. from fs_ninidr */
a15215608b8bd90f714f6db21ee623b584607cb6Jeff Bonwick int vfs_ioclustsz; /* bytes in read/write cluster */
a15215608b8bd90f714f6db21ee623b584607cb6Jeff Bonwick int vfs_iotransz; /* max device i/o transfer size */
a15215608b8bd90f714f6db21ee623b584607cb6Jeff Bonwick vfs_ufsfx_t vfs_fsfx; /* lock/fix-on-panic support */
0f7643c7376dd69a08acbfc9d1d7d548b10c846aGeorge Wilson * More useful constants
0f7643c7376dd69a08acbfc9d1d7d548b10c846aGeorge Wilson * Force DirectIO on all files
0f7643c7376dd69a08acbfc9d1d7d548b10c846aGeorge Wilson * Deferred inode time related fields
2e4c998613148111f2fc5371085331ffb39122ffGeorge Wilson clock_t vfs_iotstamp; /* last I/O timestamp */
2e4c998613148111f2fc5371085331ffb39122ffGeorge Wilson uint_t vfs_dfritime; /* deferred inode time flags */
2e4c998613148111f2fc5371085331ffb39122ffGeorge Wilson * Some more useful info
2e4c998613148111f2fc5371085331ffb39122ffGeorge Wilson struct ml_unit *vfs_log; /* pointer to embedded log struct */
2e4c998613148111f2fc5371085331ffb39122ffGeorge Wilson uint_t vfs_noatime; /* disable inode atime updates */
2e4c998613148111f2fc5371085331ffb39122ffGeorge Wilson * snapshot stuff
2e4c998613148111f2fc5371085331ffb39122ffGeorge Wilson * Controls logging "file system full" messages to messages file
2e4c998613148111f2fc5371085331ffb39122ffGeorge Wilson int vfs_nolog_si; /* not logging summary info */
2e4c998613148111f2fc5371085331ffb39122ffGeorge Wilson * values for vfs_validfs
2e4c998613148111f2fc5371085331ffb39122ffGeorge Wilson/* inohsz is guaranteed to be a power of 2 */
2e4c998613148111f2fc5371085331ffb39122ffGeorge Wilson#define INOHASH(ino) (((int)ino) & (inohsz - 1))
2e4c998613148111f2fc5371085331ffb39122ffGeorge Wilson#endif /* _KERNEL */
2e4c998613148111f2fc5371085331ffb39122ffGeorge Wilson * ufs function prototypes
2e4c998613148111f2fc5371085331ffb39122ffGeorge Wilsonextern void ufs_iinit(void);
2e4c998613148111f2fc5371085331ffb39122ffGeorge Wilsonextern int ufs_iget(struct vfs *, ino_t, struct inode **, cred_t *);
2e4c998613148111f2fc5371085331ffb39122ffGeorge Wilsonextern int ufs_iget_alloced(struct vfs *, ino_t, struct inode **,
2e4c998613148111f2fc5371085331ffb39122ffGeorge Wilsonextern int ufs_itrunc(struct inode *, u_offset_t, int, cred_t *);
2e4c998613148111f2fc5371085331ffb39122ffGeorge Wilsonextern int rdip(struct inode *, struct uio *, int, struct cred *);
2e4c998613148111f2fc5371085331ffb39122ffGeorge Wilsonextern int wrip(struct inode *, struct uio *, int, struct cred *);
2e4c998613148111f2fc5371085331ffb39122ffGeorge Wilsonextern int ufs_dirlook(struct inode *, char *, struct inode **,
2e4c998613148111f2fc5371085331ffb39122ffGeorge Wilsonextern int ufs_direnter_cm(struct inode *, char *, enum de_op,
2e4c998613148111f2fc5371085331ffb39122ffGeorge Wilson struct vattr *, struct inode **, cred_t *, int);
2e4c998613148111f2fc5371085331ffb39122ffGeorge Wilsonextern int ufs_direnter_lr(struct inode *, char *, enum de_op,
2e4c998613148111f2fc5371085331ffb39122ffGeorge Wilson struct inode *, struct inode *, cred_t *, vnode_t **);
2e4c998613148111f2fc5371085331ffb39122ffGeorge Wilsonextern int ufs_dircheckpath(ino_t, struct inode *, struct inode *,
2e4c998613148111f2fc5371085331ffb39122ffGeorge Wilsonextern int ufs_dirmakeinode(struct inode *, struct inode **,
2e4c998613148111f2fc5371085331ffb39122ffGeorge Wilsonextern int ufs_dirremove(struct inode *, char *, struct inode *,
2e4c998613148111f2fc5371085331ffb39122ffGeorge Wilsonextern int ufs_xattrdirempty(struct inode *, ino_t, cred_t *);
2e4c998613148111f2fc5371085331ffb39122ffGeorge Wilsonextern int blkatoff(struct inode *, off_t, char **, struct fbuf **);
2e4c998613148111f2fc5371085331ffb39122ffGeorge Wilsonextern int ufs_ialloc(struct inode *, ino_t, mode_t, struct inode **,
2e4c998613148111f2fc5371085331ffb39122ffGeorge Wilsonextern void free(struct inode *, daddr_t, off_t, int);
fa9e4066f08beec538e775443c5be79dd423fcabahrensextern int alloc(struct inode *, daddr_t, int, daddr_t *, cred_t *);
ecc2d604e885a75cc75e647b5641af99d5a6f4a6bonwickextern int realloccg(struct inode *, daddr_t, daddr_t, int, int,
fa9e4066f08beec538e775443c5be79dd423fcabahrensextern int ufs_freesp(struct vnode *, struct flock64 *, int, cred_t *);
2e4c998613148111f2fc5371085331ffb39122ffGeorge Wilsonextern daddr_t blkpref(struct inode *, daddr_t, int, daddr32_t *);
fa9e4066f08beec538e775443c5be79dd423fcabahrensextern int ufs_rdwri(enum uio_rw, int, struct inode *, caddr_t, ssize_t,
fa9e4066f08beec538e775443c5be79dd423fcabahrensextern int bmap_read(struct inode *, u_offset_t, daddr_t *, int *);
fa9e4066f08beec538e775443c5be79dd423fcabahrensextern int bmap_write(struct inode *, u_offset_t, int, int, struct cred *);
2e4c998613148111f2fc5371085331ffb39122ffGeorge Wilsonextern int bmap_find(struct inode *, boolean_t, u_offset_t *);
fa9e4066f08beec538e775443c5be79dd423fcabahrensextern void ufs_update(int);
fa9e4066f08beec538e775443c5be79dd423fcabahrensextern int ufs_getsummaryinfo(dev_t, struct ufsvfs *, struct fs *);
fa9e4066f08beec538e775443c5be79dd423fcabahrensextern int ufs_putsummaryinfo(dev_t, struct ufsvfs *, struct fs *);
fa9e4066f08beec538e775443c5be79dd423fcabahrensextern int ufs_syncip(struct inode *, int, int, top_t);
fa9e4066f08beec538e775443c5be79dd423fcabahrensextern int ufs_indirblk_sync(struct inode *, offset_t);
5f5f7a6f9c8e9c1587a54e690556d756ec67558cahrensextern int ufs_indir_badblock(struct inode *, daddr32_t *);
2e4c998613148111f2fc5371085331ffb39122ffGeorge Wilsonextern void setblock(struct fs *, uchar_t *, daddr_t);
ecc2d604e885a75cc75e647b5641af99d5a6f4a6bonwickextern void clrblock(struct fs *, uchar_t *, daddr_t);
ecc2d604e885a75cc75e647b5641af99d5a6f4a6bonwickextern int isclrblock(struct fs *, uchar_t *, daddr_t);
fa9e4066f08beec538e775443c5be79dd423fcabahrensextern void fragacct(struct fs *, int, int32_t *, int);
fa9e4066f08beec538e775443c5be79dd423fcabahrensextern int ufs_fbwrite(struct fbuf *, struct inode *);
fa9e4066f08beec538e775443c5be79dd423fcabahrensextern int ufs_fbiwrite(struct fbuf *, struct inode *, daddr_t, long);
fa9e4066f08beec538e775443c5be79dd423fcabahrensextern int ufs_putapage(struct vnode *, struct page *, u_offset_t *,
2e4c998613148111f2fc5371085331ffb39122ffGeorge Wilson * special stuff
2e4c998613148111f2fc5371085331ffb39122ffGeorge Wilsonextern int ufs_scan_inodes(int, int (*)(struct inode *, void *), void *,
2e4c998613148111f2fc5371085331ffb39122ffGeorge Wilsonextern int ufs_sync_inode(struct inode *, void *);
2e4c998613148111f2fc5371085331ffb39122ffGeorge Wilsonextern int ufs_sticky_remove_access(struct inode *, struct inode *,
2e4c998613148111f2fc5371085331ffb39122ffGeorge Wilsonextern int chkiq(struct ufsvfs *, int, struct inode *, uid_t, int,
2e4c998613148111f2fc5371085331ffb39122ffGeorge Wilson * ufs thread stuff
2e4c998613148111f2fc5371085331ffb39122ffGeorge Wilsonextern void ufs_delete_drain(struct vfs *, int, int);
2e4c998613148111f2fc5371085331ffb39122ffGeorge Wilsonextern void ufs_delete(struct ufsvfs *, struct inode *, int);
2e4c998613148111f2fc5371085331ffb39122ffGeorge Wilsonextern void ufs_inode_cache_reclaim(void *);
2e4c998613148111f2fc5371085331ffb39122ffGeorge Wilsonextern void ufs_idle_some(int);
2e4c998613148111f2fc5371085331ffb39122ffGeorge Wilsonextern void ufs_thread_idle(void);
2e4c998613148111f2fc5371085331ffb39122ffGeorge Wilsonextern void ufs_thread_init(struct ufs_q *, int);
2e4c998613148111f2fc5371085331ffb39122ffGeorge Wilsonextern void ufs_thread_start(struct ufs_q *, void (*)(), struct vfs *);
2e4c998613148111f2fc5371085331ffb39122ffGeorge Wilsonextern void ufs_thread_suspend(struct ufs_q *);
2e4c998613148111f2fc5371085331ffb39122ffGeorge Wilsonextern void ufs_thread_continue(struct ufs_q *);
22e30981d82a0b6dc89253596ededafae8655e00George Wilsonextern void ufs_thread_hlock(void *);
22e30981d82a0b6dc89253596ededafae8655e00George Wilsonextern void ufs_delete_adjust_stats(struct ufsvfs *, struct statvfs64 *);
2e4c998613148111f2fc5371085331ffb39122ffGeorge Wilsonextern void ufs_delete_drain_wait(struct ufsvfs *, int);
0f7643c7376dd69a08acbfc9d1d7d548b10c846aGeorge Wilson * ufs lockfs stuff
0f7643c7376dd69a08acbfc9d1d7d548b10c846aGeorge Wilsonextern int ufs_reconcile_fs(struct vfs *, struct ufsvfs *, int);
0f7643c7376dd69a08acbfc9d1d7d548b10c846aGeorge Wilsonextern int ufs_fiolfs(struct vnode *, struct lockfs *, int);
0f7643c7376dd69a08acbfc9d1d7d548b10c846aGeorge Wilsonextern int ufs__fiolfs(struct vnode *, struct lockfs *, int, int);
22e30981d82a0b6dc89253596ededafae8655e00George Wilsonextern int ufs_fiolfss(struct vnode *, struct lockfs *);
0f7643c7376dd69a08acbfc9d1d7d548b10c846aGeorge Wilsonextern int ufs_fioffs(struct vnode *, char *, struct cred *);
22e30981d82a0b6dc89253596ededafae8655e00George Wilsonextern int ufs_check_lockfs(struct ufsvfs *, struct ulockfs *, ulong_t);
22e30981d82a0b6dc89253596ededafae8655e00George Wilsonextern int ufs_lockfs_begin(struct ufsvfs *, struct ulockfs **, ulong_t);
22e30981d82a0b6dc89253596ededafae8655e00George Wilsonextern int ufs_lockfs_begin_getpage(struct ufsvfs *, struct ulockfs **,
2e4c998613148111f2fc5371085331ffb39122ffGeorge Wilson * ufs acl stuff
0f7643c7376dd69a08acbfc9d1d7d548b10c846aGeorge Wilsonextern int ufs_si_inherit(struct inode *, struct inode *, o_mode_t, cred_t *);
0f7643c7376dd69a08acbfc9d1d7d548b10c846aGeorge Wilsonextern void si_cache_init(void);
0f7643c7376dd69a08acbfc9d1d7d548b10c846aGeorge Wilsonextern int ufs_si_load(struct inode *, cred_t *);
0f7643c7376dd69a08acbfc9d1d7d548b10c846aGeorge Wilsonextern int ufs_acl_access(struct inode *, int, cred_t *);
0f7643c7376dd69a08acbfc9d1d7d548b10c846aGeorge Wilsonextern int ufs_si_free(si_t *, struct vfs *, cred_t *);
0f7643c7376dd69a08acbfc9d1d7d548b10c846aGeorge Wilsonextern int ufs_acl_setattr(struct inode *, struct vattr *, cred_t *);
0f7643c7376dd69a08acbfc9d1d7d548b10c846aGeorge Wilsonextern int ufs_acl_get(struct inode *, vsecattr_t *, int, cred_t *);
0f7643c7376dd69a08acbfc9d1d7d548b10c846aGeorge Wilsonextern int ufs_acl_set(struct inode *, vsecattr_t *, int, cred_t *);
0f7643c7376dd69a08acbfc9d1d7d548b10c846aGeorge Wilson * ufs directio stuff
0f7643c7376dd69a08acbfc9d1d7d548b10c846aGeorge Wilsonextern int ufs_directio_write(struct inode *, uio_t *, int, int, cred_t *,
0f7643c7376dd69a08acbfc9d1d7d548b10c846aGeorge Wilsonextern int ufs_directio_read(struct inode *, uio_t *, cred_t *, int *);
0f7643c7376dd69a08acbfc9d1d7d548b10c846aGeorge Wilson * ufs extensions for PXFS
0f7643c7376dd69a08acbfc9d1d7d548b10c846aGeorge Wilsonint ufs_rdwr_data(vnode_t *vp, u_offset_t offset, size_t len, fdbuffer_t *fdb,
0f7643c7376dd69a08acbfc9d1d7d548b10c846aGeorge Wilsonint ufs_alloc_data(vnode_t *vp, u_offset_t offset, size_t *len, fdbuffer_t *fdb,
0f7643c7376dd69a08acbfc9d1d7d548b10c846aGeorge Wilson * prototypes to support the forced unmount
0f7643c7376dd69a08acbfc9d1d7d548b10c846aGeorge Wilsonvoid ufs_freeze(struct ulockfs *, struct lockfs *);
0f7643c7376dd69a08acbfc9d1d7d548b10c846aGeorge Wilsonint ufs_thaw(struct vfs *, struct ufsvfs *, struct ulockfs *);
0f7643c7376dd69a08acbfc9d1d7d548b10c846aGeorge Wilson * extended attributes
0f7643c7376dd69a08acbfc9d1d7d548b10c846aGeorge Wilsonint ufs_xattrmkdir(inode_t *, inode_t **, int, struct cred *);
0f7643c7376dd69a08acbfc9d1d7d548b10c846aGeorge Wilsonint ufs_xattr_getattrdir(vnode_t *, inode_t **, int, struct cred *);
0f7643c7376dd69a08acbfc9d1d7d548b10c846aGeorge Wilson#endif /* defined(_KERNEL) && !defined(_BOOT) */
0f7643c7376dd69a08acbfc9d1d7d548b10c846aGeorge Wilson#endif /* _SYS_FS_UFS_INODE_H */