diff options
Diffstat (limited to 'include/linux/nfs_page.h')
| -rw-r--r-- | include/linux/nfs_page.h | 25 |
1 files changed, 11 insertions, 14 deletions
diff --git a/include/linux/nfs_page.h b/include/linux/nfs_page.h index bd193af80162..78e60798d10e 100644 --- a/include/linux/nfs_page.h +++ b/include/linux/nfs_page.h | |||
| @@ -16,12 +16,13 @@ | |||
| 16 | #include <linux/sunrpc/auth.h> | 16 | #include <linux/sunrpc/auth.h> |
| 17 | #include <linux/nfs_xdr.h> | 17 | #include <linux/nfs_xdr.h> |
| 18 | 18 | ||
| 19 | #include <asm/atomic.h> | 19 | #include <linux/kref.h> |
| 20 | 20 | ||
| 21 | /* | 21 | /* |
| 22 | * Valid flags for the radix tree | 22 | * Valid flags for the radix tree |
| 23 | */ | 23 | */ |
| 24 | #define NFS_PAGE_TAG_WRITEBACK 0 | 24 | #define NFS_PAGE_TAG_LOCKED 0 |
| 25 | #define NFS_PAGE_TAG_COMMIT 1 | ||
| 25 | 26 | ||
| 26 | /* | 27 | /* |
| 27 | * Valid flags for a dirty buffer | 28 | * Valid flags for a dirty buffer |
| @@ -33,8 +34,7 @@ | |||
| 33 | 34 | ||
| 34 | struct nfs_inode; | 35 | struct nfs_inode; |
| 35 | struct nfs_page { | 36 | struct nfs_page { |
| 36 | struct list_head wb_list, /* Defines state of page: */ | 37 | struct list_head wb_list; /* Defines state of page: */ |
| 37 | *wb_list_head; /* read/write/commit */ | ||
| 38 | struct page *wb_page; /* page to read in/write out */ | 38 | struct page *wb_page; /* page to read in/write out */ |
| 39 | struct nfs_open_context *wb_context; /* File state context info */ | 39 | struct nfs_open_context *wb_context; /* File state context info */ |
| 40 | atomic_t wb_complete; /* i/os we're waiting for */ | 40 | atomic_t wb_complete; /* i/os we're waiting for */ |
| @@ -42,7 +42,7 @@ struct nfs_page { | |||
| 42 | unsigned int wb_offset, /* Offset & ~PAGE_CACHE_MASK */ | 42 | unsigned int wb_offset, /* Offset & ~PAGE_CACHE_MASK */ |
| 43 | wb_pgbase, /* Start of page data */ | 43 | wb_pgbase, /* Start of page data */ |
| 44 | wb_bytes; /* Length of request */ | 44 | wb_bytes; /* Length of request */ |
| 45 | atomic_t wb_count; /* reference count */ | 45 | struct kref wb_kref; /* reference count */ |
| 46 | unsigned long wb_flags; | 46 | unsigned long wb_flags; |
| 47 | struct nfs_writeverf wb_verf; /* Commit cookie */ | 47 | struct nfs_writeverf wb_verf; /* Commit cookie */ |
| 48 | }; | 48 | }; |
| @@ -71,8 +71,8 @@ extern void nfs_clear_request(struct nfs_page *req); | |||
| 71 | extern void nfs_release_request(struct nfs_page *req); | 71 | extern void nfs_release_request(struct nfs_page *req); |
| 72 | 72 | ||
| 73 | 73 | ||
| 74 | extern int nfs_scan_list(struct nfs_inode *nfsi, struct list_head *head, struct list_head *dst, | 74 | extern int nfs_scan_list(struct nfs_inode *nfsi, struct list_head *dst, |
| 75 | pgoff_t idx_start, unsigned int npages); | 75 | pgoff_t idx_start, unsigned int npages, int tag); |
| 76 | extern void nfs_pageio_init(struct nfs_pageio_descriptor *desc, | 76 | extern void nfs_pageio_init(struct nfs_pageio_descriptor *desc, |
| 77 | struct inode *inode, | 77 | struct inode *inode, |
| 78 | int (*doio)(struct inode *, struct list_head *, unsigned int, size_t, int), | 78 | int (*doio)(struct inode *, struct list_head *, unsigned int, size_t, int), |
| @@ -84,12 +84,11 @@ extern void nfs_pageio_complete(struct nfs_pageio_descriptor *desc); | |||
| 84 | extern void nfs_pageio_cond_complete(struct nfs_pageio_descriptor *, pgoff_t); | 84 | extern void nfs_pageio_cond_complete(struct nfs_pageio_descriptor *, pgoff_t); |
| 85 | extern int nfs_wait_on_request(struct nfs_page *); | 85 | extern int nfs_wait_on_request(struct nfs_page *); |
| 86 | extern void nfs_unlock_request(struct nfs_page *req); | 86 | extern void nfs_unlock_request(struct nfs_page *req); |
| 87 | extern int nfs_set_page_writeback_locked(struct nfs_page *req); | 87 | extern void nfs_clear_page_tag_locked(struct nfs_page *req); |
| 88 | extern void nfs_clear_page_writeback(struct nfs_page *req); | ||
| 89 | 88 | ||
| 90 | 89 | ||
| 91 | /* | 90 | /* |
| 92 | * Lock the page of an asynchronous request without incrementing the wb_count | 91 | * Lock the page of an asynchronous request without getting a new reference |
| 93 | */ | 92 | */ |
| 94 | static inline int | 93 | static inline int |
| 95 | nfs_lock_request_dontget(struct nfs_page *req) | 94 | nfs_lock_request_dontget(struct nfs_page *req) |
| @@ -98,14 +97,14 @@ nfs_lock_request_dontget(struct nfs_page *req) | |||
| 98 | } | 97 | } |
| 99 | 98 | ||
| 100 | /* | 99 | /* |
| 101 | * Lock the page of an asynchronous request | 100 | * Lock the page of an asynchronous request and take a reference |
| 102 | */ | 101 | */ |
| 103 | static inline int | 102 | static inline int |
| 104 | nfs_lock_request(struct nfs_page *req) | 103 | nfs_lock_request(struct nfs_page *req) |
| 105 | { | 104 | { |
| 106 | if (test_and_set_bit(PG_BUSY, &req->wb_flags)) | 105 | if (test_and_set_bit(PG_BUSY, &req->wb_flags)) |
| 107 | return 0; | 106 | return 0; |
| 108 | atomic_inc(&req->wb_count); | 107 | kref_get(&req->wb_kref); |
| 109 | return 1; | 108 | return 1; |
| 110 | } | 109 | } |
| 111 | 110 | ||
| @@ -118,7 +117,6 @@ static inline void | |||
| 118 | nfs_list_add_request(struct nfs_page *req, struct list_head *head) | 117 | nfs_list_add_request(struct nfs_page *req, struct list_head *head) |
| 119 | { | 118 | { |
| 120 | list_add_tail(&req->wb_list, head); | 119 | list_add_tail(&req->wb_list, head); |
| 121 | req->wb_list_head = head; | ||
| 122 | } | 120 | } |
| 123 | 121 | ||
| 124 | 122 | ||
| @@ -132,7 +130,6 @@ nfs_list_remove_request(struct nfs_page *req) | |||
| 132 | if (list_empty(&req->wb_list)) | 130 | if (list_empty(&req->wb_list)) |
| 133 | return; | 131 | return; |
| 134 | list_del_init(&req->wb_list); | 132 | list_del_init(&req->wb_list); |
| 135 | req->wb_list_head = NULL; | ||
| 136 | } | 133 | } |
| 137 | 134 | ||
| 138 | static inline struct nfs_page * | 135 | static inline struct nfs_page * |
