Received: by 2002:a25:868d:0:0:0:0:0 with SMTP id z13csp561910ybk; Wed, 20 May 2020 06:38:36 -0700 (PDT) X-Google-Smtp-Source: ABdhPJw4K9uHbvTJzKzfewMobcOmvANsBw4ZHQ/zNTJ0xsCayRenjdNulKBcvrylsHa9BwnhXudM X-Received: by 2002:a17:906:51a:: with SMTP id j26mr3958306eja.438.1589981916472; Wed, 20 May 2020 06:38:36 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1589981916; cv=none; d=google.com; s=arc-20160816; b=eSJyCyAzkfNg19w+PViEHHyUB6TEzkZME63D7AKy8kqyu2q9k8YffXlVH9IdRygxtz lAoPsVAMDWHRD7XPaeU2FStBYTxDHFvUX/ls/6bEJZsI538fds4o1qtVjIweaILFg/G7 sdL2WOV2FnQaq0982eBNKDiSzuHWO1CeiJUIpXExjx36PDeWzOJxMiGzgaj39God7Kku ucWwJRizSCrGtR4aK8KULANQZNtz4buhg/nwzMXF6kNjS2KRPeHvfMoTgZ5Qpy9vAD1Q nemASZWYTyVPa0KFq9yiqXc85GVEq0YK5lWUdzWRPc/0OvCUcGHRE+KPDwldcSMK+LVL mopQ== 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=PkGTMb4xpiYIGGY3kk6K7PXmjLroLiQzIPvdWpuCOa0=; b=Y942qa3oLOxH6AnkfRwbjoj1NviahOfQubuC+xDSrSSVG7ku+3tBAnoIOJ2uiYhGP6 SYIG4RWFx8SAnujIUnvxnqJxPAVeiStkFRj357bf7CHjiOpPitIK77WKZOKu9jlFjb3t k1cYHJJqttlq0vh9QmUbNYp3yPrNp1jf+D6lhiMBJdfD+98SvYKVZP8rfvykT7a2bw5q Qmj2pcdKOETHXyLjkYACXts9pBTQ2NdXpOwmVZuOFX2wqut5HOgAJEHAW8Zu7g5SKy1w 07oKGtHaB0KtbOogJdzhV36VY7c50W982CySXJ5ar1P27mPi+pBp6EpScWMbOkkqc6WB MloQ== 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 zg9si1706048ejb.714.2020.05.20.06.38.12; Wed, 20 May 2020 06:38:36 -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 S1726486AbgETNhb (ORCPT + 99 others); Wed, 20 May 2020 09:37:31 -0400 Received: from mx2.suse.de ([195.135.220.15]:47194 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726436AbgETNhb (ORCPT ); Wed, 20 May 2020 09:37:31 -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 32221B249; Wed, 20 May 2020 13:37:32 +0000 (UTC) Received: by quack2.suse.cz (Postfix, from userid 1000) id B3B231E126F; Wed, 20 May 2020 15:37:28 +0200 (CEST) Date: Wed, 20 May 2020 15:37:28 +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 4/8] fs/ext4: Update ext4_should_use_dax() Message-ID: <20200520133728.GD30597@quack2.suse.cz> References: <20200520055753.3733520-1-ira.weiny@intel.com> <20200520055753.3733520-5-ira.weiny@intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20200520055753.3733520-5-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:49, ira.weiny@intel.com wrote: > From: Ira Weiny > > S_DAX should only be enabled when the underlying block device supports > dax. > > Change ext4_should_use_dax() to check for device support prior to the > over riding mount option. > > While we are at it change the function to ext4_should_enable_dax() as > this better reflects the ask as well as matches xfs. > > Reviewed-by: Jan Kara > Signed-off-by: Ira Weiny ... > @@ -4412,7 +4410,13 @@ static bool ext4_should_use_dax(struct inode *inode) > return false; > if (ext4_test_inode_flag(inode, EXT4_INODE_VERITY)) > return false; > - return true; > + if (!bdev_dax_supported(inode->i_sb->s_bdev, > + inode->i_sb->s_blocksize)) > + return false; > + if (test_opt(inode->i_sb, DAX_ALWAYS)) > + return true; > + > + return false; > } Now that I think about it - shouldn't we rather cache the result of bdev_dax_supported() in sb on mount and then just check the flag here? Because bdev_dax_supported() isn't exactly cheap (it does a lot of checks and mappings, tries to read from the pmem, ...). Honza -- Jan Kara SUSE Labs, CR