Linux Kernel  3.7.1
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
Data Structures | Macros | Functions | Variables
nfs_fs.h File Reference
#include <uapi/linux/nfs_fs.h>
#include <linux/in.h>
#include <linux/mm.h>
#include <linux/pagemap.h>
#include <linux/rbtree.h>
#include <linux/rwsem.h>
#include <linux/wait.h>
#include <linux/sunrpc/debug.h>
#include <linux/sunrpc/auth.h>
#include <linux/sunrpc/clnt.h>
#include <linux/nfs.h>
#include <linux/nfs2.h>
#include <linux/nfs3.h>
#include <linux/nfs4.h>
#include <linux/nfs_xdr.h>
#include <linux/nfs_fs_sb.h>
#include <linux/mempool.h>

Go to the source code of this file.

Data Structures

struct  nfs_access_entry
 
struct  nfs_lockowner
 
struct  nfs_lock_context
 
struct  nfs_open_context
 
struct  nfs_open_dir_context
 
struct  nfs_inode
 

Macros

#define NFS_RPC_SWAPFLAGS   (RPC_TASK_SWAPPER|RPC_TASK_ROOTCREDS)
 
#define NFS_CONTEXT_ERROR_WRITE   (0)
 
#define NFS_CONTEXT_RESEND_WRITES   (1)
 
#define NFS_INO_INVALID_ATTR   0x0001 /* cached attrs are invalid */
 
#define NFS_INO_INVALID_DATA   0x0002 /* cached data is invalid */
 
#define NFS_INO_INVALID_ATIME   0x0004 /* cached atime is invalid */
 
#define NFS_INO_INVALID_ACCESS   0x0008 /* cached access cred invalid */
 
#define NFS_INO_INVALID_ACL   0x0010 /* cached acls are invalid */
 
#define NFS_INO_REVAL_PAGECACHE   0x0020 /* must revalidate pagecache */
 
#define NFS_INO_REVAL_FORCED   0x0040 /* force revalidation ignoring a delegation */
 
#define NFS_INO_ADVISE_RDPLUS   (0) /* advise readdirplus */
 
#define NFS_INO_STALE   (1) /* possible stale inode */
 
#define NFS_INO_ACL_LRU_SET   (2) /* Inode is on the LRU list */
 
#define NFS_INO_FLUSHING   (4) /* inode is flushing out data */
 
#define NFS_INO_FSCACHE   (5) /* inode can be cached by FS-Cache */
 
#define NFS_INO_FSCACHE_LOCK   (6) /* FS-Cache cookie management lock */
 
#define NFS_INO_COMMIT   (7) /* inode is committing unstable writes */
 
#define NFS_INO_LAYOUTCOMMIT   (9) /* layoutcommit required */
 
#define NFS_INO_LAYOUTCOMMITTING   (10) /* layoutcommit inflight */
 
#define nfs3_listxattr   NULL
 
#define nfs3_getxattr   NULL
 
#define nfs3_setxattr   NULL
 
#define nfs3_removexattr   NULL
 
#define nfs_register_sysctl()   0
 
#define nfs_unregister_sysctl()   do { } while(0)
 
#define NFS_JUKEBOX_RETRY_TIME   (5 * HZ)
 
#define ifdebug(fac)   if (0)
 
#define NFS_IFDEBUG(x)
 

Functions

int nfs_sync_mapping (struct address_space *mapping)
 
void nfs_zap_mapping (struct inode *inode, struct address_space *mapping)
 
void nfs_zap_caches (struct inode *)
 
void nfs_invalidate_atime (struct inode *)
 
struct inodenfs_fhget (struct super_block *, struct nfs_fh *, struct nfs_fattr *)
 
int nfs_refresh_inode (struct inode *, struct nfs_fattr *)
 
int nfs_post_op_update_inode (struct inode *inode, struct nfs_fattr *fattr)
 
int nfs_post_op_update_inode_force_wcc (struct inode *inode, struct nfs_fattr *fattr)
 
