nfs: convert NFS_*(inode) helpers to static inline

Signed-off-by: Benny Halevy <bhalevy@panasas.com>
Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
This commit is contained in:
Benny Halevy 2008-01-23 08:59:08 +02:00 committed by Trond Myklebust
parent 3a10c30acc
commit 99fadcd764
2 changed files with 56 additions and 16 deletions

View File

@ -229,7 +229,7 @@ nfs_init_locked(struct inode *inode, void *opaque)
struct nfs_find_desc *desc = (struct nfs_find_desc *)opaque;
struct nfs_fattr *fattr = desc->fattr;
NFS_FILEID(inode) = fattr->fileid;
set_nfs_fileid(inode, fattr->fileid);
nfs_copy_fh(NFS_FH(inode), desc->fh);
return 0;
}

View File

@ -196,27 +196,67 @@ struct nfs_inode {
#define NFS_INO_STALE (2) /* possible stale inode */
#define NFS_INO_ACL_LRU_SET (3) /* Inode is on the LRU list */
static inline struct nfs_inode *NFS_I(struct inode *inode)
static inline struct nfs_inode *NFS_I(const struct inode *inode)
{
return container_of(inode, struct nfs_inode, vfs_inode);
}
#define NFS_SB(s) ((struct nfs_server *)(s->s_fs_info))
#define NFS_FH(inode) (&NFS_I(inode)->fh)
#define NFS_SERVER(inode) (NFS_SB(inode->i_sb))
#define NFS_CLIENT(inode) (NFS_SERVER(inode)->client)
#define NFS_PROTO(inode) (NFS_SERVER(inode)->nfs_client->rpc_ops)
#define NFS_COOKIEVERF(inode) (NFS_I(inode)->cookieverf)
#define NFS_MINATTRTIMEO(inode) \
(S_ISDIR(inode->i_mode)? NFS_SERVER(inode)->acdirmin \
: NFS_SERVER(inode)->acregmin)
#define NFS_MAXATTRTIMEO(inode) \
(S_ISDIR(inode->i_mode)? NFS_SERVER(inode)->acdirmax \
: NFS_SERVER(inode)->acregmax)
static inline struct nfs_server *NFS_SB(const struct super_block *s)
{
return (struct nfs_server *)(s->s_fs_info);
}
#define NFS_STALE(inode) (test_bit(NFS_INO_STALE, &NFS_I(inode)->flags))
static inline struct nfs_fh *NFS_FH(const struct inode *inode)
{
return &NFS_I(inode)->fh;
}
#define NFS_FILEID(inode) (NFS_I(inode)->fileid)
static inline struct nfs_server *NFS_SERVER(const struct inode *inode)
{
return NFS_SB(inode->i_sb);
}
static inline struct rpc_clnt *NFS_CLIENT(const struct inode *inode)
{
return NFS_SERVER(inode)->client;
}
static inline const struct nfs_rpc_ops *NFS_PROTO(const struct inode *inode)
{
return NFS_SERVER(inode)->nfs_client->rpc_ops;
}
static inline __be32 *NFS_COOKIEVERF(const struct inode *inode)
{
return NFS_I(inode)->cookieverf;
}
static inline unsigned NFS_MINATTRTIMEO(const struct inode *inode)
{
struct nfs_server *nfss = NFS_SERVER(inode);
return S_ISDIR(inode->i_mode) ? nfss->acdirmin : nfss->acregmin;
}
static inline unsigned NFS_MAXATTRTIMEO(const struct inode *inode)
{
struct nfs_server *nfss = NFS_SERVER(inode);
return S_ISDIR(inode->i_mode) ? nfss->acdirmax : nfss->acregmax;
}
static inline int NFS_STALE(const struct inode *inode)
{
return test_bit(NFS_INO_STALE, &NFS_I(inode)->flags);
}
static inline __u64 NFS_FILEID(const struct inode *inode)
{
return NFS_I(inode)->fileid;
}
static inline void set_nfs_fileid(struct inode *inode, __u64 fileid)
{
NFS_I(inode)->fileid = fileid;
}
static inline void nfs_mark_for_revalidate(struct inode *inode)
{