patch-2.4.15 linux/include/linux/nfs_page.h

Next file: linux/include/linux/parport.h
Previous file: linux/include/linux/nfs_fs_sb.h
Back to the patch index
Back to the overall index

diff -u --recursive --new-file v2.4.14/linux/include/linux/nfs_page.h linux/include/linux/nfs_page.h
@@ -23,6 +23,7 @@
 
 struct nfs_page {
 	struct list_head	wb_hash,	/* Inode */
+				wb_lru,		/* superblock lru list */
 				wb_list,	/* Defines state of page: */
 				*wb_list_head;	/*      read/write/commit */
 	struct file		*wb_file;
@@ -40,33 +41,39 @@
 
 #define NFS_WBACK_BUSY(req)	(test_bit(PG_BUSY,&(req)->wb_flags))
 
-extern	struct nfs_page *nfs_create_request(struct file *file,
-					    struct inode *inode,
-					    struct page *page,
-					    unsigned int offset,
-					    unsigned int count);
+extern	struct nfs_page *nfs_create_request(struct file *, struct inode *,
+					    struct page *,
+					    unsigned int, unsigned int);
 extern	void nfs_release_request(struct nfs_page *req);
 
 
-extern	void nfs_list_add_request(struct nfs_page *req,
-				  struct list_head *head);
-extern	void nfs_list_remove_request(struct nfs_page *req);
-
-extern	int nfs_scan_list_timeout(struct list_head *head,
-				  struct list_head *dst,
-				  struct inode *inode);
-extern	int nfs_scan_list(struct list_head *src, struct list_head *dst,
-			  struct file *file, unsigned long idx_start,
-			  unsigned int npages);
-extern	int nfs_coalesce_requests(struct list_head *src, struct list_head *dst,
-				  unsigned int maxpages);
+extern	void nfs_list_add_request(struct nfs_page *, struct list_head *);
+
+extern	int nfs_scan_lru(struct list_head *, struct list_head *, int);
+extern	int nfs_scan_lru_timeout(struct list_head *, struct list_head *, int);
+extern	int nfs_scan_list(struct list_head *, struct list_head *,
+			  struct file *, unsigned long, unsigned int);
+extern	int nfs_coalesce_requests(struct list_head *, struct list_head *,
+				  unsigned int);
+extern  int nfs_wait_on_request(struct nfs_page *);
 
 extern	spinlock_t nfs_wreq_lock;
 
 /*
+ * Lock the page of an asynchronous request without incrementing the wb_count
+ */
+static inline int
+nfs_lock_request_dontget(struct nfs_page *req)
+{
+	if (test_and_set_bit(PG_BUSY, &req->wb_flags))
+		return 0;
+	return 1;
+}
+
+/*
  * Lock the page of an asynchronous request
  */
-static __inline__ int
+static inline int
 nfs_lock_request(struct nfs_page *req)
 {
 	if (test_and_set_bit(PG_BUSY, &req->wb_flags))
@@ -75,7 +82,7 @@
 	return 1;
 }
 
-static __inline__ void
+static inline void
 nfs_unlock_request(struct nfs_page *req)
 {
 	if (!NFS_WBACK_BUSY(req)) {
@@ -86,20 +93,57 @@
 	clear_bit(PG_BUSY, &req->wb_flags);
 	smp_mb__after_clear_bit();
 	if (waitqueue_active(&req->wb_wait))
-		wake_up(&req->wb_wait);
+		wake_up_all(&req->wb_wait);
 	nfs_release_request(req);
 }
 
-static __inline__ struct nfs_page *
+/**
+ * nfs_list_remove_request - Remove a request from its wb_list
+ * @req: request
+ */
+static inline void
+nfs_list_remove_request(struct nfs_page *req)
+{
+	if (list_empty(&req->wb_list))
+		return;
+	if (!NFS_WBACK_BUSY(req)) {
+		printk(KERN_ERR "NFS: unlocked request attempted removed from list!\n");
+		BUG();
+	}
+	list_del_init(&req->wb_list);
+	req->wb_list_head = NULL;
+}
+
+static inline struct nfs_page *
 nfs_list_entry(struct list_head *head)
 {
 	return list_entry(head, struct nfs_page, wb_list);
 }
 
-static __inline__ struct nfs_page *
+static inline struct nfs_page *
 nfs_inode_wb_entry(struct list_head *head)
 {
 	return list_entry(head, struct nfs_page, wb_hash);
+}
+
+static inline void
+__nfs_add_lru(struct list_head *head, struct nfs_page *req)
+{
+	list_add_tail(&req->wb_lru, head);
+}
+
+static inline void
+__nfs_del_lru(struct nfs_page *req)
+{
+	if (list_empty(&req->wb_lru))
+		return;
+	list_del_init(&req->wb_lru);
+}
+
+static inline struct nfs_page *
+nfs_lru_entry(struct list_head *head)
+{
+        return list_entry(head, struct nfs_page, wb_lru);
 }
 
 #endif /* _LINUX_NFS_PAGE_H */

FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen (who was at: slshen@lbl.gov)