int nfs_getattr (struct vfsmount *, struct dentry *, struct kstat *)
 
void nfs_access_add_cache (struct inode *, struct nfs_access_entry *)
 
void nfs_access_set_mask (struct nfs_access_entry *, u32)
 
int nfs_permission (struct inode *, int)
 
int nfs_open (struct inode *, struct file *)
 
int nfs_release (struct inode *, struct file *)
 
int nfs_attribute_timeout (struct inode *inode)
 
int nfs_revalidate_inode (struct nfs_server *server, struct inode *inode)
 
int __nfs_revalidate_inode (struct nfs_server *, struct inode *)
 
int nfs_revalidate_mapping (struct inode *inode, struct address_space *mapping)
 
int nfs_setattr (struct dentry *, struct iattr *)
 
void nfs_setattr_update_inode (struct inode *inode, struct iattr *attr)
 
struct nfs_open_contextget_nfs_open_context (struct nfs_open_context *ctx)
 
void put_nfs_open_context (struct nfs_open_context *ctx)
 
struct nfs_open_contextnfs_find_open_context (struct inode *inode, struct rpc_cred *cred, fmode_t mode)
 
struct nfs_open_contextalloc_nfs_open_context (struct dentry *dentry, fmode_t f_mode)
 
void nfs_file_set_open_context (struct file *filp, struct nfs_open_context *ctx)
 
struct nfs_lock_contextnfs_get_lock_context (struct nfs_open_context *ctx)
 
void nfs_put_lock_context (struct nfs_lock_context *l_ctx)
 
u64 nfs_compat_user_ino64 (u64 fileid)
 
void nfs_fattr_init (struct nfs_fattr *fattr)
 
unsigned long nfs_inc_attr_generation_counter (void)
 
struct nfs_fattrnfs_alloc_fattr (void)
 
struct nfs_fhnfs_alloc_fhandle (void)
 
int nfs_root_data (char **root_device, char **root_data)
 
__be32 root_nfs_parse_addr (char *name)
 
ssize_t nfs_direct_IO (int, struct kiocb *, const struct iovec *, loff_t, unsigned long)
 
ssize_t nfs_file_direct_read (struct kiocb *iocb, const struct iovec *iov, unsigned long nr_segs, loff_t pos, bool uio)
 
ssize_t nfs_file_direct_write (struct kiocb *iocb, const struct iovec *iov, unsigned long nr_segs, loff_t pos, bool uio)
 
void nfs_force_lookup_revalidate (struct inode *dir)
 
int nfs_instantiate (struct dentry *dentry, struct nfs_fh *fh, struct nfs_fattr *fattr)
 
int nfs_may_open (struct inode *inode, struct rpc_cred *cred, int openflags)
 
void nfs_access_zap_cache (struct inode *inode)
 
void nfs_release_automount_timer (void)
 
void nfs_complete_unlink (struct dentry *dentry, struct inode *)
 
void nfs_block_sillyrename (struct dentry *dentry)
 
void nfs_unblock_sillyrename (struct dentry *dentry)
 
int nfs_sillyrename (struct inode *dir, struct dentry *dentry)
 
int nfs_writepage (struct page *page, struct writeback_control *wbc)
 
int nfs_writepages (struct address_space *, struct writeback_control *)
 
int nfs_flush_incompatible (struct file *file, struct page *page)
 
int nfs_updatepage (struct file *, struct page *, unsigned int, unsigned int)
 
void nfs_writeback_done (struct rpc_task *, struct nfs_write_data *)
 
int nfs_wb_all (struct inode *inode)
 
int nfs_wb_page (struct inode *inode, struct page *page)
 
int nfs_wb_page_cancel (struct inode *inode, struct page *page)
 
int nfs_readpage (struct file *, struct page *)
 
int nfs_readpages (struct file *, struct address_space *, struct list_head *, unsigned)
 
int nfs_readpage_result (struct rpc_task *, struct nfs_read_data *)
 
int nfs_readpage_async (struct nfs_open_context *, struct inode *, struct page *)
 

