I'm trying to implement a completely synchronous mmap in my
filesystem, but am running into some difficulty and was wondering if
someone could give me some insight/clue.

I want all my file system's operations to be complete uncached and
synchronous, but I also want to support mmap.  The problem is that
mmap writes don't seem to register right away.  If I have a test app:

        start = mmap(0, 8192, PROT_READ|PROT_WRITE, MAP_SHARED, fd, 0);
        if((int)start==-1) {
                perror("mmap:");
                exit(-1);
        }
        memcpy(buffer, start, 10);
        buffer[10] = 0;
        printf("reply: (%s)\n", buffer);
        sprintf(start, "hello world\n");
        memcpy(buffer, start, 10);
        buffer[10] = 0;
        printf("reply2: (%s)\n", buffer);
        munmap(start, 8192);
        close(fd);

I get the right results (because the read is also an mmap through the
buffer, but it looks like I don't see the file's set_page_dirty method
called until after I see the second read.  If I do use normal reads
(instead of mmap reads) I get the wrong results because my normal file
read method doesn't go through the page cache.

What am I doing wrong?  Is what I'm trying to do impossible, and if
so, how can I get as close as possible?

Thanks in advance for any help.

      -eric
-
To unsubscribe from this list: send the line "unsubscribe linux-fsdevel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to