patch-2.3.7 linux/fs/nfs/read.c

Next file: linux/fs/nfs/symlink.c
Previous file: linux/fs/nfs/inode.c
Back to the patch index
Back to the overall index

diff -u --recursive --new-file v2.3.6/linux/fs/nfs/read.c linux/fs/nfs/read.c
@@ -26,6 +26,7 @@
 #include <linux/pagemap.h>
 #include <linux/sunrpc/clnt.h>
 #include <linux/nfs_fs.h>
+#include <linux/smp_lock.h>
 
 #include <asm/segment.h>
 #include <asm/system.h>
@@ -77,7 +78,6 @@
 	int		flags = IS_SWAPFILE(inode)? NFS_RPC_SWAPFLAGS : 0;
 
 	dprintk("NFS: nfs_readpage_sync(%p)\n", page);
-	clear_bit(PG_error, &page->flags);
 
 	do {
 		if (count < rsize)
@@ -111,16 +111,14 @@
 	} while (count);
 
 	memset(buffer, 0, count);
-	set_bit(PG_uptodate, &page->flags);
+	SetPageUptodate(page);
 	result = 0;
 
 io_error:
+	UnlockPage(page);
 	/* Note: we don't refresh if the call returned error */
 	if (refresh && result >= 0)
 		nfs_refresh_inode(inode, &rqst.ra_fattr);
-	/* N.B. Use nfs_unlock_page here? */
-	clear_bit(PG_locked, &page->flags);
-	wake_up(&page->wait);
 	return result;
 }
 
@@ -146,17 +144,15 @@
 			memset((char *) address + result, 0, PAGE_SIZE - result);
 		}
 		nfs_refresh_inode(req->ra_inode, &req->ra_fattr);
-		set_bit(PG_uptodate, &page->flags);
+		SetPageUptodate(page);
 		succ++;
 	} else {
-		set_bit(PG_error, &page->flags);
+		SetPageError(page);
 		fail++;
 		dprintk("NFS: %d successful reads, %d failures\n", succ, fail);
 	}
-	/* N.B. Use nfs_unlock_page here? */
-	clear_bit(PG_locked, &page->flags);
-	wake_up(&page->wait);
-
+	page->owner = (int)current; // HACK, FIXME, will go away.
+	UnlockPage(page);
 	free_page(address);
 
 	rpc_release_task(task);
@@ -227,10 +223,10 @@
 	struct inode *inode = dentry->d_inode;
 	int		error;
 
+	lock_kernel();
 	dprintk("NFS: nfs_readpage (%p %ld@%ld)\n",
 		page, PAGE_SIZE, page->offset);
-	atomic_inc(&page->count);
-	set_bit(PG_locked, &page->flags);
+	get_page(page);
 
 	/*
 	 * Try to flush any pending writes to the file..
@@ -256,10 +252,10 @@
 	goto out_free;
 
 out_error:
-	clear_bit(PG_locked, &page->flags);
-	wake_up(&page->wait);
+	UnlockPage(page);
 out_free:
 	free_page(page_address(page));
 out:
+	unlock_kernel();
 	return error;
 }

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