diff options
author | Jeff Garzik <jeff@garzik.org> | 2006-03-29 17:18:49 -0500 |
---|---|---|
committer | Jeff Garzik <jeff@garzik.org> | 2006-03-29 17:18:49 -0500 |
commit | e02a4cabfcb9a999b74a2e2e6f13ffcb7ff2d606 (patch) | |
tree | 2f3db60be4c57eca2a4c3ab3f3122dcf1ec0c624 /include/linux/nfs_fs.h | |
parent | 600511e86babe3727264a0883a3a264f6fb6caf5 (diff) | |
parent | f3cab8a0b1a772dc8b055b7affa567a366627c9e (diff) |
Merge branch 'master'
Diffstat (limited to 'include/linux/nfs_fs.h')
-rw-r--r-- | include/linux/nfs_fs.h | 106 |
1 files changed, 19 insertions, 87 deletions
diff --git a/include/linux/nfs_fs.h b/include/linux/nfs_fs.h index b4dc6e2e10c9..c71227dd4389 100644 --- a/include/linux/nfs_fs.h +++ b/include/linux/nfs_fs.h | |||
@@ -56,9 +56,7 @@ | |||
56 | * When flushing a cluster of dirty pages, there can be different | 56 | * When flushing a cluster of dirty pages, there can be different |
57 | * strategies: | 57 | * strategies: |
58 | */ | 58 | */ |
59 | #define FLUSH_AGING 0 /* only flush old buffers */ | ||
60 | #define FLUSH_SYNC 1 /* file being synced, or contention */ | 59 | #define FLUSH_SYNC 1 /* file being synced, or contention */ |
61 | #define FLUSH_WAIT 2 /* wait for completion */ | ||
62 | #define FLUSH_STABLE 4 /* commit to stable storage */ | 60 | #define FLUSH_STABLE 4 /* commit to stable storage */ |
63 | #define FLUSH_LOWPRI 8 /* low priority background flush */ | 61 | #define FLUSH_LOWPRI 8 /* low priority background flush */ |
64 | #define FLUSH_HIGHPRI 16 /* high priority memory reclaim flush */ | 62 | #define FLUSH_HIGHPRI 16 /* high priority memory reclaim flush */ |
@@ -78,6 +76,7 @@ struct nfs_access_entry { | |||
78 | struct nfs4_state; | 76 | struct nfs4_state; |
79 | struct nfs_open_context { | 77 | struct nfs_open_context { |
80 | atomic_t count; | 78 | atomic_t count; |
79 | struct vfsmount *vfsmnt; | ||
81 | struct dentry *dentry; | 80 | struct dentry *dentry; |
82 | struct rpc_cred *cred; | 81 | struct rpc_cred *cred; |
83 | struct nfs4_state *state; | 82 | struct nfs4_state *state; |
@@ -118,8 +117,7 @@ struct nfs_inode { | |||
118 | unsigned long cache_validity; /* bit mask */ | 117 | unsigned long cache_validity; /* bit mask */ |
119 | 118 | ||
120 | /* | 119 | /* |
121 | * read_cache_jiffies is when we started read-caching this inode, | 120 | * read_cache_jiffies is when we started read-caching this inode. |
122 | * and read_cache_mtime is the mtime of the inode at that time. | ||
123 | * attrtimeo is for how long the cached information is assumed | 121 | * attrtimeo is for how long the cached information is assumed |
124 | * to be valid. A successful attribute revalidation doubles | 122 | * to be valid. A successful attribute revalidation doubles |
125 | * attrtimeo (up to acregmax/acdirmax), a failure resets it to | 123 | * attrtimeo (up to acregmax/acdirmax), a failure resets it to |
@@ -128,11 +126,6 @@ struct nfs_inode { | |||
128 | * We need to revalidate the cached attrs for this inode if | 126 | * We need to revalidate the cached attrs for this inode if |
129 | * | 127 | * |
130 | * jiffies - read_cache_jiffies > attrtimeo | 128 | * jiffies - read_cache_jiffies > attrtimeo |
131 | * | ||
132 | * and invalidate any cached data/flush out any dirty pages if | ||
133 | * we find that | ||
134 | * | ||
135 | * mtime != read_cache_mtime | ||
136 | */ | 129 | */ |
137 | unsigned long read_cache_jiffies; | 130 | unsigned long read_cache_jiffies; |
138 | unsigned long attrtimeo; | 131 | unsigned long attrtimeo; |
@@ -311,12 +304,9 @@ extern void nfs_begin_attr_update(struct inode *); | |||
311 | extern void nfs_end_attr_update(struct inode *); | 304 | extern void nfs_end_attr_update(struct inode *); |
312 | extern void nfs_begin_data_update(struct inode *); | 305 | extern void nfs_begin_data_update(struct inode *); |
313 | extern void nfs_end_data_update(struct inode *); | 306 | extern void nfs_end_data_update(struct inode *); |
314 | extern struct nfs_open_context *alloc_nfs_open_context(struct dentry *dentry, struct rpc_cred *cred); | ||
315 | extern struct nfs_open_context *get_nfs_open_context(struct nfs_open_context *ctx); | 307 | extern struct nfs_open_context *get_nfs_open_context(struct nfs_open_context *ctx); |
316 | extern void put_nfs_open_context(struct nfs_open_context *ctx); | 308 | extern void put_nfs_open_context(struct nfs_open_context *ctx); |
317 | extern void nfs_file_set_open_context(struct file *filp, struct nfs_open_context *ctx); | ||
318 | extern struct nfs_open_context *nfs_find_open_context(struct inode *inode, struct rpc_cred *cred, int mode); | 309 | extern struct nfs_open_context *nfs_find_open_context(struct inode *inode, struct rpc_cred *cred, int mode); |
319 | extern void nfs_file_clear_open_context(struct file *filp); | ||
320 | 310 | ||
321 | /* linux/net/ipv4/ipconfig.c: trims ip addr off front of name, too. */ | 311 | /* linux/net/ipv4/ipconfig.c: trims ip addr off front of name, too. */ |
322 | extern u32 root_nfs_parse_addr(char *name); /*__init*/ | 312 | extern u32 root_nfs_parse_addr(char *name); /*__init*/ |
@@ -334,7 +324,7 @@ extern struct inode_operations nfs_file_inode_operations; | |||
334 | #ifdef CONFIG_NFS_V3 | 324 | #ifdef CONFIG_NFS_V3 |
335 | extern struct inode_operations nfs3_file_inode_operations; | 325 | extern struct inode_operations nfs3_file_inode_operations; |
336 | #endif /* CONFIG_NFS_V3 */ | 326 | #endif /* CONFIG_NFS_V3 */ |
337 | extern struct file_operations nfs_file_operations; | 327 | extern const struct file_operations nfs_file_operations; |
338 | extern struct address_space_operations nfs_file_aops; | 328 | extern struct address_space_operations nfs_file_aops; |
339 | 329 | ||
340 | static inline struct rpc_cred *nfs_file_cred(struct file *file) | 330 | static inline struct rpc_cred *nfs_file_cred(struct file *file) |
@@ -381,7 +371,7 @@ extern struct inode_operations nfs_dir_inode_operations; | |||
381 | #ifdef CONFIG_NFS_V3 | 371 | #ifdef CONFIG_NFS_V3 |
382 | extern struct inode_operations nfs3_dir_inode_operations; | 372 | extern struct inode_operations nfs3_dir_inode_operations; |
383 | #endif /* CONFIG_NFS_V3 */ | 373 | #endif /* CONFIG_NFS_V3 */ |
384 | extern struct file_operations nfs_dir_operations; | 374 | extern const struct file_operations nfs_dir_operations; |
385 | extern struct dentry_operations nfs_dentry_operations; | 375 | extern struct dentry_operations nfs_dentry_operations; |
386 | 376 | ||
387 | extern int nfs_instantiate(struct dentry *dentry, struct nfs_fh *fh, struct nfs_fattr *fattr); | 377 | extern int nfs_instantiate(struct dentry *dentry, struct nfs_fh *fh, struct nfs_fattr *fattr); |
@@ -415,21 +405,22 @@ extern int nfs_writepage(struct page *page, struct writeback_control *wbc); | |||
415 | extern int nfs_writepages(struct address_space *, struct writeback_control *); | 405 | extern int nfs_writepages(struct address_space *, struct writeback_control *); |
416 | extern int nfs_flush_incompatible(struct file *file, struct page *page); | 406 | extern int nfs_flush_incompatible(struct file *file, struct page *page); |
417 | extern int nfs_updatepage(struct file *, struct page *, unsigned int, unsigned int); | 407 | extern int nfs_updatepage(struct file *, struct page *, unsigned int, unsigned int); |
418 | extern void nfs_writeback_done(struct rpc_task *task, void *data); | 408 | extern int nfs_writeback_done(struct rpc_task *, struct nfs_write_data *); |
419 | extern void nfs_writedata_release(void *data); | 409 | extern void nfs_writedata_release(void *); |
420 | 410 | ||
421 | #if defined(CONFIG_NFS_V3) || defined(CONFIG_NFS_V4) | 411 | #if defined(CONFIG_NFS_V3) || defined(CONFIG_NFS_V4) |
422 | extern void nfs_commit_done(struct rpc_task *, void *data); | 412 | struct nfs_write_data *nfs_commit_alloc(unsigned int pagecount); |
423 | extern void nfs_commit_release(void *data); | 413 | void nfs_commit_free(struct nfs_write_data *p); |
424 | #endif | 414 | #endif |
425 | 415 | ||
426 | /* | 416 | /* |
427 | * Try to write back everything synchronously (but check the | 417 | * Try to write back everything synchronously (but check the |
428 | * return value!) | 418 | * return value!) |
429 | */ | 419 | */ |
430 | extern int nfs_sync_inode(struct inode *, unsigned long, unsigned int, int); | 420 | extern int nfs_sync_inode_wait(struct inode *, unsigned long, unsigned int, int); |
431 | #if defined(CONFIG_NFS_V3) || defined(CONFIG_NFS_V4) | 421 | #if defined(CONFIG_NFS_V3) || defined(CONFIG_NFS_V4) |
432 | extern int nfs_commit_inode(struct inode *, int); | 422 | extern int nfs_commit_inode(struct inode *, int); |
423 | extern void nfs_commit_release(void *wdata); | ||
433 | #else | 424 | #else |
434 | static inline int | 425 | static inline int |
435 | nfs_commit_inode(struct inode *inode, int how) | 426 | nfs_commit_inode(struct inode *inode, int how) |
@@ -447,7 +438,7 @@ nfs_have_writebacks(struct inode *inode) | |||
447 | static inline int | 438 | static inline int |
448 | nfs_wb_all(struct inode *inode) | 439 | nfs_wb_all(struct inode *inode) |
449 | { | 440 | { |
450 | int error = nfs_sync_inode(inode, 0, 0, FLUSH_WAIT); | 441 | int error = nfs_sync_inode_wait(inode, 0, 0, 0); |
451 | return (error < 0) ? error : 0; | 442 | return (error < 0) ? error : 0; |
452 | } | 443 | } |
453 | 444 | ||
@@ -456,8 +447,8 @@ nfs_wb_all(struct inode *inode) | |||
456 | */ | 447 | */ |
457 | static inline int nfs_wb_page_priority(struct inode *inode, struct page* page, int how) | 448 | static inline int nfs_wb_page_priority(struct inode *inode, struct page* page, int how) |
458 | { | 449 | { |
459 | int error = nfs_sync_inode(inode, page->index, 1, | 450 | int error = nfs_sync_inode_wait(inode, page->index, 1, |
460 | how | FLUSH_WAIT | FLUSH_STABLE); | 451 | how | FLUSH_STABLE); |
461 | return (error < 0) ? error : 0; | 452 | return (error < 0) ? error : 0; |
462 | } | 453 | } |
463 | 454 | ||
@@ -469,37 +460,8 @@ static inline int nfs_wb_page(struct inode *inode, struct page* page) | |||
469 | /* | 460 | /* |
470 | * Allocate and free nfs_write_data structures | 461 | * Allocate and free nfs_write_data structures |
471 | */ | 462 | */ |
472 | extern mempool_t *nfs_wdata_mempool; | 463 | extern struct nfs_write_data *nfs_writedata_alloc(unsigned int pagecount); |
473 | 464 | extern void nfs_writedata_free(struct nfs_write_data *p); | |
474 | static inline struct nfs_write_data *nfs_writedata_alloc(unsigned int pagecount) | ||
475 | { | ||
476 | struct nfs_write_data *p = mempool_alloc(nfs_wdata_mempool, SLAB_NOFS); | ||
477 | |||
478 | if (p) { | ||
479 | memset(p, 0, sizeof(*p)); | ||
480 | INIT_LIST_HEAD(&p->pages); | ||
481 | if (pagecount < NFS_PAGEVEC_SIZE) | ||
482 | p->pagevec = &p->page_array[0]; | ||
483 | else { | ||
484 | size_t size = ++pagecount * sizeof(struct page *); | ||
485 | p->pagevec = kmalloc(size, GFP_NOFS); | ||
486 | if (p->pagevec) { | ||
487 | memset(p->pagevec, 0, size); | ||
488 | } else { | ||
489 | mempool_free(p, nfs_wdata_mempool); | ||
490 | p = NULL; | ||
491 | } | ||
492 | } | ||
493 | } | ||
494 | return p; | ||
495 | } | ||
496 | |||
497 | static inline void nfs_writedata_free(struct nfs_write_data *p) | ||
498 | { | ||
499 | if (p && (p->pagevec != &p->page_array[0])) | ||
500 | kfree(p->pagevec); | ||
501 | mempool_free(p, nfs_wdata_mempool); | ||
502 | } | ||
503 | 465 | ||
504 | /* | 466 | /* |
505 | * linux/fs/nfs/read.c | 467 | * linux/fs/nfs/read.c |
@@ -507,44 +469,14 @@ static inline void nfs_writedata_free(struct nfs_write_data *p) | |||
507 | extern int nfs_readpage(struct file *, struct page *); | 469 | extern int nfs_readpage(struct file *, struct page *); |
508 | extern int nfs_readpages(struct file *, struct address_space *, | 470 | extern int nfs_readpages(struct file *, struct address_space *, |
509 | struct list_head *, unsigned); | 471 | struct list_head *, unsigned); |
510 | extern void nfs_readpage_result(struct rpc_task *, void *); | 472 | extern int nfs_readpage_result(struct rpc_task *, struct nfs_read_data *); |
511 | extern void nfs_readdata_release(void *data); | 473 | extern void nfs_readdata_release(void *data); |
512 | |||
513 | 474 | ||
514 | /* | 475 | /* |
515 | * Allocate and free nfs_read_data structures | 476 | * Allocate and free nfs_read_data structures |
516 | */ | 477 | */ |
517 | extern mempool_t *nfs_rdata_mempool; | 478 | extern struct nfs_read_data *nfs_readdata_alloc(unsigned int pagecount); |
518 | 479 | extern void nfs_readdata_free(struct nfs_read_data *p); | |
519 | static inline struct nfs_read_data *nfs_readdata_alloc(unsigned int pagecount) | ||
520 | { | ||
521 | struct nfs_read_data *p = mempool_alloc(nfs_rdata_mempool, SLAB_NOFS); | ||
522 | |||
523 | if (p) { | ||
524 | memset(p, 0, sizeof(*p)); | ||
525 | INIT_LIST_HEAD(&p->pages); | ||
526 | if (pagecount < NFS_PAGEVEC_SIZE) | ||
527 | p->pagevec = &p->page_array[0]; | ||
528 | else { | ||
529 | size_t size = ++pagecount * sizeof(struct page *); | ||
530 | p->pagevec = kmalloc(size, GFP_NOFS); | ||
531 | if (p->pagevec) { | ||
532 | memset(p->pagevec, 0, size); | ||
533 | } else { | ||
534 | mempool_free(p, nfs_rdata_mempool); | ||
535 | p = NULL; | ||
536 | } | ||
537 | } | ||
538 | } | ||
539 | return p; | ||
540 | } | ||
541 | |||
542 | static inline void nfs_readdata_free(struct nfs_read_data *p) | ||
543 | { | ||
544 | if (p && (p->pagevec != &p->page_array[0])) | ||
545 | kfree(p->pagevec); | ||
546 | mempool_free(p, nfs_rdata_mempool); | ||
547 | } | ||
548 | 480 | ||
549 | /* | 481 | /* |
550 | * linux/fs/nfs3proc.c | 482 | * linux/fs/nfs3proc.c |