From mboxrd@z Thu Jan 1 00:00:00 1970 From: Suparna Bhattacharya Subject: Re: [PATCH 4 of 8] Add flags to control direct IO helpers Date: Thu, 8 Feb 2007 09:33:05 +0530 Message-ID: <20070208040305.GA32642@in.ibm.com> References: <04dd7ddd593e9f147723.1170811969@opti.oraclecorp.com> <20070207170845.GA13893@in.ibm.com> <20070207180544.GC11967@think.oraclecorp.com> Reply-To: suparna@in.ibm.com Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Cc: linux-fsdevel@vger.kernel.org, akpm@linux-foundation.org To: Chris Mason Return-path: Received: from e2.ny.us.ibm.com ([32.97.182.142]:43017 "EHLO e2.ny.us.ibm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1030660AbXBHD5m (ORCPT ); Wed, 7 Feb 2007 22:57:42 -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 l183veus028607 for ; Wed, 7 Feb 2007 22:57:40 -0500 Received: from d01av03.pok.ibm.com (d01av03.pok.ibm.com [9.56.224.217]) by d01relay02.pok.ibm.com (8.13.8/8.13.8/NCO v8.2) with ESMTP id l183ve5T288988 for ; Wed, 7 Feb 2007 22:57:40 -0500 Received: from d01av03.pok.ibm.com (loopback [127.0.0.1]) by d01av03.pok.ibm.com (8.12.11.20060308/8.13.3) with ESMTP id l183vesm013249 for ; Wed, 7 Feb 2007 22:57:40 -0500 Content-Disposition: inline In-Reply-To: <20070207180544.GC11967@think.oraclecorp.com> Sender: linux-fsdevel-owner@vger.kernel.org List-Id: linux-fsdevel.vger.kernel.org On Wed, Feb 07, 2007 at 01:05:44PM -0500, Chris Mason wrote: > On Wed, Feb 07, 2007 at 10:38:45PM +0530, Suparna Bhattacharya wrote: > > > + * The flags parameter is a bitmask of: > > > + * > > > + * DIO_PLACEHOLDERS (use placeholder pages for locking) > > > + * DIO_CREATE (pass create=1 to get_block for filling holes or extending) > > > > A little more explanation about why these options are needed, and examples > > of when one would specify each of these options would be good. > > I'll extend the comments in the patch, but for discussion here: > > DIO_PLACEHOLDERS: placeholders are inserted into the page cache to > synchronize the DIO with buffered writes. From a locking point of view, > this is similar to inserting and locking pages in the address space > corresponding to the DIO. > > placeholders guard against concurrent allocations and truncates during the DIO. > You don't need placeholders if truncates and allocations are are > impossible (for example, on a block device). Likewise placeholders may not be needed if the underlying filesystem already takes care of locking to synchronizes DIO vs buffered. > > DIO_CREATE: placeholders make it possible for filesystems to safely fill > holes and extend the file via get_block during the DIO. If DIO_CREATE > is turned on, get_block will be called with create=1, allowing the FS to > allocate blocks during the DIO. When would one NOT specify DIO_CREATE, and what are the implications ? The purpose of having an option of NOT allowing the FS to allocate blocks during DIO is one is not very intuitive from the standpoint of the caller. (the block device case could be an example, but then create=1 could not do any harm or add extra overhead, so why bother ?) Is there still a valid case where we fallback to buffered IO to fill holes - to me that seems to be the only situation where create=0 must be enforced. > > DIO_DROP_I_MUTEX: If the write is inside of i_size, i_mutex is dropped > during the DIO and taken again before returning. Again an example of when one would not specify this (block device and XFS ?) would be useful. Regards Suparna > > -chris -- Suparna Bhattacharya (suparna@in.ibm.com) Linux Technology Center IBM Software Lab, India