[parisc-linux] Re: [fuse-devel] Example filesystem fail to init on parisc

Miklos Szeredi miklos at szeredi.hu
Thu Mar 16 10:31:17 MST 2006


> This is wrong.  A VIPT cache requires a mapping to flush on.  If you
> kunmap, you've lost the mapping.

Ahh, I knew I was missing something fundamental.

> What you should do is
> 
> kmap()
> operate on data
> flush_kernel_dcache_page()
> kunmap()

Chris, can you try the below patch?

Thanks,
Miklos

Index: linux/fs/fuse/dev.c
===================================================================
--- linux.orig/fs/fuse/dev.c	2006-03-13 18:26:00.000000000 +0100
+++ linux/fs/fuse/dev.c	2006-03-16 18:28:54.000000000 +0100
@@ -432,11 +432,11 @@ static void fuse_copy_init(struct fuse_c
 static void fuse_copy_finish(struct fuse_copy_state *cs)
 {
 	if (cs->mapaddr) {
-		kunmap_atomic(cs->mapaddr, KM_USER0);
-		if (cs->write) {
+		if (cs->write)
 			flush_dcache_page(cs->pg);
+		kunmap_atomic(cs->mapaddr, KM_USER0);
+		if (cs->write)
 			set_page_dirty_lock(cs->pg);
-		}
 		put_page(cs->pg);
 		cs->mapaddr = NULL;
 	}
@@ -504,6 +504,8 @@ static int fuse_copy_page(struct fuse_co
 	if (page && zeroing && count < PAGE_SIZE) {
 		void *mapaddr = kmap_atomic(page, KM_USER1);
 		memset(mapaddr, 0, PAGE_SIZE);
+		if (!cs->write)
+			flush_dcache_page(page);
 		kunmap_atomic(mapaddr, KM_USER1);
 	}
 	while (count) {
@@ -514,12 +516,12 @@ static int fuse_copy_page(struct fuse_co
 			void *mapaddr = kmap_atomic(page, KM_USER1);
 			void *buf = mapaddr + offset;
 			offset += fuse_copy_do(cs, &buf, &count);
+			if (!cs->write)
+				flush_dcache_page(page);
 			kunmap_atomic(mapaddr, KM_USER1);
 		} else
 			offset += fuse_copy_do(cs, NULL, &count);
 	}
-	if (page && !cs->write)
-		flush_dcache_page(page);
 	return 0;
 }
 



More information about the parisc-linux mailing list