rnode4.h revision 6962f5b8ab9112ea1e951c076b3eb4583ef37612
1131N/A * The contents of this file are subject to the terms of the 1131N/A * Common Development and Distribution License (the "License"). 1131N/A * You may not use this file except in compliance with the License. 1131N/A * See the License for the specific language governing permissions 1131N/A * and limitations under the License. 1131N/A * When distributing Covered Code, include this CDDL HEADER in each 1131N/A * If applicable, add the following below this CDDL HEADER, with the 1131N/A * fields enclosed by brackets "[]" replaced with your own identifying 1131N/A * information: Portions Copyright [yyyy] [name of copyright owner] 1131N/A * Copyright 2009 Sun Microsystems, Inc. All rights reserved. 1131N/A * Use is subject to license terms. 1131N/A/* Copyright (c) 1983, 1984, 1985, 1986, 1987, 1988, 1989 AT&T */ 1828N/A * Note on the different buffer sizes in rddir4_cache: 1828N/A * There seems to be some discrepancy between the intended and actual 1828N/A * use of entlen and buflen, which does not correspond to the comment below. 1828N/A * entlen - nfsv2/3 used as both alloc'd size of entries buffer and 1828N/A * as the actual size of the entries (XXX is this correct?). 1828N/A * nfsv4 will use it only as the alloc'd size. 1828N/A * buflen - used for calculations of readahead. 1828N/A * actlen - added for nfsv4 to serve as the size of the useful 1828N/A * portion of the entries buffer. That is because in 1828N/A * nfsv4, the otw entries are converted to system entries, 1828N/A * and may not be the same size - thus buffer may not be full. 1828N/A int eof;
/* EOF reached after this request */ 1828N/A int buflen;
/* size of the buffer used to store entries */ 1828N/A int actlen;
/* size of the actual entries (nfsv4 only) */ 1828N/A * A file's shadow vnode list is protected by its hash bucket lock, 1828N/A * sv_r_vnode is protected by the appropriate vnode locks. 1828N/A * sv_dfh, sv_name, sv_dfileid, and sv_dfileid_valid are protected 1828N/A * The format of the hash bucket used to lookup rnodes from a file handle. 1828N/A * Remote file information structure. 1828N/A * The rnode is the "inode" for remote files. It contains all the 1828N/A * information necessary to handle remote file on the client side. 1828N/A * Note on file sizes: we keep two file sizes in the rnode: the size 1828N/A * according to the client (r_size) and the size according to the server 1828N/A * (r_attr.va_size). They can differ because we modify r_size during a 1828N/A * write system call (nfs_rdwr), before the write request goes over the 1828N/A * wire (before the file is actually modified on the server). If an OTW 1828N/A * request occurs before the cached data is written to the server the file 1828N/A * size returned from the server (r_attr.va_size) may not match r_size. 1828N/A * r_size is the one we use, in general. r_attr.va_size is only used to 1828N/A * determine whether or not our cached data is valid. 1828N/A * Each rnode has 5 locks associated with it (not including the rnode 1828N/A * hash table and free list locks): 1828N/A * r_rwlock: Serializes nfs_write and nfs_setattr requests 1828N/A * and allows nfs_read requests to proceed in parallel. 1828N/A * r_lkserlock: Serializes lock requests with map, write, and 1828N/A * r_statelock: Protects all fields in the rnode except for 1828N/A * those listed below. This lock is intented 1828N/A * to be held for relatively short periods of 1828N/A * time (not accross entire putpage operations, 1828N/A * r_statev4_lock: Protects the created_v4 flag, the lock_owners list, 1828N/A * and all the delegation fields except r_deleg_list. 1828N/A * r_os_lock: Protects r_open_streams. 1828N/A * The following members are protected by the mutex rp4freelist_lock: 1389N/A * The following members are protected by the hash bucket rwlock: 1389N/A * r_fh is read-only except when an rnode is created (or recycled from the 1389N/A * The following members are protected by nfs4_server_t::s_lock: 1389N/A * Note: r_modaddr is only accessed when the r_statelock mutex is held. 1828N/A * Its value is also controlled via r_rwlock. It is assumed that 1828N/A * there will be only 1 writer active at a time, so it safe to 1389N/A * set r_modaddr and release r_statelock as long as the r_rwlock 1389N/A * r_inmap informs nfs4_read()/write() that there is a call to nfs4_map() 1828N/A * in progress. nfs4_read()/write() check r_inmap to decide whether 1828N/A * to perform directio on the file or not. r_inmap is atomically 1389N/A * incremented in nfs4_map() before the address space routines are 1828N/A * called and atomically decremented just before nfs4_map() exits. 1828N/A * r_inmap is not protected by any lock. 1828N/A * r_mapcnt tells that the rnode has mapped pages. r_inmap can be 0 1389N/A * while the rnode has mapped pages. 1828N/A * 64-bit offsets: the code formerly assumed that atomic reads of 1828N/A * r_size were safe and reliable; on 32-bit architectures, this is 1389N/A * not true since an intervening bus cycle from another processor 1389N/A * could update half of the size field. The r_statelock must now 1389N/A * be held whenever any kind of access of r_size is made. 1389N/A * r_rwlock > r_lkserlock > r_os_lock > r_statelock > r_statev4_lock 1389N/A * vnode_t::v_lock > r_os_lock 1828N/A /* the hash fields must be first to match the rhashq_t */ 1828N/A /* delegated rnodes for this server */ 1389N/A /* server on delegated open */ 1389N/A /* server on delegated open */ 1828N/A /* change @ write deleg grant */ 1828N/A /* delegation was granted */ 1828N/A /* delegation needs recovery */ 1828N/A /* This contains the delegation type */ 1828N/A /* for use with CLAIM_PREVIOUS. */ 1828N/A /* OPEN_DELEGATE_NONE means recovery */ 1828N/A /* delegation has been recalled by */ 1828N/A /* the server during open with */ 1828N/A /* delegreturn is pending, don't use */ 1828N/A /* the delegation stateid, set in */ 1828N/A /* delegreturn is in progress, may */ 1828N/A /* only be set by nfs4delegreturn. */ 1828N/A /* lock for synchronizing delegreturn */ 1828N/A /* with in other operations, acquired */ 1828N/A /* in read mode by nfs4_start_fop, */ 1828N/A /* acquired in write mode in */ 1389N/A /* should always request change */ 1828N/A /* when rnode created; compare with */ 1389N/A /* sv_fsid (servinfo4_t) to see why */ 1828N/A#
define R4LOOKUP 0x200000 /* a lookup has been done in the directory */ 1828N/A * Convert between vnode and rnode /* Used for r_delay_interval */ /* Used for check_rtable4 */ /* shadow vnode functions */ * Mark cached attributes as timed out * The caller must not be holding the rnode r_statelock mutex. * Defines for the flag argument of nfs4delegreturn #
define NFS4_DR_PUSH 0x2 /* push modified data back to the server */#
define NFS4_DR_RECALL 0x10 /* delegreturn done in response to CB_RECALL */#
endif /* _NFS_RNODE4_H */