Variables

struct file_operations nfs_file_operations
 
struct address_space_operations nfs_file_aops
 
struct address_space_operations nfs_dir_aops
 
struct file_operations nfs_dir_operations
 
struct dentry_operations nfs_dentry_operations
 
struct inode_operations nfs_symlink_inode_operations
 
struct inode_operations nfs_mountpoint_inode_operations
 
struct inode_operations nfs_referral_inode_operations
 
int nfs_mountpoint_expiry_timeout
 
int nfs_congestion_kb
 

Macro Definition Documentation

#define ifdebug (   fac)    if (0)

Definition at line 595 of file nfs_fs.h.

#define nfs3_getxattr   NULL

Definition at line 439 of file nfs_fs.h.

#define nfs3_listxattr   NULL

Definition at line 438 of file nfs_fs.h.

#define nfs3_removexattr   NULL

Definition at line 441 of file nfs_fs.h.

#define nfs3_setxattr   NULL

Definition at line 440 of file nfs_fs.h.

#define NFS_CONTEXT_ERROR_WRITE   (0)

Definition at line 78 of file nfs_fs.h.

#define NFS_CONTEXT_RESEND_WRITES   (1)

Definition at line 79 of file nfs_fs.h.

#define NFS_IFDEBUG (   x)

Definition at line 596 of file nfs_fs.h.

#define NFS_INO_ACL_LRU_SET   (2) /* Inode is on the LRU list */

Definition at line 208 of file nfs_fs.h.

#define NFS_INO_ADVISE_RDPLUS   (0) /* advise readdirplus */

Definition at line 206 of file nfs_fs.h.

#define NFS_INO_COMMIT   (7) /* inode is committing unstable writes */

Definition at line 212 of file nfs_fs.h.

#define NFS_INO_FLUSHING   (4) /* inode is flushing out data */

Definition at line 209 of file nfs_fs.h.

#define NFS_INO_FSCACHE   (5) /* inode can be cached by FS-Cache */

Definition at line 210 of file nfs_fs.h.

#define NFS_INO_FSCACHE_LOCK   (6) /* FS-Cache cookie management lock */

Definition at line 211 of file nfs_fs.h.

#define NFS_INO_INVALID_ACCESS   0x0008 /* cached access cred invalid */

Definition at line 198 of file nfs_fs.h.

#define NFS_INO_INVALID_ACL   0x0010 /* cached acls are invalid */

Definition at line 199 of file nfs_fs.h.

#define NFS_INO_INVALID_ATIME   0x0004 /* cached atime is invalid */

Definition at line 197 of file nfs_fs.h.

#define NFS_INO_INVALID_ATTR   0x0001 /* cached attrs are invalid */

Definition at line 195 of file nfs_fs.h.

#define NFS_INO_INVALID_DATA   0x0002 /* cached data is invalid */

Definition at line 196 of file nfs_fs.h.

#define NFS_INO_LAYOUTCOMMIT   (9) /* layoutcommit required */

Definition at line 213 of file nfs_fs.h.

#define NFS_INO_LAYOUTCOMMITTING   (10) /* layoutcommit inflight */

Definition at line 214 of file nfs_fs.h.

#define NFS_INO_REVAL_FORCED   0x0040 /* force revalidation ignoring a delegation */

Definition at line 201 of file nfs_fs.h.

#define NFS_INO_REVAL_PAGECACHE   0x0020 /* must revalidate pagecache */

Definition at line 200 of file nfs_fs.h.

#define NFS_INO_STALE   (1) /* possible stale inode */

Definition at line 207 of file nfs_fs.h.

#define NFS_JUKEBOX_RETRY_TIME   (5 * HZ)

Definition at line 587 of file nfs_fs.h.

#define nfs_register_sysctl (   void)    0

Definition at line 479 of file nfs_fs.h.

#define NFS_RPC_SWAPFLAGS   (RPC_TASK_SWAPPER|RPC_TASK_ROOTCREDS)

