]> err.no Git - linux-2.6/commitdiff
NFS cleanup: speed up nfs_scan_commit using radix tree tags
authorTrond Myklebust <Trond.Myklebust@netapp.com>
Sun, 17 Jun 2007 19:27:42 +0000 (15:27 -0400)
committerTrond Myklebust <Trond.Myklebust@netapp.com>
Wed, 11 Jul 2007 03:40:26 +0000 (23:40 -0400)
Add a tag for requests that are waiting for a COMMIT

Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
fs/nfs/pagelist.c
fs/nfs/write.c
include/linux/nfs_page.h

index 23e9dea209021826ce69f7c10420c959bed2309a..ad90cbe76703caebf2ab4e9c8842f2f341f117f1 100644 (file)
@@ -381,10 +381,10 @@ void nfs_pageio_cond_complete(struct nfs_pageio_descriptor *desc, pgoff_t index)
 /**
  * nfs_scan_list - Scan a list for matching requests
  * @nfsi: NFS inode
- * @head: One of the NFS inode request lists
  * @dst: Destination list
  * @idx_start: lower bound of page->index to scan
  * @npages: idx_start + npages sets the upper bound to scan.
+ * @tag: tag to scan for
  *
  * Moves elements from one of the inode request lists.
  * If the number of requests is set to 0, the entire address_space
@@ -392,9 +392,9 @@ void nfs_pageio_cond_complete(struct nfs_pageio_descriptor *desc, pgoff_t index)
  * The requests are *not* checked to ensure that they form a contiguous set.
  * You must be holding the inode's req_lock when calling this function
  */
-int nfs_scan_list(struct nfs_inode *nfsi, struct list_head *head,
+int nfs_scan_list(struct nfs_inode *nfsi,
                struct list_head *dst, pgoff_t idx_start,
-               unsigned int npages)
+               unsigned int npages, int tag)
 {
        struct nfs_page *pgvec[NFS_SCAN_MAXENTRIES];
        struct nfs_page *req;
@@ -409,9 +409,9 @@ int nfs_scan_list(struct nfs_inode *nfsi, struct list_head *head,
                idx_end = idx_start + npages - 1;
 
        for (;;) {
-               found = radix_tree_gang_lookup(&nfsi->nfs_page_tree,
+               found = radix_tree_gang_lookup_tag(&nfsi->nfs_page_tree,
                                (void **)&pgvec[0], idx_start,
-                               NFS_SCAN_MAXENTRIES);
+                               NFS_SCAN_MAXENTRIES, tag);
                if (found <= 0)
                        break;
                for (i = 0; i < found; i++) {
@@ -419,10 +419,10 @@ int nfs_scan_list(struct nfs_inode *nfsi, struct list_head *head,
                        if (req->wb_index > idx_end)
                                goto out;
                        idx_start = req->wb_index + 1;
-                       if (req->wb_list_head != head)
-                               continue;
                        if (nfs_set_page_tag_locked(req)) {
                                nfs_list_remove_request(req);
+                               radix_tree_tag_clear(&nfsi->nfs_page_tree,
+                                               req->wb_index, tag);
                                nfs_list_add_request(req, dst);
                                res++;
                        }
index 754066cc9146dcbbae2f62294fab3e0e0ccdc2ae..0f779ca12ec3e71392be507f7540cb99f1734fd5 100644 (file)
@@ -462,6 +462,9 @@ nfs_mark_request_commit(struct nfs_page *req)
        nfs_list_add_request(req, &nfsi->commit);
        nfsi->ncommit++;
        set_bit(PG_NEED_COMMIT, &(req)->wb_flags);
+       radix_tree_tag_set(&nfsi->nfs_page_tree,
+                       req->wb_index,
+                       NFS_PAGE_TAG_COMMIT);
        spin_unlock(&nfsi->req_lock);
        inc_zone_page_state(req->wb_page, NR_UNSTABLE_NFS);
        __mark_inode_dirty(inode, I_DIRTY_DATASYNC);
@@ -575,7 +578,8 @@ nfs_scan_commit(struct inode *inode, struct list_head *dst, pgoff_t idx_start, u
        int res = 0;
 
        if (nfsi->ncommit != 0) {
-               res = nfs_scan_list(nfsi, &nfsi->commit, dst, idx_start, npages);
+               res = nfs_scan_list(nfsi, dst, idx_start, npages,
+                               NFS_PAGE_TAG_COMMIT);
                nfsi->ncommit -= res;
                if ((nfsi->ncommit == 0) != list_empty(&nfsi->commit))
                        printk(KERN_ERR "NFS: desynchronized value of nfs_i.ncommit.\n");
index 042434c39b7e90f9bc8cd9eb04b25be0b6e547d3..481a42105d692674fd6bfabfc26725427216c0b2 100644 (file)
@@ -22,6 +22,7 @@
  * Valid flags for the radix tree
  */
 #define NFS_PAGE_TAG_LOCKED    0
+#define NFS_PAGE_TAG_COMMIT    1
 
 /*
  * Valid flags for a dirty buffer
@@ -71,8 +72,8 @@ extern        void nfs_clear_request(struct nfs_page *req);
 extern void nfs_release_request(struct nfs_page *req);
 
 
-extern int nfs_scan_list(struct nfs_inode *nfsi, struct list_head *head, struct list_head *dst,
-                         pgoff_t idx_start, unsigned int npages);
+extern int nfs_scan_list(struct nfs_inode *nfsi, struct list_head *dst,
+                         pgoff_t idx_start, unsigned int npages, int tag);
 extern void nfs_pageio_init(struct nfs_pageio_descriptor *desc,
                             struct inode *inode,
                             int (*doio)(struct inode *, struct list_head *, unsigned int, size_t, int),