From mboxrd@z Thu Jan 1 00:00:00 1970 From: Chris Mason Subject: Re: [RFC v0 1/4] vfs: add copy_range syscall and vfs entry point Date: Wed, 15 May 2013 16:16:14 -0400 Message-ID: <20130515201614.24668.83788@localhost.localdomain> References: <20130515193600.GA318@lenny.home.zabbo.net> Mime-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 8BIT Cc: linux-fsdevel , "linux-cifs@vger.kernel.org" , "J. Bruce Fields" To: Steve French , Zach Brown Return-path: Received: from dkim2.fusionio.com ([66.114.96.54]:53217 "EHLO dkim2.fusionio.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932921Ab3EOUQR convert rfc822-to-8bit (ORCPT ); Wed, 15 May 2013 16:16:17 -0400 Received: from mx1.fusionio.com (unknown [10.101.1.160]) by dkim2.fusionio.com (Postfix) with ESMTP id A10E99A0370 for ; Wed, 15 May 2013 14:16:16 -0600 (MDT) In-Reply-To: Sender: linux-fsdevel-owner@vger.kernel.org List-ID: Quoting Steve French (2013-05-15 16:08:16) > On Wed, May 15, 2013 at 2:36 PM, Zach Brown wrote: > > On Wed, May 15, 2013 at 12:50:13PM -0500, Steve French wrote: > >> Doesn't the new syscall have to invalidate the page cache pages that > >> the server is about to overwrite as btrfs does with the following line > >> in fs/btrfs/ioctl.c > >> > >> truncate_inode_pages_range(&inode->i_data, destoff, > >> PAGE_CACHE_ALIGN(destoff + len) - 1); > > > > The file_operations ->copy_range implementation is responsible for this, > > yeah, similar to ->write being responsible for invalidating around > > O_DIRECT writes. > > > >> (and doesn't truncate_inode_pages_range handle page cache alignment > >> anyway > > > > No, it bugs if given an end offset that isn't page aligned: > > > > BUG_ON((lend & (PAGE_CACHE_SIZE - 1)) != (PAGE_CACHE_SIZE - 1)); > > > > Lukas is working on a patch series to fix this: > > > > http://marc.info/?l=linux-fsdevel&m=136854986101843&w=2 > > > >> - and also why did btrfs use truncate_inode_pages_range instead > >> of invalidate?) > > > > I'm not sure. Maybe they can have racing dirty pages and want them > > thrown away rather than having invalidation fail? truncate_inode_pages_range ends with invalidate. It just locks the page first and makes sure to wait for writeback if it was already in progress. Looking at the btrfs side, I think we should add some locking on the destination extents as well.