[PATCH] Nitpick: fix compilation for newer kernels

Glauber Costa glommer at redhat.com
Thu Oct 2 12:35:21 PDT 2008


Zach,

crfs is failing to build in early enough kernels due to some changes
to the VM. I'm assuming you're tracking the latest, and are not willing to
maintain lots of compatibility code conditional on the kernel version, so
I'm just sending a definitive fix for it.

Let me know if it's acceptable.

-------------- next part --------------
# HG changeset patch
# User root at t60.glommer
# Date 1222973861 10800
# Node ID 158e83047a26f102615fbbefaa47a1cd9816ee66
# Parent  9173853817b77319e7f66382c13be830d244e4ac
Recent changes from Nick Piggin introduces some changes to the VM

So anyone using a kernel recent enough will hit this:
TestSetPageLocked => !trylock_page
mapping->tree_lock is now a spinlock

Signed-off-by: Glauber Costa <glommer at redhat.com>

diff -r 9173853817b7 -r 158e83047a26 lk/meta.c
--- a/lk/meta.c	Wed Oct 01 14:27:04 2008 -0700
+++ b/lk/meta.c	Thu Oct 02 15:57:41 2008 -0300
@@ -1099,7 +1099,7 @@
 
 	page = virt_to_page(mpage);
 
-	if (TestSetPageLocked(page))
+	if (!trylock_page(page))
 		return 0;
 	if (PageWriteback(page)) {
 		unlock_page(page);
@@ -1211,7 +1211,7 @@
 
 		crfs_log("locking mpage "CRFS_MPAGE_FMT, CRFS_MPAGE_ARG(mpage));
 
-		if (TestSetPageLocked(page)) {
+		if (!trylock_page(page)) {
 			meta_unlock_until(first, mpage);
 			page_cache_get(page);
 			spin_unlock(&info->a_meta_lock);
@@ -2555,7 +2555,7 @@
 	 * have a helper.
 	 */
         INIT_RADIX_TREE(&mapping->page_tree, GFP_ATOMIC);
-        rwlock_init(&mapping->tree_lock);
+        spin_lock_init(&mapping->tree_lock);
         spin_lock_init(&mapping->i_mmap_lock);
         INIT_LIST_HEAD(&mapping->private_list);
         spin_lock_init(&mapping->private_lock);


More information about the crfs-devel mailing list