From mboxrd@z Thu Jan 1 00:00:00 1970 From: Badari Pulavarty Subject: Re: journal start/stop in ext3_writeback_writepage() Date: 09 Feb 2005 10:38:32 -0800 Message-ID: <1107974312.20053.68.camel@dyn318077bld.beaverton.ibm.com> References: <1107965901.20053.61.camel@dyn318077bld.beaverton.ibm.com> <1107967040.1949.59.camel@sisko.sctweedie.blueyonder.co.uk> Mime-Version: 1.0 Content-Type: text/plain Content-Transfer-Encoding: 7bit Cc: linux-fsdevel@vger.kernel.org, Andrew Morton Received: from e33.co.us.ibm.com ([32.97.110.131]:3461 "EHLO e33.co.us.ibm.com") by vger.kernel.org with ESMTP id S261873AbVBISgg (ORCPT ); Wed, 9 Feb 2005 13:36:36 -0500 Received: from westrelay02.boulder.ibm.com (westrelay02.boulder.ibm.com [9.17.195.11]) by e33.co.us.ibm.com (8.12.10/8.12.9) with ESMTP id j19IaXGj184372 for ; Wed, 9 Feb 2005 13:36:33 -0500 Received: from d03av04.boulder.ibm.com (d03av04.boulder.ibm.com [9.17.195.170]) by westrelay02.boulder.ibm.com (8.12.10/NCO/VER6.6) with ESMTP id j19IaWUj447792 for ; Wed, 9 Feb 2005 11:36:32 -0700 Received: from d03av04.boulder.ibm.com (loopback [127.0.0.1]) by d03av04.boulder.ibm.com (8.12.11/8.12.11) with ESMTP id j19IaVFY019834 for ; Wed, 9 Feb 2005 11:36:31 -0700 To: "Stephen C. Tweedie" In-Reply-To: <1107967040.1949.59.camel@sisko.sctweedie.blueyonder.co.uk> Sender: linux-fsdevel-owner@vger.kernel.org List-Id: linux-fsdevel.vger.kernel.org On Wed, 2005-02-09 at 08:37, Stephen C. Tweedie wrote: > Hi, > > On Wed, 2005-02-09 at 16:18, Badari Pulavarty wrote: > > > I am trying to understand journaling code in ext3. > > Can some one enlighten me, why we need journal start > > and stop in ext3_writeback_writepage() ? The block > > allocation is already made in prepare_write(). > > prepare_write()/commit_write() are used for write(2) writes: the data is > dirtied, but not immediately queued for IO (unless you're using O_SYNC). > > writepage is used when you want to write the page's data to disk > *immediately* --- it's used when the VM is swapping out an mmaped file, > or for msync(). > > So when writepage comes in, there's no guarantee that we've had a > previous prepare. You can, for example, use ftruncate() to create a > large hole in a file, and then mmap() it; if you then dirty a page, then > the allocation occurs in the writepage(). So a transaction handle is > necessary. > > --Stephen Thank you. It make sense now. I was under the impression that writepage() could also be used to flush the data even for write(2) writes. Is it not true ? I was trying to add writepages() interface for ext3. I am wondering if I need to do journaling for that case too. Thanks, Badari