From: Jan Kara Subject: Re: [PATCH 0/9] add ext4 per-inode DAX flag Date: Mon, 11 Sep 2017 10:47:33 +0200 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-Transfer-Encoding: 7bit Cc: Andreas Dilger , Eric Sandeen , Jan Kara , Andrew Morton , "Darrick J. Wong" , "linux-nvdimm-hn68Rpc1hR1g9hUCZPvPmw@public.gmane.org" , Dave Chinner , "linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org" , Christoph Hellwig , xfs , Lukas Czerner , linux-ext4 To: Theodore Ts'o Return-path: Content-Disposition: inline In-Reply-To: <20170908153913.jjhzogjs5zpeea5v-AKGzg7BKzIDYtjvyW6yDsg@public.gmane.org> List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: linux-nvdimm-bounces-hn68Rpc1hR1g9hUCZPvPmw@public.gmane.org Sender: "Linux-nvdimm" List-Id: linux-ext4.vger.kernel.org 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