diff options
Diffstat (limited to 'include/linux/nfs_fs.h')
-rw-r--r-- | include/linux/nfs_fs.h | 74 |
1 files changed, 57 insertions, 17 deletions
diff --git a/include/linux/nfs_fs.h b/include/linux/nfs_fs.h index 2d15d4aac094..099ddb4481c0 100644 --- a/include/linux/nfs_fs.h +++ b/include/linux/nfs_fs.h | |||
@@ -196,28 +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 | ||
199 | static inline struct nfs_inode *NFS_I(struct inode *inode) | 199 | static 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)) | ||
204 | 203 | ||
205 | #define NFS_FH(inode) (&NFS_I(inode)->fh) | 204 | static inline struct nfs_server *NFS_SB(const struct super_block *s) |
206 | #define NFS_SERVER(inode) (NFS_SB(inode->i_sb)) | 205 | { |
207 | #define NFS_CLIENT(inode) (NFS_SERVER(inode)->client) | 206 | return (struct nfs_server *)(s->s_fs_info); |
208 | #define NFS_PROTO(inode) (NFS_SERVER(inode)->nfs_client->rpc_ops) | 207 | } |
209 | #define NFS_COOKIEVERF(inode) (NFS_I(inode)->cookieverf) | 208 | |
210 | #define NFS_MINATTRTIMEO(inode) \ | 209 | static inline struct nfs_fh *NFS_FH(const struct inode *inode) |
211 | (S_ISDIR(inode->i_mode)? NFS_SERVER(inode)->acdirmin \ | 210 | { |
212 | : NFS_SERVER(inode)->acregmin) | 211 | return &NFS_I(inode)->fh; |
213 | #define NFS_MAXATTRTIMEO(inode) \ | 212 | } |
214 | (S_ISDIR(inode->i_mode)? NFS_SERVER(inode)->acdirmax \ | 213 | |
215 | : NFS_SERVER(inode)->acregmax) | 214 | static inline struct nfs_server *NFS_SERVER(const struct inode *inode) |
215 | { | ||
216 | return NFS_SB(inode->i_sb); | ||
217 | } | ||
218 | |||
219 | static inline struct rpc_clnt *NFS_CLIENT(const struct inode *inode) | ||
220 | { | ||
221 | return NFS_SERVER(inode)->client; | ||
222 | } | ||
223 | |||
224 | static inline const struct nfs_rpc_ops *NFS_PROTO(const struct inode *inode) | ||
225 | { | ||
226 | return NFS_SERVER(inode)->nfs_client->rpc_ops; | ||
227 | } | ||
228 | |||
229 | static inline __be32 *NFS_COOKIEVERF(const struct inode *inode) | ||
230 | { | ||
231 | return NFS_I(inode)->cookieverf; | ||
232 | } | ||
233 | |||
234 | static 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 | } | ||
216 | 239 | ||
217 | #define NFS_FLAGS(inode) (NFS_I(inode)->flags) | 240 | static inline unsigned NFS_MAXATTRTIMEO(const struct inode *inode) |
218 | #define NFS_STALE(inode) (test_bit(NFS_INO_STALE, &NFS_FLAGS(inode))) | 241 | { |
242 | struct nfs_server *nfss = NFS_SERVER(inode); | ||
243 | return S_ISDIR(inode->i_mode) ? nfss->acdirmax : nfss->acregmax; | ||
244 | } | ||
219 | 245 | ||
220 | #define NFS_FILEID(inode) (NFS_I(inode)->fileid) | 246 | static inline int NFS_STALE(const struct inode *inode) |
247 | { | ||
248 | return test_bit(NFS_INO_STALE, &NFS_I(inode)->flags); | ||
249 | } | ||
250 | |||
251 | static inline __u64 NFS_FILEID(const struct inode *inode) | ||
252 | { | ||
253 | return NFS_I(inode)->fileid; | ||
254 | } | ||
255 | |||
256 | static inline void set_nfs_fileid(struct inode *inode, __u64 fileid) | ||
257 | { | ||
258 | NFS_I(inode)->fileid = fileid; | ||
259 | } | ||
221 | 260 | ||
222 | static inline void nfs_mark_for_revalidate(struct inode *inode) | 261 | static inline void nfs_mark_for_revalidate(struct inode *inode) |
223 | { | 262 | { |
@@ -237,7 +276,7 @@ static inline int nfs_server_capable(struct inode *inode, int cap) | |||
237 | 276 | ||
238 | static inline int NFS_USE_READDIRPLUS(struct inode *inode) | 277 | static inline int NFS_USE_READDIRPLUS(struct inode *inode) |
239 | { | 278 | { |
240 | return test_bit(NFS_INO_ADVISE_RDPLUS, &NFS_FLAGS(inode)); | 279 | return test_bit(NFS_INO_ADVISE_RDPLUS, &NFS_I(inode)->flags); |
241 | } | 280 | } |
242 | 281 | ||
243 | static inline void nfs_set_verifier(struct dentry * dentry, unsigned long verf) | 282 | static inline void nfs_set_verifier(struct dentry * dentry, unsigned long verf) |
@@ -366,6 +405,7 @@ extern const struct inode_operations nfs3_dir_inode_operations; | |||
366 | extern const struct file_operations nfs_dir_operations; | 405 | extern const struct file_operations nfs_dir_operations; |
367 | extern struct dentry_operations nfs_dentry_operations; | 406 | extern struct dentry_operations nfs_dentry_operations; |
368 | 407 | ||
408 | extern void nfs_force_lookup_revalidate(struct inode *dir); | ||
369 | extern int nfs_instantiate(struct dentry *dentry, struct nfs_fh *fh, struct nfs_fattr *fattr); | 409 | extern int nfs_instantiate(struct dentry *dentry, struct nfs_fh *fh, struct nfs_fattr *fattr); |
370 | extern int nfs_may_open(struct inode *inode, struct rpc_cred *cred, int openflags); | 410 | extern int nfs_may_open(struct inode *inode, struct rpc_cred *cred, int openflags); |
371 | extern void nfs_access_zap_cache(struct inode *inode); | 411 | extern void nfs_access_zap_cache(struct inode *inode); |