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

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

diff -u --recursive --new-file v2.3.29/linux/fs/ncpfs/dir.c linux/fs/ncpfs/dir.c
@@ -81,10 +81,8 @@
 	NULL,			/* get_block */
 	NULL,			/* readpage */
 	NULL,			/* writepage */
-	NULL,			/* flushpage */
 	NULL,			/* truncate */
 	NULL,			/* permission */
-	NULL,			/* smap */
 	NULL,			/* revalidate */
 };
 
@@ -368,37 +366,6 @@
 	return val;
 }
 
-static struct page *
-ncp_get_cache_page(struct inode *inode, unsigned long offset, int used)
-{
-	struct address_space *i_data = &inode->i_data;
-	struct page *new_page, *page, **hash;
-
-	hash = page_hash(i_data, offset);
-
-	page = __find_lock_page(i_data, offset, hash);
-	if (used || page)
-		return page;
-
-	new_page = page_cache_alloc();
-	if (!new_page)
-		return NULL;
-
-	for (;;) {
-		page = new_page;
-		if (!add_to_page_cache_unique(page, i_data, offset, hash))
-			break;
-		page_cache_release(page);
-		page = __find_lock_page(i_data, offset, hash);
-		if (page) {
-			page_cache_free(new_page);
-			break;
-		}
-	}
-
-	return page;
-}
-
 /* most parts from nfsd_d_validate() */
 static int
 ncp_d_validate(struct dentry *dentry)
@@ -518,7 +485,7 @@
 		filp->f_pos = 2;
 	}
 
-	page = ncp_get_cache_page(inode, 0, 0);
+	page = grab_cache_page(&inode->i_data, 0);
 	if (!page)
 		goto read_really;
 
@@ -547,7 +514,7 @@
 
 	for (;;) {
 		if (ctl.ofs != 0) {
-			ctl.page = ncp_get_cache_page(inode, ctl.ofs, 1);
+			ctl.page = find_lock_page(&inode->i_data, ctl.ofs);
 			if (!ctl.page)
 				goto invalid_cache;
 			ctl.cache = (union ncp_dir_cache *)
@@ -616,8 +583,8 @@
 	ctl.head.eof = ctl.valid;
 finished:
 	if (page) {
-		kunmap(page);
 		cache->head = ctl.head;
+		kunmap(page);
 		SetPageUptodate(page);
 		UnlockPage(page);
 		page_cache_release(page);
@@ -692,7 +659,7 @@
 		ctl.cache = NULL;
 		ctl.idx  -= NCP_DIRCACHE_SIZE;
 		ctl.ofs  += 1;
-		ctl.page  = ncp_get_cache_page(inode, ctl.ofs, 0);
+		ctl.page  = grab_cache_page(&inode->i_data, ctl.ofs);
 		if (ctl.page)
 			ctl.cache = (union ncp_dir_cache *)
 					kmap(ctl.page);

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