From mboxrd@z Thu Jan 1 00:00:00 1970 From: Badari Pulavarty Subject: Re: [ANNOUNCE] new new aops patchset Date: Wed, 04 Apr 2007 16:05:19 -0700 Message-ID: <1175727919.5019.14.camel@dyn9047017100.beaverton.ibm.com> References: <20070402120934.GA19626@wotan.suse.de> <20070404221034.GF21982@ca-server1.us.oracle.com> Mime-Version: 1.0 Content-Type: text/plain Content-Transfer-Encoding: 7bit Cc: Nick Piggin , Linux Filesystems , Steven Whitehouse To: Mark Fasheh Return-path: Received: from e35.co.us.ibm.com ([32.97.110.153]:54007 "EHLO e35.co.us.ibm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752648AbXDDXFQ (ORCPT ); Wed, 4 Apr 2007 19:05:16 -0400 Received: from d03relay04.boulder.ibm.com (d03relay04.boulder.ibm.com [9.17.195.106]) by e35.co.us.ibm.com (8.13.8/8.13.8) with ESMTP id l34N5FWi006425 for ; Wed, 4 Apr 2007 19:05:15 -0400 Received: from d03av02.boulder.ibm.com (d03av02.boulder.ibm.com [9.17.195.168]) by d03relay04.boulder.ibm.com (8.13.8/8.13.8/NCO v8.3) with ESMTP id l34N5F9C140918 for ; Wed, 4 Apr 2007 17:05:15 -0600 Received: from d03av02.boulder.ibm.com (loopback [127.0.0.1]) by d03av02.boulder.ibm.com (8.12.11.20060308/8.13.3) with ESMTP id l34N5ELX006498 for ; Wed, 4 Apr 2007 17:05:15 -0600 In-Reply-To: <20070404221034.GF21982@ca-server1.us.oracle.com> Sender: linux-fsdevel-owner@vger.kernel.org List-Id: linux-fsdevel.vger.kernel.org On Wed, 2007-04-04 at 15:10 -0700, Mark Fasheh wrote: ... > +int pagecache_write_begin(struct file *file, struct address_space *mapping, > + loff_t pos, unsigned len, unsigned flags, > + struct page **pagep, void **fsdata) > +{ > + const struct address_space_operations *aops = mapping->a_ops; > + > + if (aops->write_begin) { > + return aops->write_begin(file, mapping, pos, len, flags, > + pagep, fsdata); > + } else { > + int ret; > + pgoff_t index = pos >> PAGE_CACHE_SHIFT; > + unsigned offset = pos & (PAGE_CACHE_SIZE - 1); > + struct inode *inode = mapping->host; > + struct page *page; > +again: > + page = __grab_cache_page(mapping, index); > + *pagep = page; > + if (!page) > + return -ENOMEM; > + > + if (flags & AOP_FLAG_UNINTERRUPTIBLE && !PageUptodate(page)) { > + /* > + * There is no way to resolve a short write situation > + * for a !Uptodate page (except by double copying in > + * the caller done by generic_perform_write_2copy). > + * > + * Instead, we have to bring it uptodate here. > + */ > + ret = aops->readpage(file, page); > + page_cache_release(page); > + if (ret) { > + if (ret == AOP_TRUNCATED_PAGE) > + goto again; > + return ret; > + } > + goto again; > + } > + > + ret = aops->prepare_write(file, page, offset, offset+len); > + if (ret) { > + if (ret != AOP_TRUNCATED_PAGE) > + unlock_page(page); > + page_cache_release(page); > + if (pos + len > inode->i_size) > + vmtruncate(inode, inode->i_size); > + if (ret == AOP_TRUNCATED_PAGE) > + goto again; > + } > + return ret; > + } Hmm.. Okay, only filesystems that could return AOP_TRUNCATED_PAGE are ocf2 and gfs2. Now that both of them are switched to have write_begin()/write_end(), why do we need this code to handle AOP_TRUNCATED_PAGE (in the else part) ? Can't we just cleanup/nuke all the AOP_TRUNCATED_PAGE handling ? Dumb question ? Thanks, Badari