Definition at line 44 of file nfs_fs.h.

#define nfs_unregister_sysctl (   void)    do { } while(0)

Definition at line 480 of file nfs_fs.h.

Function Documentation

int __nfs_revalidate_inode ( struct nfs_server ,
struct inode  
)

Definition at line 780 of file inode.c.

struct nfs_open_context* alloc_nfs_open_context ( struct dentry dentry,
fmode_t  f_mode 
)
read

Definition at line 636 of file inode.c.

struct nfs_open_context* get_nfs_open_context ( struct nfs_open_context ctx)
read

Definition at line 663 of file inode.c.

void nfs_access_add_cache ( struct inode ,
struct nfs_access_entry  
)

Definition at line 2076 of file dir.c.

void nfs_access_set_mask ( struct nfs_access_entry ,
u32   
)

Definition at line 2104 of file dir.c.

void nfs_access_zap_cache ( struct inode inode)

Definition at line 1971 of file dir.c.

struct nfs_fattr* nfs_alloc_fattr ( void  )
read

Definition at line 1054 of file inode.c.

struct nfs_fh* nfs_alloc_fhandle ( void  )
read

Definition at line 1065 of file inode.c.

int nfs_attribute_timeout ( struct inode inode)

Definition at line 833 of file inode.c.

void nfs_block_sillyrename ( struct dentry dentry)

Definition at line 207 of file unlink.c.

u64 nfs_compat_user_ino64 ( u64  fileid)

nfs_compat_user_ino64 - returns the user-visible inode number : 64-bit fileid

This function returns a 32-bit inode number if the boot parameter nfs.enable_ino64 is zero.

Definition at line 94 of file inode.c.

void nfs_complete_unlink ( struct dentry dentry,
struct inode inode 
)

nfs_complete_unlink - Initialize completion of the sillydelete : dentry to delete : inode

Since we're most likely to be called by dentry_iput(), we only use the dentry to find the sillydelete. We then copy the name into the qstr.

Definition at line 293 of file unlink.c.

ssize_t nfs_direct_IO ( int  rw,
struct kiocb iocb,
const struct iovec iov,
loff_t  pos,
unsigned long  nr_segs 
)

nfs_direct_IO - NFS address space operation for direct I/O : direction (read or write) : target I/O control block : array of vectors that define I/O buffer : offset in file to begin the operation : size of iovec array

The presence of this routine in the address space ops vector means the NFS client supports direct I/O. However, for most direct IO, we shunt off direct read and write requests before the VFS gets them, so this method is only ever called for swap.

Definition at line 124 of file direct.c.

void nfs_fattr_init ( struct nfs_fattr fattr)

Definition at line 1044 of file inode.c.

struct inode* nfs_fhget ( struct super_block ,
struct nfs_fh ,
struct nfs_fattr  
)
read

Definition at line 254 of file inode.c.

ssize_t nfs_file_direct_read ( struct kiocb iocb,
const struct iovec iov,
unsigned long  nr_segs,
loff_t  pos,
bool  uio 
)

nfs_file_direct_read - file direct read operation for NFS files : target I/O control block : vector of user buffers into which to read data : size of iov vector : byte offset in file where reading starts

We use this function for direct reads instead of calling generic_file_aio_read() in order to avoid gfar's check to see if the request starts before the end of the file. For that check to work, we must generate a GETATTR before each direct read, and even then there is a window between the GETATTR and the subsequent READ where the file size could change. Our preference is simply to do all reads the application wants, and the server will take care of managing the end of file boundary.

This function also eliminates unnecessarily updating the file's atime locally, as the NFS server sets the file's atime, and this client must read the updated atime from the server back into its cache.

Definition at line 915 of file direct.c.

ssize_t nfs_file_direct_write ( struct kiocb iocb,
const struct iovec iov,
unsigned long  nr_segs,
loff_t  pos,
bool  uio 
)

nfs_file_direct_write - file direct write operation for NFS files : target I/O control block : vector of user buffers from which to write data : size of iov vector : byte offset in file where writing starts

