From: Eric Van Hensbergen <ericvh@gmail.com>
To: linux-fsdevel@vger.kernel.org
Subject: mmap question
Date: Mon, 21 Mar 2005 11:59:51 -0600 [thread overview]
Message-ID: <a4e6962a050321095930d4dbff@mail.gmail.com> (raw)
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
next reply other threads:[~2005-03-21 17:59 UTC|newest]
Thread overview: 21+ messages / expand[flat|nested] mbox.gz Atom feed top
2005-03-21 17:59 Eric Van Hensbergen [this message]
2005-03-21 21:33 ` mmap question Bryan Henderson
2005-03-21 22:23 ` Matthew Wilcox
2005-03-21 23:18 ` Bryan Henderson
[not found] ` <a4e6962a05032114575776f94b@mail.gmail.com>
2005-03-21 22:57 ` Eric Van Hensbergen
2005-03-21 23:24 ` Bryan Henderson
2005-03-21 23:27 ` Bryan Henderson
2005-03-22 21:05 ` Eric Van Hensbergen
2005-03-21 23:56 ` Martin Jambor
-- strict thread matches above, loose matches on Subject: below --
2005-08-02 22:44 Ruslan Nikolaev
2002-09-24 7:26 Der Herr Hofrat
2002-09-24 8:54 ` Der Herr Hofrat
2002-09-24 9:37 ` Zhonghua Dai
2002-06-04 13:22 Frederic Gobry
2002-07-01 13:14 ` Frederic Gobry
2002-07-11 16:19 ` Frederic Gobry
2002-07-11 19:15 ` Jörn Engel
2002-07-12 7:57 ` Frederic Gobry
2002-07-12 15:08 ` Jörn Engel
2002-07-15 7:41 ` Frederic Gobry
2002-07-12 15:21 ` David Woodhouse
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=a4e6962a050321095930d4dbff@mail.gmail.com \
--to=ericvh@gmail.com \
--cc=linux-fsdevel@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.