FS-Cache: Don't delete pending pages from the page-store tracking tree
authorDavid Howells <dhowells@redhat.com>
Thu, 19 Nov 2009 18:11:29 +0000 (18:11 +0000)
committerDavid Howells <dhowells@redhat.com>
Thu, 19 Nov 2009 18:11:29 +0000 (18:11 +0000)
Don't delete pending pages from the page-store tracking tree, but rather send
them for another write as they've presumably been updated.

Signed-off-by: David Howells <dhowells@redhat.com>
fs/fscache/page.c
lib/radix-tree.c

index 3ea8897bc21762ae6f7ada8b6f0eed3b368fcd58..022a5da8e130a5538caad2887c0431135723a3b6 100644 (file)
@@ -57,8 +57,11 @@ static void fscache_end_page_write(struct fscache_object *object,
                /* delete the page from the tree if it is now no longer
                 * pending */
                spin_lock(&cookie->stores_lock);
-               fscache_stat(&fscache_n_store_radix_deletes);
-               xpage = radix_tree_delete(&cookie->stores, page->index);
+               if (!radix_tree_tag_get(&cookie->stores, page->index,
+                                       FSCACHE_COOKIE_PENDING_TAG)) {
+                       fscache_stat(&fscache_n_store_radix_deletes);
+                       xpage = radix_tree_delete(&cookie->stores, page->index);
+               }
                spin_unlock(&cookie->stores_lock);
                wake_up_bit(&cookie->flags, 0);
        }
index ae6106855561e50e493647292f2d404e2fdae3c3..92cdd9936e3d2797f4d9b3804ad648b6bbec3c1b 100644 (file)
@@ -546,7 +546,6 @@ out:
 }
 EXPORT_SYMBOL(radix_tree_tag_clear);
 
-#ifndef __KERNEL__     /* Only the test harness uses this at present */
 /**
  * radix_tree_tag_get - get a tag on a radix tree node
  * @root:              radix tree root
@@ -609,7 +608,6 @@ int radix_tree_tag_get(struct radix_tree_root *root,
        }
 }
 EXPORT_SYMBOL(radix_tree_tag_get);
-#endif
 
 /**
  *     radix_tree_next_hole    -    find the next hole (not-present entry)