Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751167AbdIKIrl (ORCPT ); Mon, 11 Sep 2017 04:47:41 -0400 Received: from mx2.suse.de ([195.135.220.15]:51033 "EHLO mx1.suse.de" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1751065AbdIKIrj (ORCPT ); Mon, 11 Sep 2017 04:47:39 -0400 Date: Mon, 11 Sep 2017 10:47:33 +0200 From: Jan Kara To: "Theodore Ts'o" Cc: Dave Chinner , Ross Zwisler , Andreas Dilger , Dan Williams , Eric Sandeen , Lukas Czerner , Andrew Morton , "linux-kernel@vger.kernel.org" , "Darrick J. Wong" , Christoph Hellwig , Jan Kara , linux-ext4 , "linux-nvdimm@lists.01.org" , xfs Subject: Re: [PATCH 0/9] add ext4 per-inode DAX flag Message-ID: <20170911084733.GB7120@quack2.suse.cz> References: <20170906170754.GB17663@linux.intel.com> <20170907211303.GA23212@linux.intel.com> <5F58D3F5-D93B-4648-AE01-8A46956FBB4B@dilger.ca> <20170907215148.GA12669@linux.intel.com> <20170907221201.GZ17782@dastard> <20170907221900.GB12669@linux.intel.com> <20170907232543.GB17782@dastard> <20170908153913.jjhzogjs5zpeea5v@thunk.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20170908153913.jjhzogjs5zpeea5v@thunk.org> User-Agent: Mutt/1.5.24 (2015-08-30) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1141 Lines: 25 On Fri 08-09-17 11:39:13, Ted Tso wrote: > On Fri, Sep 08, 2017 at 09:25:43AM +1000, Dave Chinner wrote: > > > Okay, so other ideas (which you have also probably already though of) include: > > > > > > 1) Just return -EBUSY if anyone tries to change the DAX flag of an inode with > > > open mappings or any open file handles. > > > > You have to have an open fd to change the flag. :) > > What if we only allow the S_DAX flag to be *set*, when i_size and > i_blocks is zero? We could also require that only one file descriptor > be open against the inode, and that it be opened O_RDONLY. We could do something like that but IMHO it will be a pain to use (e.g. think how difficult it would be to switch your existing database to use DAX for data files). We can make transition reliable whenever inode->i_mapping->i_mmap RB tree is empty (effectively: whenever the file is not mmaped). And that should be relaxed enough for most usecases... But I agree that it will be somewhat tricky to prevent creation of new mappings while we are switching S_DAX flag so it needs more though. Honza -- Jan Kara SUSE Labs, CR