patch-2.3.29 linux/fs/ncpfs/dir.c

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

diff -u --recursive --new-file v2.3.28/linux/fs/ncpfs/dir.c linux/fs/ncpfs/dir.c
@@ -522,7 +522,7 @@
 	if (!page)
 		goto read_really;
 
-	ctl.cache = cache = (union ncp_dir_cache *) page_address(page);
+	ctl.cache = cache = (union ncp_dir_cache *) kmap(page);
 	ctl.head  = cache->head;
 
 	if (!Page_Uptodate(page) || !ctl.head.eof)
@@ -550,10 +550,10 @@
 			ctl.page = ncp_get_cache_page(inode, ctl.ofs, 1);
 			if (!ctl.page)
 				goto invalid_cache;
+			ctl.cache = (union ncp_dir_cache *)
+					kmap(ctl.page);
 			if (!Page_Uptodate(ctl.page))
 				goto invalid_cache;
-			ctl.cache = (union ncp_dir_cache *)
-					page_address(ctl.page);
 		}
 		while (ctl.idx < NCP_DIRCACHE_SIZE) {
 			struct dentry *dent;
@@ -575,6 +575,7 @@
 				goto finished;
 		}
 		if (ctl.page) {
+			kunmap(ctl.page);
 			SetPageUptodate(ctl.page);
 			UnlockPage(ctl.page);
 			page_cache_release(ctl.page);
@@ -585,6 +586,7 @@
 	}
 invalid_cache:
 	if (ctl.page) {
+		kunmap(ctl.page);
 		UnlockPage(ctl.page);
 		page_cache_release(ctl.page);
 		ctl.page = NULL;
@@ -614,12 +616,14 @@
 	ctl.head.eof = ctl.valid;
 finished:
 	if (page) {
+		kunmap(page);
 		cache->head = ctl.head;
 		SetPageUptodate(page);
 		UnlockPage(page);
 		page_cache_release(page);
 	}
 	if (ctl.page) {
+		kunmap(ctl.page);
 		SetPageUptodate(ctl.page);
 		UnlockPage(ctl.page);
 		page_cache_release(ctl.page);
@@ -680,6 +684,7 @@
 
 	if (ctl.idx >= NCP_DIRCACHE_SIZE) {
 		if (ctl.page) {
+			kunmap(ctl.page);
 			SetPageUptodate(ctl.page);
 			UnlockPage(ctl.page);
 			page_cache_release(ctl.page);
@@ -690,7 +695,7 @@
 		ctl.page  = ncp_get_cache_page(inode, ctl.ofs, 0);
 		if (ctl.page)
 			ctl.cache = (union ncp_dir_cache *)
-					page_address(ctl.page);
+					kmap(ctl.page);
 	}
 	if (ctl.cache) {
 		ctl.cache->dentry[ctl.idx] = newdent;

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