From mboxrd@z Thu Jan 1 00:00:00 1970 From: Eric Van Hensbergen Subject: mmap question Date: Mon, 21 Mar 2005 11:59:51 -0600 Message-ID: Reply-To: Eric Van Hensbergen Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Received: from wproxy.gmail.com ([64.233.184.205]:18221 "EHLO wproxy.gmail.com") by vger.kernel.org with ESMTP id S261374AbVCUR7x (ORCPT ); Mon, 21 Mar 2005 12:59:53 -0500 Received: by wproxy.gmail.com with SMTP id 69so719223wri for ; Mon, 21 Mar 2005 09:59:52 -0800 (PST) To: linux-fsdevel@vger.kernel.org Sender: linux-fsdevel-owner@vger.kernel.org List-Id: linux-fsdevel.vger.kernel.org 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