[PATCH] ncpfs support for zoned-2.3.28-K2

Petr Vandrovec (vandrove@vc.cvut.cz)
Tue, 16 Nov 1999 20:37:23 +0100


Hi Ingo,
this patch should get ncpfs to work with your zoned-2.3.28-K2
patch. I hope that I tied kmap/kunmap together right way.
If you think that recvmsg and memset will work with highmem
pages and that I can return HIGHMEM page to user from nopage
handler, you can change GFP_KERNEL to GFP_KERNEL | GFP_HIGHMEM
in call to page_alloc in fs/ncpfs/mmap.c.
I hope that kmap always suceeds. If it can fail, there are
some missing error checks (and what to do if it fails? BUG()?)
As I do not have more than 1GB of memory, I cannot test it
completely. I try to patch kernel to think that everything above
64MB is HIGHMEM, but if there is anybody with 64GB using
ncpfs, please test it.
Thanks,
Petr Vandrovec
vandrove@vc.cvut.cz

diff -urdN linux/fs/ncpfs/dir.c linux/fs/ncpfs/dir.c
--- linux/fs/ncpfs/dir.c Fri Nov 12 11:16:09 1999
+++ linux/fs/ncpfs/dir.c Tue Nov 16 19:20:23 1999
@@ -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;
diff -urdN linux/fs/ncpfs/mmap.c linux/fs/ncpfs/mmap.c
--- linux/fs/ncpfs/mmap.c Fri Nov 12 11:16:09 1999
+++ linux/fs/ncpfs/mmap.c Tue Nov 16 19:25:21 1999
@@ -43,10 +43,11 @@
int bufsize;
int pos;

- page = alloc_page(GFP_KERNEL);
+ page = alloc_page(GFP_KERNEL); /* ncpfs has nothing against GFP_HIGHMEM
+ as long as recvmsg and memset works on it */
if (!page)
return page;
- pg_addr = page_address(page);
+ pg_addr = kmap(page);
address &= PAGE_MASK;
pos = address - area->vm_start + (area->vm_pgoff << PAGE_SHIFT);

@@ -87,6 +88,7 @@
if (already_read < PAGE_SIZE)
memset((char*)(pg_addr + already_read), 0,
PAGE_SIZE - already_read);
+ kunmap(page);
return page;
}

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu
Please read the FAQ at http://www.tux.org/lkml/