We use this function for direct writes instead of calling generic_file_aio_write() in order to avoid taking the inode semaphore and updating the i_size. The NFS server will set the new i_size and this client must read the updated size back into its cache. We let the server do generic write parameter checking and report problems.

We eliminate local atime updates, see direct read above.

We avoid unnecessary page cache invalidations for normal cached readers of this file.

Note that O_APPEND is not supported for NFS direct writes, as there is no atomic O_APPEND write facility in the NFS protocol.

Definition at line 971 of file direct.c.

void nfs_file_set_open_context ( struct file filp,
struct nfs_open_context ctx 
)

Definition at line 706 of file inode.c.

struct nfs_open_context* nfs_find_open_context ( struct inode inode,
struct rpc_cred *  cred,
fmode_t  mode 
)
read

Definition at line 721 of file inode.c.

int nfs_flush_incompatible ( struct file file,
struct page page 
)

Definition at line 846 of file write.c.

void nfs_force_lookup_revalidate ( struct inode dir)

Definition at line 936 of file dir.c.

struct nfs_lock_context* nfs_get_lock_context ( struct nfs_open_context ctx)
read

Definition at line 570 of file inode.c.

int nfs_getattr ( struct vfsmount ,
struct dentry ,
struct kstat  
)

Definition at line 507 of file inode.c.

unsigned long nfs_inc_attr_generation_counter ( void  )

Definition at line 1039 of file inode.c.

int nfs_instantiate ( struct dentry dentry,
struct nfs_fh fh,
struct nfs_fattr fattr 
)

Definition at line 1480 of file dir.c.

void nfs_invalidate_atime ( struct inode )

Definition at line 193 of file inode.c.

int nfs_may_open ( struct inode inode,
struct rpc_cred *  cred,
int  openflags 
)

Definition at line 2159 of file dir.c.

int nfs_open ( struct inode ,
struct file  
)

Definition at line 756 of file inode.c.

int nfs_permission ( struct inode ,
int   
)

Definition at line 2165 of file dir.c.

int nfs_post_op_update_inode ( struct inode inode,
struct nfs_fattr fattr 
)

nfs_post_op_update_inode - try to update the inode attribute cache - pointer to inode - updated attributes

After an operation that has changed the inode metadata, mark the attribute cache as being invalid, then try to update it.

NB: if the server didn't return any post op attributes, this function will force the retrieval of attributes before the next NFS request. Thus it should be used only for operations that are expected to change one or more attributes, to avoid unnecessary NFS requests and trips through nfs_update_inode().

Definition at line 1223 of file inode.c.

int nfs_post_op_update_inode_force_wcc ( struct inode inode,
struct nfs_fattr fattr 
)

nfs_post_op_update_inode_force_wcc - try to update the inode attribute cache - pointer to inode - updated attributes

After an operation that has changed the inode metadata, mark the attribute cache as being invalid, then try to update it. Fake up weak cache consistency data, if none exist.

This function is mainly designed to be used by the ->write_done() functions.

Definition at line 1245 of file inode.c.

void nfs_put_lock_context ( struct nfs_lock_context l_ctx)

Definition at line 597 of file inode.c.

int nfs_readpage ( struct file ,
struct page  
)

Definition at line 527 of file read.c.

int nfs_readpage_async ( struct nfs_open_context ,
struct inode ,
struct page  
)

Definition at line 128 of file read.c.

int nfs_readpage_result ( struct rpc_task ,
struct nfs_read_data  
)

Definition at line 438 of file read.c.

int nfs_readpages ( struct file ,
struct address_space ,
struct list_head ,
unsigned   
)

Definition at line 615 of file read.c.

int nfs_refresh_inode ( struct inode inode,
struct nfs_fattr fattr 
)

nfs_refresh_inode - try to update the inode attribute cache - pointer to inode - updated attributes

Check that an RPC call that returned attributes has not overlapped with other recent updates of the inode metadata, then decide whether it is safe to do a full update of the inode attributes, or whether just to call nfs_check_inode_attributes.

