diff options
Diffstat (limited to 'include/linux/nfs_fs.h')
-rw-r--r-- | include/linux/nfs_fs.h | 78 |
1 files changed, 31 insertions, 47 deletions
diff --git a/include/linux/nfs_fs.h b/include/linux/nfs_fs.h index 7250eeadd7b5..c5164c257f71 100644 --- a/include/linux/nfs_fs.h +++ b/include/linux/nfs_fs.h | |||
@@ -47,10 +47,8 @@ | |||
47 | #include <linux/nfs3.h> | 47 | #include <linux/nfs3.h> |
48 | #include <linux/nfs4.h> | 48 | #include <linux/nfs4.h> |
49 | #include <linux/nfs_xdr.h> | 49 | #include <linux/nfs_xdr.h> |
50 | |||
51 | #include <linux/nfs_fs_sb.h> | 50 | #include <linux/nfs_fs_sb.h> |
52 | 51 | ||
53 | #include <linux/rwsem.h> | ||
54 | #include <linux/mempool.h> | 52 | #include <linux/mempool.h> |
55 | 53 | ||
56 | /* | 54 | /* |
@@ -77,6 +75,9 @@ struct nfs_open_context { | |||
77 | struct nfs4_state *state; | 75 | struct nfs4_state *state; |
78 | fl_owner_t lockowner; | 76 | fl_owner_t lockowner; |
79 | int mode; | 77 | int mode; |
78 | |||
79 | unsigned long flags; | ||
80 | #define NFS_CONTEXT_ERROR_WRITE (0) | ||
80 | int error; | 81 | int error; |
81 | 82 | ||
82 | struct list_head list; | 83 | struct list_head list; |
@@ -133,11 +134,6 @@ struct nfs_inode { | |||
133 | * server. | 134 | * server. |
134 | */ | 135 | */ |
135 | unsigned long cache_change_attribute; | 136 | unsigned long cache_change_attribute; |
136 | /* | ||
137 | * Counter indicating the number of outstanding requests that | ||
138 | * will cause a file data update. | ||
139 | */ | ||
140 | atomic_t data_updates; | ||
141 | 137 | ||
142 | struct rb_root access_cache; | 138 | struct rb_root access_cache; |
143 | struct list_head access_cache_entry_lru; | 139 | struct list_head access_cache_entry_lru; |
@@ -205,27 +201,18 @@ static inline struct nfs_inode *NFS_I(struct inode *inode) | |||
205 | #define NFS_CLIENT(inode) (NFS_SERVER(inode)->client) | 201 | #define NFS_CLIENT(inode) (NFS_SERVER(inode)->client) |
206 | #define NFS_PROTO(inode) (NFS_SERVER(inode)->nfs_client->rpc_ops) | 202 | #define NFS_PROTO(inode) (NFS_SERVER(inode)->nfs_client->rpc_ops) |
207 | #define NFS_COOKIEVERF(inode) (NFS_I(inode)->cookieverf) | 203 | #define NFS_COOKIEVERF(inode) (NFS_I(inode)->cookieverf) |
208 | #define NFS_READTIME(inode) (NFS_I(inode)->read_cache_jiffies) | ||
209 | #define NFS_CHANGE_ATTR(inode) (NFS_I(inode)->change_attr) | ||
210 | #define NFS_ATTRTIMEO(inode) (NFS_I(inode)->attrtimeo) | ||
211 | #define NFS_MINATTRTIMEO(inode) \ | 204 | #define NFS_MINATTRTIMEO(inode) \ |
212 | (S_ISDIR(inode->i_mode)? NFS_SERVER(inode)->acdirmin \ | 205 | (S_ISDIR(inode->i_mode)? NFS_SERVER(inode)->acdirmin \ |
213 | : NFS_SERVER(inode)->acregmin) | 206 | : NFS_SERVER(inode)->acregmin) |
214 | #define NFS_MAXATTRTIMEO(inode) \ | 207 | #define NFS_MAXATTRTIMEO(inode) \ |
215 | (S_ISDIR(inode->i_mode)? NFS_SERVER(inode)->acdirmax \ | 208 | (S_ISDIR(inode->i_mode)? NFS_SERVER(inode)->acdirmax \ |
216 | : NFS_SERVER(inode)->acregmax) | 209 | : NFS_SERVER(inode)->acregmax) |
217 | #define NFS_ATTRTIMEO_UPDATE(inode) (NFS_I(inode)->attrtimeo_timestamp) | ||
218 | 210 | ||
219 | #define NFS_FLAGS(inode) (NFS_I(inode)->flags) | 211 | #define NFS_FLAGS(inode) (NFS_I(inode)->flags) |
220 | #define NFS_STALE(inode) (test_bit(NFS_INO_STALE, &NFS_FLAGS(inode))) | 212 | #define NFS_STALE(inode) (test_bit(NFS_INO_STALE, &NFS_FLAGS(inode))) |
221 | 213 | ||
222 | #define NFS_FILEID(inode) (NFS_I(inode)->fileid) | 214 | #define NFS_FILEID(inode) (NFS_I(inode)->fileid) |
223 | 215 | ||
224 | static inline int nfs_caches_unstable(struct inode *inode) | ||
225 | { | ||
226 | return atomic_read(&NFS_I(inode)->data_updates) != 0; | ||
227 | } | ||
228 | |||
229 | static inline void nfs_mark_for_revalidate(struct inode *inode) | 216 | static inline void nfs_mark_for_revalidate(struct inode *inode) |
230 | { | 217 | { |
231 | struct nfs_inode *nfsi = NFS_I(inode); | 218 | struct nfs_inode *nfsi = NFS_I(inode); |
@@ -237,12 +224,6 @@ static inline void nfs_mark_for_revalidate(struct inode *inode) | |||
237 | spin_unlock(&inode->i_lock); | 224 | spin_unlock(&inode->i_lock); |
238 | } | 225 | } |
239 | 226 | ||
240 | static inline void NFS_CACHEINV(struct inode *inode) | ||
241 | { | ||
242 | if (!nfs_caches_unstable(inode)) | ||
243 | nfs_mark_for_revalidate(inode); | ||
244 | } | ||
245 | |||
246 | static inline int nfs_server_capable(struct inode *inode, int cap) | 227 | static inline int nfs_server_capable(struct inode *inode, int cap) |
247 | { | 228 | { |
248 | return NFS_SERVER(inode)->caps & cap; | 229 | return NFS_SERVER(inode)->caps & cap; |
@@ -253,28 +234,33 @@ static inline int NFS_USE_READDIRPLUS(struct inode *inode) | |||
253 | return test_bit(NFS_INO_ADVISE_RDPLUS, &NFS_FLAGS(inode)); | 234 | return test_bit(NFS_INO_ADVISE_RDPLUS, &NFS_FLAGS(inode)); |
254 | } | 235 | } |
255 | 236 | ||
237 | static inline void nfs_set_verifier(struct dentry * dentry, unsigned long verf) | ||
238 | { | ||
239 | dentry->d_time = verf; | ||
240 | } | ||
241 | |||
256 | /** | 242 | /** |
257 | * nfs_save_change_attribute - Returns the inode attribute change cookie | 243 | * nfs_save_change_attribute - Returns the inode attribute change cookie |
258 | * @inode - pointer to inode | 244 | * @dir - pointer to parent directory inode |
259 | * The "change attribute" is updated every time we finish an operation | 245 | * The "change attribute" is updated every time we finish an operation |
260 | * that will result in a metadata change on the server. | 246 | * that will result in a metadata change on the server. |
261 | */ | 247 | */ |
262 | static inline long nfs_save_change_attribute(struct inode *inode) | 248 | static inline unsigned long nfs_save_change_attribute(struct inode *dir) |
263 | { | 249 | { |
264 | return NFS_I(inode)->cache_change_attribute; | 250 | return NFS_I(dir)->cache_change_attribute; |
265 | } | 251 | } |
266 | 252 | ||
267 | /** | 253 | /** |
268 | * nfs_verify_change_attribute - Detects NFS inode cache updates | 254 | * nfs_verify_change_attribute - Detects NFS remote directory changes |
269 | * @inode - pointer to inode | 255 | * @dir - pointer to parent directory inode |
270 | * @chattr - previously saved change attribute | 256 | * @chattr - previously saved change attribute |
271 | * Return "false" if metadata has been updated (or is in the process of | 257 | * Return "false" if the verifiers doesn't match the change attribute. |
272 | * being updated) since the change attribute was saved. | 258 | * This would usually indicate that the directory contents have changed on |
259 | * the server, and that any dentries need revalidating. | ||
273 | */ | 260 | */ |
274 | static inline int nfs_verify_change_attribute(struct inode *inode, unsigned long chattr) | 261 | static inline int nfs_verify_change_attribute(struct inode *dir, unsigned long chattr) |
275 | { | 262 | { |
276 | return !nfs_caches_unstable(inode) | 263 | return chattr == NFS_I(dir)->cache_change_attribute; |
277 | && time_after_eq(chattr, NFS_I(inode)->cache_change_attribute); | ||
278 | } | 264 | } |
279 | 265 | ||
280 | /* | 266 | /* |
@@ -283,15 +269,14 @@ static inline int nfs_verify_change_attribute(struct inode *inode, unsigned long | |||
283 | extern int nfs_sync_mapping(struct address_space *mapping); | 269 | extern int nfs_sync_mapping(struct address_space *mapping); |
284 | extern void nfs_zap_mapping(struct inode *inode, struct address_space *mapping); | 270 | extern void nfs_zap_mapping(struct inode *inode, struct address_space *mapping); |
285 | extern void nfs_zap_caches(struct inode *); | 271 | extern void nfs_zap_caches(struct inode *); |
272 | extern void nfs_invalidate_atime(struct inode *); | ||
286 | extern struct inode *nfs_fhget(struct super_block *, struct nfs_fh *, | 273 | extern struct inode *nfs_fhget(struct super_block *, struct nfs_fh *, |
287 | struct nfs_fattr *); | 274 | struct nfs_fattr *); |
288 | extern int nfs_refresh_inode(struct inode *, struct nfs_fattr *); | 275 | extern int nfs_refresh_inode(struct inode *, struct nfs_fattr *); |
289 | extern int nfs_post_op_update_inode(struct inode *inode, struct nfs_fattr *fattr); | 276 | extern int nfs_post_op_update_inode(struct inode *inode, struct nfs_fattr *fattr); |
277 | extern int nfs_post_op_update_inode_force_wcc(struct inode *inode, struct nfs_fattr *fattr); | ||
290 | extern int nfs_getattr(struct vfsmount *, struct dentry *, struct kstat *); | 278 | extern int nfs_getattr(struct vfsmount *, struct dentry *, struct kstat *); |
291 | extern int nfs_permission(struct inode *, int, struct nameidata *); | 279 | extern int nfs_permission(struct inode *, int, struct nameidata *); |
292 | extern int nfs_access_get_cached(struct inode *, struct rpc_cred *, struct nfs_access_entry *); | ||
293 | extern void nfs_access_add_cache(struct inode *, struct nfs_access_entry *); | ||
294 | extern void nfs_access_zap_cache(struct inode *inode); | ||
295 | extern int nfs_open(struct inode *, struct file *); | 280 | extern int nfs_open(struct inode *, struct file *); |
296 | extern int nfs_release(struct inode *, struct file *); | 281 | extern int nfs_release(struct inode *, struct file *); |
297 | extern int nfs_attribute_timeout(struct inode *inode); | 282 | extern int nfs_attribute_timeout(struct inode *inode); |
@@ -301,13 +286,10 @@ extern int nfs_revalidate_mapping(struct inode *inode, struct address_space *map | |||
301 | extern int nfs_revalidate_mapping_nolock(struct inode *inode, struct address_space *mapping); | 286 | extern int nfs_revalidate_mapping_nolock(struct inode *inode, struct address_space *mapping); |
302 | extern int nfs_setattr(struct dentry *, struct iattr *); | 287 | extern int nfs_setattr(struct dentry *, struct iattr *); |
303 | extern void nfs_setattr_update_inode(struct inode *inode, struct iattr *attr); | 288 | extern void nfs_setattr_update_inode(struct inode *inode, struct iattr *attr); |
304 | extern void nfs_begin_attr_update(struct inode *); | ||
305 | extern void nfs_end_attr_update(struct inode *); | ||
306 | extern void nfs_begin_data_update(struct inode *); | ||
307 | extern void nfs_end_data_update(struct inode *); | ||
308 | extern struct nfs_open_context *get_nfs_open_context(struct nfs_open_context *ctx); | 289 | extern struct nfs_open_context *get_nfs_open_context(struct nfs_open_context *ctx); |
309 | extern void put_nfs_open_context(struct nfs_open_context *ctx); | 290 | extern void put_nfs_open_context(struct nfs_open_context *ctx); |
310 | extern struct nfs_open_context *nfs_find_open_context(struct inode *inode, struct rpc_cred *cred, int mode); | 291 | extern struct nfs_open_context *nfs_find_open_context(struct inode *inode, struct rpc_cred *cred, int mode); |
292 | extern u64 nfs_compat_user_ino64(u64 fileid); | ||
311 | 293 | ||
312 | /* linux/net/ipv4/ipconfig.c: trims ip addr off front of name, too. */ | 294 | /* linux/net/ipv4/ipconfig.c: trims ip addr off front of name, too. */ |
313 | extern __be32 root_nfs_parse_addr(char *name); /*__init*/ | 295 | extern __be32 root_nfs_parse_addr(char *name); /*__init*/ |
@@ -328,14 +310,15 @@ extern const struct inode_operations nfs3_file_inode_operations; | |||
328 | extern const struct file_operations nfs_file_operations; | 310 | extern const struct file_operations nfs_file_operations; |
329 | extern const struct address_space_operations nfs_file_aops; | 311 | extern const struct address_space_operations nfs_file_aops; |
330 | 312 | ||
331 | static inline struct rpc_cred *nfs_file_cred(struct file *file) | 313 | static inline struct nfs_open_context *nfs_file_open_context(struct file *filp) |
332 | { | 314 | { |
333 | if (file != NULL) { | 315 | return filp->private_data; |
334 | struct nfs_open_context *ctx; | 316 | } |
335 | 317 | ||
336 | ctx = (struct nfs_open_context*)file->private_data; | 318 | static inline struct rpc_cred *nfs_file_cred(struct file *file) |
337 | return ctx->cred; | 319 | { |
338 | } | 320 | if (file != NULL) |
321 | return nfs_file_open_context(file)->cred; | ||
339 | return NULL; | 322 | return NULL; |
340 | } | 323 | } |
341 | 324 | ||
@@ -378,6 +361,8 @@ extern const struct file_operations nfs_dir_operations; | |||
378 | extern struct dentry_operations nfs_dentry_operations; | 361 | extern struct dentry_operations nfs_dentry_operations; |
379 | 362 | ||
380 | extern int nfs_instantiate(struct dentry *dentry, struct nfs_fh *fh, struct nfs_fattr *fattr); | 363 | extern int nfs_instantiate(struct dentry *dentry, struct nfs_fh *fh, struct nfs_fattr *fattr); |
364 | extern int nfs_may_open(struct inode *inode, struct rpc_cred *cred, int openflags); | ||
365 | extern void nfs_access_zap_cache(struct inode *inode); | ||
381 | 366 | ||
382 | /* | 367 | /* |
383 | * linux/fs/nfs/symlink.c | 368 | * linux/fs/nfs/symlink.c |
@@ -420,15 +405,14 @@ extern int nfs_flush_incompatible(struct file *file, struct page *page); | |||
420 | extern int nfs_updatepage(struct file *, struct page *, unsigned int, unsigned int); | 405 | extern int nfs_updatepage(struct file *, struct page *, unsigned int, unsigned int); |
421 | extern int nfs_writeback_done(struct rpc_task *, struct nfs_write_data *); | 406 | extern int nfs_writeback_done(struct rpc_task *, struct nfs_write_data *); |
422 | extern void nfs_writedata_release(void *); | 407 | extern void nfs_writedata_release(void *); |
423 | extern int nfs_set_page_dirty(struct page *); | ||
424 | 408 | ||
425 | /* | 409 | /* |
426 | * Try to write back everything synchronously (but check the | 410 | * Try to write back everything synchronously (but check the |
427 | * return value!) | 411 | * return value!) |
428 | */ | 412 | */ |
429 | extern long nfs_sync_mapping_wait(struct address_space *, struct writeback_control *, int); | 413 | extern long nfs_sync_mapping_wait(struct address_space *, struct writeback_control *, int); |
430 | extern int nfs_sync_mapping_range(struct address_space *, loff_t, loff_t, int); | ||
431 | extern int nfs_wb_all(struct inode *inode); | 414 | extern int nfs_wb_all(struct inode *inode); |
415 | extern int nfs_wb_nocommit(struct inode *inode); | ||
432 | extern int nfs_wb_page(struct inode *inode, struct page* page); | 416 | extern int nfs_wb_page(struct inode *inode, struct page* page); |
433 | extern int nfs_wb_page_priority(struct inode *inode, struct page* page, int how); | 417 | extern int nfs_wb_page_priority(struct inode *inode, struct page* page, int how); |
434 | extern int nfs_wb_page_cancel(struct inode *inode, struct page* page); | 418 | extern int nfs_wb_page_cancel(struct inode *inode, struct page* page); |