/* * linux/fs/nfs/inode.c * * Copyright (C) 1992 Rick Sladkey * * nfs inode and superblock handling functions * * Modularised by Alan Cox <Alan.Cox@linux.org>, while hacking some * experimental NFS changes. Modularisation taken straight from SYS5 fs. * * Change to nfs_read_super() to permit NFS mounts to multi-homed hosts. * J.S.Peatfield@damtp.cam.ac.uk * */#include<linux/module.h>#include<linux/init.h>#include<linux/sched.h>#include<linux/time.h>#include<linux/kernel.h>#include<linux/mm.h>#include<linux/string.h>#include<linux/stat.h>#include<linux/errno.h>#include<linux/unistd.h>#include<linux/sunrpc/clnt.h>#include<linux/sunrpc/stats.h>#include<linux/sunrpc/metrics.h>#include<linux/nfs_fs.h>#include<linux/nfs_mount.h>#include<linux/nfs4_mount.h>#include<linux/lockd/bind.h>#include<linux/smp_lock.h>#include<linux/seq_file.h>#include<linux/mount.h>#include<linux/nfs_idmap.h>#include<linux/vfs.h>#include<linux/inet.h>#include<linux/nfs_xdr.h>#include<asm/system.h>#include<asm/uaccess.h>#include"nfs4_fs.h"#include"callback.h"#include"delegation.h"#include"iostat.h"#include"internal.h"#define NFSDBG_FACILITY NFSDBG_VFS#define NFS_64_BIT_INODE_NUMBERS_ENABLED 1/* Default is to see 64-bit inode numbers */staticintenable_ino64=NFS_64_BIT_INODE_NUMBERS_ENABLED;staticvoidnfs_invalidate_inode(structinode*);staticintnfs_update_inode(structinode*,structnfs_fattr*);staticvoidnfs_zap_acl_cache(structinode*);staticstructkmem_cache*nfs_inode_cachep;staticinlineunsignedlongnfs_fattr_to_ino_t(structnfs_fattr*fattr){returnnfs_fileid_to_ino_t(fattr->fileid);}/** * nfs_compat_user_ino64 - returns the user-visible inode number * @fileid: 64-bit fileid * * This function returns a 32-bit inode number if the boot parameter * nfs.enable_ino64 is zero. */u64nfs_compat_user_ino64(u64fileid){intino;if(enable_ino64)returnfileid;ino=fileid;if(sizeof(ino)<sizeof(fileid))ino^=fileid>>(sizeof(fileid)-sizeof(ino))*8;returnino;}intnfs_write_inode(structinode*inode,intsync){intret;if(sync){ret=filemap_fdatawait(inode->i_mapping);if(ret==0)ret=nfs_commit_inode(inode,FLUSH_SYNC);}elseret=nfs_commit_inode(inode,0);if(ret>=0)return0;__mark_inode_dirty(inode,I_DIRTY_DATASYNC);returnret;}voidnfs_clear_inode(structinode*inode){/* * The following should never happen... */BUG_ON(nfs_have_writebacks(inode));BUG_ON(!list_empty(&NFS_I(inode)->open_files));nfs_zap_acl_cache(inode);nfs_access_zap_cache(inode);}/** * nfs_sync_mapping - helper to flush all mmapped dirty data to disk */int