Received: by 2002:a25:868d:0:0:0:0:0 with SMTP id z13csp588585ybk; Wed, 20 May 2020 07:12:19 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwGjOUYCr8gjO8EHmMCjjKLSP/aSeDwe8+3bkTq+JyTbHrA9Wi5ANRE7IQ9JnANRB3TxeyP X-Received: by 2002:a05:6402:b38:: with SMTP id bo24mr3710387edb.24.1589983939703; Wed, 20 May 2020 07:12:19 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1589983939; cv=none; d=google.com; s=arc-20160816; b=jizA1GxxvKVFdwKLzl7PPFf66UDPM0Bxy1u78mvDXoB+APr3uVyvHuma+8uevmYP68 DxwTdF7GfLo4Zl0xmcWLEcR9YmH1MCZnBD2V6dpjykVbkV1NBA1jfi4/kjZOeI9GBtpZ yQqEsv48dRzAWEGLI81UWijPHj6S50cXKGBLW5J7hTy6UHmBCSG7vx5bLtufkhEE5OSB v6uq+cHPvDcmz/8f1WK5TRNutwt4A0/VH4b6b2eQW8z0y6EvD6EA3XWaiFWnQ6bD5AB9 gq+DJSk+6PaYADe7l0PBsEkrJxEP/LhBza/ci0AsVp9sTRy4LgY5HoGIySnEQPamF8UO oUww== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date; bh=eRHJXKh5byH9y8z7pfZsirECtYFi66gLn0HT43gMGYs=; b=AhgHtdfsEkffocdRDEumdVfesdfWeFLtYEVg1vrkClWM8ES1x7SFOPwZV4Li7C5UtT jQjEkeZ1QN+sCcro1vsPLxOgUKFLtISCkiW/iBy1UovKwJyeeCBORWcGPtSvLqKMllPr ShZZmtnaDUIELmG5cy0CL3ikI4i6bprMoZhHE+QiL50/fevBtv868KghtaZIQTXmJDKk +F8Yx9myx8fm88osEhAs1DaqXAWXBC6GBGmsv0o+mt3LmhVSGlXgajRGI1vetChV2IPZ evu6wEtxm5xJVnec1izpQvKB1oIxn5OF9zzh9031PWZENJhQJYNcdSYXIn5YwHHb3nHv Xkuw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-ext4-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-ext4-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id d21si1884922eja.353.2020.05.20.07.11.43; Wed, 20 May 2020 07:12:19 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-ext4-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-ext4-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-ext4-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726510AbgETOLl (ORCPT + 99 others); Wed, 20 May 2020 10:11:41 -0400 Received: from mx2.suse.de ([195.135.220.15]:37452 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726436AbgETOLl (ORCPT ); Wed, 20 May 2020 10:11:41 -0400 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (unknown [195.135.220.254]) by mx2.suse.de (Postfix) with ESMTP id 1655AABCE; Wed, 20 May 2020 14:11:42 +0000 (UTC) Received: by quack2.suse.cz (Postfix, from userid 1000) id 719CE1E126F; Wed, 20 May 2020 16:11:38 +0200 (CEST) Date: Wed, 20 May 2020 16:11:38 +0200 From: Jan Kara To: ira.weiny@intel.com Cc: linux-ext4@vger.kernel.org, Andreas Dilger , "Theodore Y. Ts'o" , Jan Kara , Eric Biggers , Al Viro , Dan Williams , Dave Chinner , Christoph Hellwig , Jeff Moyer , "Darrick J. Wong" , linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH V3 7/8] fs/ext4: Introduce DAX inode flag Message-ID: <20200520141138.GE30597@quack2.suse.cz> References: <20200520055753.3733520-1-ira.weiny@intel.com> <20200520055753.3733520-8-ira.weiny@intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20200520055753.3733520-8-ira.weiny@intel.com> User-Agent: Mutt/1.10.1 (2018-07-13) Sender: linux-ext4-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-ext4@vger.kernel.org On Tue 19-05-20 22:57:52, ira.weiny@intel.com wrote: > From: Ira Weiny > > Add a flag to preserve FS_XFLAG_DAX in the ext4 inode. > > Set the flag to be user visible and changeable. Set the flag to be > inherited. Allow applications to change the flag at any time with the > exception of if VERITY or ENCRYPT is set. > > Disallow setting VERITY or ENCRYPT if DAX is set. > > Finally, on regular files, flag the inode to not be cached to facilitate > changing S_DAX on the next creation of the inode. > > Signed-off-by: Ira Weiny The patch looks good to me. You can add: Reviewed-by: Jan Kara One comment below: > diff --git a/fs/ext4/super.c b/fs/ext4/super.c > index 5ba65eb0e2ef..be9713e898eb 100644 > --- a/fs/ext4/super.c > +++ b/fs/ext4/super.c > @@ -1323,6 +1323,9 @@ static int ext4_set_context(struct inode *inode, const void *ctx, size_t len, > if (WARN_ON_ONCE(IS_DAX(inode) && i_size_read(inode))) > return -EINVAL; AFAIU this check is here so that fscrypt_inherit_context() is able call us and we can clear S_DAX flag. So can't we rather move this below the EXT4_INODE_DAX check and change this to IS_DAX(inode) && !(inode->i_flags & I_NEW) ? Because as I'm reading the code now, this should never trigger? > > + if (ext4_test_inode_flag(inode, EXT4_INODE_DAX)) > + return -EOPNOTSUPP; > + Honza -- Jan Kara SUSE Labs, CR