aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux/nfs_fs.h
diff options
context:
space:
mode:
authorBenny Halevy <bhalevy@panasas.com>2008-01-23 01:59:08 -0500
committerTrond Myklebust <Trond.Myklebust@netapp.com>2008-01-30 02:06:11 -0500
commit99fadcd76465842c014c88b8c9c19b457e9debc0 (patch)
tree34b61c6444beacc58bc643285441a553af420dc4 /include/linux/nfs_fs.h
parent3a10c30acc4821ca000b52ed0edafd0d3bf26a52 (diff)
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>
Diffstat (limited to 'include/linux/nfs_fs.h')
-rw-r--r--include/linux/nfs_fs.h76
1 files changed, 58 insertions, 18 deletions
diff --git a/include/linux/nfs_fs.h b/include/linux/nfs_fs.h
index 9e7c24a2aca9..099ddb4481c0 100644
--- a/include/linux/nfs_fs.h
+++ b/include/linux/nfs_fs.h
@@ -196,27 +196,67 @@ struct nfs_inode {
196#define NFS_INO_STALE (2) /* possible stale inode */ 196#define NFS_INO_STALE (2) /* possible stale inode */
197#define NFS_INO_ACL_LRU_SET (3) /* Inode is on the LRU list */ 197#define NFS_INO_ACL_LRU_SET (3) /* Inode is on the LRU list */
198 198
199static inline struct nfs_inode *NFS_I(struct inode *inode) 199static inline struct nfs_inode *NFS_I(const struct inode *inode)
200{ 200{
201 return container_of(inode, struct nfs_inode, vfs_inode); 201 return container_of(inode, struct nfs_inode, vfs_inode);
202} 202}
203#define NFS_SB(s) ((struct nfs_server *)(s->s_fs_info)) 203
204 204static inline struct nfs_server *NFS_SB(const struct super_block *s)
205#define NFS_FH(inode) (&NFS_I(inode)->fh) 205{
206#define NFS_SERVER(inode) (NFS_SB(inode->i_sb)) 206 return (struct nfs_server *)(s->s_fs_info);
207#define NFS_CLIENT(inode) (NFS_SERVER(inode)->client) 207}
208#define NFS_PROTO(inode) (NFS_SERVER(inode)->nfs_client->rpc_ops) 208
209#define NFS_COOKIEVERF(inode) (NFS_I(inode)->cookieverf) 209static inline struct nfs_fh *NFS_FH(const struct inode *inode)
210#define NFS_MINATTRTIMEO(inode) \ 210{
211 (S_ISDIR(inode->i_mode)? NFS_SERVER(inode)->acdirmin \ 211 return &NFS_I(inode)->fh;
212 : NFS_SERVER(inode)->acregmin) 212}
213#define NFS_MAXATTRTIMEO(inode) \ 213
214 (S_ISDIR(inode->i_mode)? NFS_SERVER(inode)->acdirmax \ 214static inline struct nfs_server *NFS_SERVER(const struct inode *inode)
215 : NFS_SERVER(inode)->acregmax) 215{
216 216 return NFS_SB(inode->i_sb);
217#define NFS_STALE(inode) (test_bit(NFS_INO_STALE, &NFS_I(inode)->flags)) 217}
218 218
219#define NFS_FILEID(inode) (NFS_I(inode)->fileid) 219static inline struct rpc_clnt *NFS_CLIENT(const struct inode *inode)
220{
221 return NFS_SERVER(inode)->client;
222}
223
224static inline const struct nfs_rpc_ops *NFS_PROTO(const struct inode *inode)
225{
226 return NFS_SERVER(inode)->nfs_client->rpc_ops;
227}
228
229static inline __be32 *NFS_COOKIEVERF(const struct inode *inode)
230{
231 return NFS_I(inode)->cookieverf;
232}
233
234static inline unsigned NFS_MINATTRTIMEO(const struct inode *inode)
235{
236 struct nfs_server *nfss = NFS_SERVER(inode);
237 return S_ISDIR(inode->i_mode) ? nfss->acdirmin : nfss->acregmin;
238}
239
240static inline unsigned NFS_MAXATTRTIMEO(const struct inode *inode)
241{
242 struct nfs_server *nfss = NFS_SERVER(inode);
243 return S_ISDIR(inode->i_mode) ? nfss->acdirmax : nfss->acregmax;
244}
245
246static inline int NFS_STALE(const struct inode *inode)
247{
248 return test_bit(NFS_INO_STALE, &NFS_I(inode)->flags);
249}
250
251static inline __u64 NFS_FILEID(const struct inode *inode)
252{
253 return NFS_I(inode)->fileid;
254}
255
256static inline void set_nfs_fileid(struct inode *inode, __u64 fileid)
257{
258 NFS_I(inode)->fileid = fileid;
259}
220 260
221static inline void nfs_mark_for_revalidate(struct inode *inode) 261static inline void nfs_mark_for_revalidate(struct inode *inode)
222{ 262{