From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751466Ab3HTQBH (ORCPT ); Tue, 20 Aug 2013 12:01:07 -0400 Received: from cantor2.suse.de ([195.135.220.15]:33069 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751227Ab3HTQBG (ORCPT ); Tue, 20 Aug 2013 12:01:06 -0400 Date: Tue, 20 Aug 2013 18:00:57 +0200 From: Jan Kara To: Andy Lutomirski Cc: Dave Chinner , "linux-kernel@vger.kernel.org" , "linux-ext4@vger.kernel.org" , "Theodore Ts'o" , Dave Hansen , xfs@oss.sgi.com, Jan Kara , Tim Chen , Christoph Hellwig Subject: Re: [PATCH v3 3/5] mm: Notify filesystems when it's time to apply a deferred cmtime update Message-ID: <20130820160057.GC2862@quack.suse.cz> References: <20130820023615.GE6023@dastard> <20130820040814.GH6023@dastard> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.21 (2010-09-15) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon 19-08-13 21:14:44, Andy Lutomirski wrote: > >> I could require ->writepages *and* ->flush_cmtime to handle the time > >> update, but that would complicate non-transactional filesystems. > >> Those filesystems should just flush cmtime at the end of writepages. > > > > do_writepages() is the wrong place to do such updates - we can get > > writeback directly through .writepage, so the time updates need to > > be in .writepage. That first .writepage call will clear the bit on > > the mapping, so it's only done on the first call to .writepage on > > the given mapping. > > Last time I checked, all the paths that actually needed the timestamp > update went through .writepages. I'll double-check. kswapd can call just .writepage to do the writeout so timestamp update should be handled there as well. Otherwise all pages in a mapping can be cleaned without timestamp being updated. Which btw made me realize that even your scheme doesn't completely make sure timestamp is updated after mmap write - if you have pages 0 and 1, you write to both of them - CMTIME flag gets set. Then fsync_range(fd, 0, 4096) is called. We write the page 0, writeprotect it, update timestamps. But page 1 is still writeable so writes to it won't set CMTIME flag, neither update the timestamp... Not that I think this can be reasonably solved but it is a food for thought. Honza -- Jan Kara SUSE Labs, CR