From: Mingming Cao Subject: Re: [PATCH] ext4: Use page_mkwrite vma_operations to get mmap write notification. Date: Fri, 22 Feb 2008 11:28:43 -0800 Message-ID: <1203708523.3639.22.camel@localhost.localdomain> References: <1203691158-6788-1-git-send-email-aneesh.kumar@linux.vnet.ibm.com> <1203703848.3639.9.camel@localhost.localdomain> <20080222182310.GC6629@skywalker> Reply-To: cmm@us.ibm.com Mime-Version: 1.0 Content-Type: text/plain Content-Transfer-Encoding: 7bit Cc: tytso@mit.edu, linux-ext4@vger.kernel.org To: "Aneesh Kumar K.V" Return-path: Received: from e2.ny.us.ibm.com ([32.97.182.142]:56967 "EHLO e2.ny.us.ibm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1756600AbYBVT3I (ORCPT ); Fri, 22 Feb 2008 14:29:08 -0500 Received: from d01relay02.pok.ibm.com (d01relay02.pok.ibm.com [9.56.227.234]) by e2.ny.us.ibm.com (8.13.8/8.13.8) with ESMTP id m1MJSr80007424 for ; Fri, 22 Feb 2008 14:28:53 -0500 Received: from d01av04.pok.ibm.com (d01av04.pok.ibm.com [9.56.224.64]) by d01relay02.pok.ibm.com (8.13.8/8.13.8/NCO v8.7) with ESMTP id m1MJSrZc230842 for ; Fri, 22 Feb 2008 14:28:53 -0500 Received: from d01av04.pok.ibm.com (loopback [127.0.0.1]) by d01av04.pok.ibm.com (8.12.11.20060308/8.13.3) with ESMTP id m1MJSrfn030271 for ; Fri, 22 Feb 2008 14:28:53 -0500 In-Reply-To: <20080222182310.GC6629@skywalker> Sender: linux-ext4-owner@vger.kernel.org List-ID: On Fri, 2008-02-22 at 23:53 +0530, Aneesh Kumar K.V wrote: > On Fri, Feb 22, 2008 at 10:10:48AM -0800, Mingming Cao wrote: > > On Fri, 2008-02-22 at 20:09 +0530, Aneesh Kumar K.V wrote: > > ..... > > > > + ext4_journal_stop(handle); > > > + goto out_unlock; > > > + } > > > + if (!ret && ext4_should_order_data(inode)) { > > > + ret = walk_page_buffers(handle, page_buffers(page), > > > + 0, end, NULL, ext4_journal_dirty_data); > > > + } > > > + if (!ret) > > > + ret = block_commit_write(page, 0, end); > > > + > > Hmm, it seems wired to do commit_write when the page is about becoming > > writable, but maybe that's the way it needs to? > > > > Don't we need to update the i_size somewhere? > ah, i_size didn't change with mapped IO. > block_commit_write simply iterate over buffer_head of page and mark them > dirty. That is why we don't want to call that for data=journalled mode. > Right, but it still seems odd to mark the buffer_heard dirty *before* the write happens. I am confused, if i_size is not changing, then what we are journalling about? Keep journal ordering? but we haven't write anything yet.... Mingming > > > > > + ext4_journal_stop(handle); > > > +out_unlock: > > > + unlock_page(page); > > > + mutex_unlock(&inode->i_mutex); > > > + return ret; > > > +} > > > > It seems this combined the three journalling mode prepare_write() code > > here:( > > > > Since prepare_write() and commit_write() is going to sunset, why not > > simply calling mappings->a_ops->write_begin() and then write_end()? that > > should take care of pretty much the journalling and the page operations, > > no? > > write_begin and write_end works with the user space buffer. In this case > we don't have one. Also what ext4_page_mkwrite does is mostly what > write_begin/write_end does except the copy of user space buffer. > > > -aneesh