aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux/nfs_fs.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/linux/nfs_fs.h')
-rw-r--r--include/linux/nfs_fs.h106
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 {
78struct nfs4_state; 76struct nfs4_state;
79struct nfs_open_context { 77struct 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 *);
311extern void nfs_end_attr_update(struct inode *); 304extern void nfs_end_attr_update(struct inode *);
312extern void nfs_begin_data_update(struct inode *); 305extern void nfs_begin_data_update(struct inode *);
313extern void nfs_end_data_update(struct inode *); 306extern void nfs_end_data_update(struct inode *);
314extern struct nfs_open_context *alloc_nfs_open_context(struct dentry *dentry, struct rpc_cred *cred);
315extern struct nfs_open_context *get_nfs_open_context(struct nfs_open_context *ctx); 307extern struct nfs_open_context *get_nfs_open_context(struct nfs_open_context *ctx);
316extern void put_nfs_open_context(struct nfs_open_context *ctx); 308extern void put_nfs_open_context(struct nfs_open_context *ctx);
317extern void nfs_file_set_open_context(struct file *filp, struct nfs_open_context *ctx);
318extern struct nfs_open_context *nfs_find_open_context(struct inode *inode, struct rpc_cred *cred, int mode); 309extern struct nfs_open_context *nfs_find_open_context(struct inode *inode, struct rpc_cred *cred, int mode);
319extern 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. */
322extern u32 root_nfs_parse_addr(char *name); /*__init*/ 312extern 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
335extern struct inode_operations nfs3_file_inode_operations; 325extern struct inode_operations nfs3_file_inode_operations;
336#endif /* CONFIG_NFS_V3 */ 326#endif /* CONFIG_NFS_V3 */
337extern struct file_operations nfs_file_operations; 327extern const struct file_operations nfs_file_operations;
338extern struct address_space_operations nfs_file_aops; 328extern struct address_space_operations nfs_file_aops;
339 329
340static inline struct rpc_cred *nfs_file_cred(struct file *file) 330static 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
382extern struct inode_operations nfs3_dir_inode_operations; 372extern struct inode_operations nfs3_dir_inode_operations;
383#endif /* CONFIG_NFS_V3 */ 373#endif /* CONFIG_NFS_V3 */
384extern struct file_operations nfs_dir_operations; 374extern const struct file_operations nfs_dir_operations;
385extern struct dentry_operations nfs_dentry_operations; 375extern struct dentry_operations nfs_dentry_operations;
386 376
387extern int nfs_instantiate(struct dentry *dentry, struct nfs_fh *fh, struct nfs_fattr *fattr); 377extern 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);
415extern int nfs_writepages(struct address_space *, struct writeback_control *); 405extern int nfs_writepages(struct address_space *, struct writeback_control *);
416extern int nfs_flush_incompatible(struct file *file, struct page *page); 406extern int nfs_flush_incompatible(struct file *file, struct page *page);
417extern int nfs_updatepage(struct file *, struct page *, unsigned int, unsigned int); 407extern int nfs_updatepage(struct file *, struct page *, unsigned int, unsigned int);
418extern void nfs_writeback_done(struct rpc_task *task, void *data); 408extern int nfs_writeback_done(struct rpc_task *, struct nfs_write_data *);
419extern void nfs_writedata_release(void *data); 409extern 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)
422extern void nfs_commit_done(struct rpc_task *, void *data); 412struct nfs_write_data *nfs_commit_alloc(unsigned int pagecount);
423extern void nfs_commit_release(void *data); 413void 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 */
430extern int nfs_sync_inode(struct inode *, unsigned long, unsigned int, int); 420extern 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)
432extern int nfs_commit_inode(struct inode *, int); 422extern int nfs_commit_inode(struct inode *, int);
423extern void nfs_commit_release(void *wdata);
433#else 424#else
434static inline int 425static inline int
435nfs_commit_inode(struct inode *inode, int how) 426nfs_commit_inode(struct inode *inode, int how)
@@ -447,7 +438,7 @@ nfs_have_writebacks(struct inode *inode)
447static inline int 438static inline int
448nfs_wb_all(struct inode *inode) 439nfs_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 */
457static inline int nfs_wb_page_priority(struct inode *inode, struct page* page, int how) 448static 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 */
472extern mempool_t *nfs_wdata_mempool; 463extern struct nfs_write_data *nfs_writedata_alloc(unsigned int pagecount);
473 464extern void nfs_writedata_free(struct nfs_write_data *p);
474static 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
497static 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)
507extern int nfs_readpage(struct file *, struct page *); 469extern int nfs_readpage(struct file *, struct page *);
508extern int nfs_readpages(struct file *, struct address_space *, 470extern int nfs_readpages(struct file *, struct address_space *,
509 struct list_head *, unsigned); 471 struct list_head *, unsigned);
510extern void nfs_readpage_result(struct rpc_task *, void *); 472extern int nfs_readpage_result(struct rpc_task *, struct nfs_read_data *);
511extern void nfs_readdata_release(void *data); 473extern 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 */
517extern mempool_t *nfs_rdata_mempool; 478extern struct nfs_read_data *nfs_readdata_alloc(unsigned int pagecount);
518 479extern void nfs_readdata_free(struct nfs_read_data *p);
519static 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
542static 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