Definition at line 1183 of file inode.c.

int nfs_release ( struct inode ,
struct file  
)

Definition at line 769 of file inode.c.

void nfs_release_automount_timer ( void  )

Definition at line 196 of file namespace.c.

int nfs_revalidate_inode ( struct nfs_server server,
struct inode inode 
)

nfs_revalidate_inode - Revalidate the inode attributes - pointer to nfs_server struct - pointer to inode struct

Updates inode attribute information by retrieving the data from the server.

Definition at line 854 of file inode.c.

int nfs_revalidate_mapping ( struct inode inode,
struct address_space mapping 
)

nfs_revalidate_mapping - Revalidate the pagecache - pointer to host inode - pointer to mapping

Definition at line 898 of file inode.c.

int nfs_root_data ( char **  root_device,
char **  root_data 
)

nfs_root_data - Return prepared 'data' for NFSROOT mount : OUT: address of string containing NFSROOT device : OUT: address of string containing NFSROOT mount options

Returns zero and sets and if successful, otherwise -1 is returned.

Definition at line 295 of file nfsroot.c.

int nfs_setattr ( struct dentry ,
struct iattr  
)

Definition at line 403 of file inode.c.

void nfs_setattr_update_inode ( struct inode inode,
struct iattr attr 
)

nfs_setattr_update_inode - Update inode metadata after a setattr call. : pointer to struct inode : pointer to struct iattr

Note: we do this in the *proc.c in order to ensure that it works for things like exclusive creates too.

Definition at line 484 of file inode.c.

int nfs_sillyrename ( struct inode dir,
struct dentry dentry 
)

Definition at line 476 of file unlink.c.

int nfs_sync_mapping ( struct address_space mapping)

nfs_sync_mapping - helper to flush all mmapped dirty data to disk

Definition at line 133 of file inode.c.

void nfs_unblock_sillyrename ( struct dentry dentry)

Definition at line 214 of file unlink.c.

int nfs_updatepage ( struct file ,
struct page ,
unsigned  int,
unsigned  int 
)

Definition at line 899 of file write.c.

int nfs_wb_all ( struct inode inode)

Definition at line 1712 of file write.c.

int nfs_wb_page ( struct inode inode,
struct page page 
)

Definition at line 1758 of file write.c.

int nfs_wb_page_cancel ( struct inode inode,
struct page page 
)

Definition at line 1725 of file write.c.

void nfs_writeback_done ( struct rpc_task ,
struct nfs_write_data  
)

Definition at line 1308 of file write.c.

int nfs_writepage ( struct page page,
struct writeback_control wbc 
)

Definition at line 368 of file write.c.

int nfs_writepages ( struct address_space ,
struct writeback_control  
)

Definition at line 386 of file write.c.

void nfs_zap_caches ( struct inode )

Definition at line 164 of file inode.c.

void nfs_zap_mapping ( struct inode inode,
struct address_space mapping 
)

Definition at line 171 of file inode.c.

void put_nfs_open_context ( struct nfs_open_context ctx)

Definition at line 696 of file inode.c.

__be32 root_nfs_parse_addr ( char name)

Definition at line 1324 of file ipconfig.c.

Variable Documentation

int nfs_congestion_kb

Definition at line 236 of file write.c.

struct dentry_operations nfs_dentry_operations

Definition at line 1195 of file dir.c.

Definition at line 63 of file dir.c.

struct file_operations nfs_dir_operations

Definition at line 54 of file dir.c.

Definition at line 530 of file file.c.

struct file_operations nfs_file_operations

Definition at line 911 of file file.c.

int nfs_mountpoint_expiry_timeout

Definition at line 28 of file namespace.c.

struct inode_operations nfs_mountpoint_inode_operations

Definition at line 180 of file namespace.c.

struct inode_operations nfs_referral_inode_operations

Definition at line 184 of file namespace.c.

struct inode_operations nfs_symlink_inode_operations

Definition at line 72 of file symlink.c.