Received: by 2002:a05:6a10:5bc5:0:0:0:0 with SMTP id os5csp1224926pxb; Wed, 27 Oct 2021 22:53:31 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzAMK9QDDyWB/vGctig9cyk93BeJN8tsH8HWDT12iK7L2M8wYRpCAZB0JP5PtBzUDVhg6hG X-Received: by 2002:a17:906:c1c9:: with SMTP id bw9mr2746258ejb.3.1635400411313; Wed, 27 Oct 2021 22:53:31 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1635400411; cv=none; d=google.com; s=arc-20160816; b=pnY20bThdsgg7swfZbQjwMbPol6drOYfx6cLvKWXS4I+ntjU3gFp+//8Onk1QFDqmv QvyGJeJgr82dKxMBht66PdA3VbnKlua3t45hO8+E83o7kmXO3jvcMPJ42wwG0stS/qHp pgOl7AQZv9FYAJj/aCi3JiSkI3BWQY/li0cXEjE4VKyx4Z7qkyH6PSLnDMQg72DbrqBs n551T1SoNPU/jB3/dsgkkobAEoaD3kQyhPAV1fTHDpUi7UUGJFK5+KSr7XNlImpsaSAw CmHbOtgxbDliGGGEuK5c0JIlOOUKqc4FdUyVuK008rRWuD15q8exqLurYC7iVA8vpc/O bYZA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:content-language :in-reply-to:mime-version:user-agent:date:message-id:from:references :cc:to:subject; bh=2sLsaRtg5JXt1CMQFd+rVj6E9jHDL1b92aEVkwWXYNA=; b=gz7+YZLEFFodArZA5pcNBBjbmOl409Zl66+gIGmj3tx+gZbKZj1drMkQbdbCGU7W8Q YsOw8asiXmqbce+xfsjZfvrWEsADEwRbpJGzFl/OGfaMIWu1Den/gu2hnWmVAV1qtQ4/ uLhr/Dsxeuq4co5Imihjl1Wx7/aNnRESp2rKIJKkH5HhXvXXQc48zYlSeSzmLskUXgNW F1PFhzHaMgCnIh68SiSczp7whzrevh2+9tb7JuhPRPGWp6ncXS1fAvYl4opwz+WohLF4 /gj0yercYTeEB6fHeFNUB0XKAGWs8mfbpGn5qCX8u/ED6OIeJAUnKfZjPbDi8lfv6Ofb ZP6w== 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=alibaba.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id l10si3130567edb.64.2021.10.27.22.52.57; Wed, 27 Oct 2021 22:53:31 -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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=alibaba.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229694AbhJ1Fy6 (ORCPT + 99 others); Thu, 28 Oct 2021 01:54:58 -0400 Received: from out30-45.freemail.mail.aliyun.com ([115.124.30.45]:46433 "EHLO out30-45.freemail.mail.aliyun.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229586AbhJ1Fy5 (ORCPT ); Thu, 28 Oct 2021 01:54:57 -0400 X-Alimail-AntiSpam: AC=PASS;BC=-1|-1;BR=01201311R541e4;CH=green;DM=||false|;DS=||;FP=0|-1|-1|-1|0|-1|-1|-1;HT=e01e04407;MF=jefflexu@linux.alibaba.com;NM=1;PH=DS;RN=11;SR=0;TI=SMTPD_---0Utxz1z-_1635400347; Received: from admindeMacBook-Pro-2.local(mailfrom:jefflexu@linux.alibaba.com fp:SMTPD_---0Utxz1z-_1635400347) by smtp.aliyun-inc.com(127.0.0.1); Thu, 28 Oct 2021 13:52:28 +0800 Subject: Re: [Question] ext4/xfs: Default behavior changed after per-file DAX To: Vivek Goyal , Ira Weiny Cc: "Darrick J. Wong" , Theodore Ts'o , adilger.kernel@dilger.ca, linux-xfs@vger.kernel.org, "linux-ext4@vger.kernel.org" , linux-fsdevel@vger.kernel.org, dan.j.williams@intel.com, Christoph Hellwig , Dave Chinner References: <26ddaf6d-fea7-ed20-cafb-decd63b2652a@linux.alibaba.com> <20211026154834.GB24307@magnolia> <20211026205730.GI3465596@iweiny-DESK2.sc.intel.com> From: JeffleXu Message-ID: <665787d0-f227-a95b-37a3-20f2ea3e09aa@linux.alibaba.com> Date: Thu, 28 Oct 2021 13:52:27 +0800 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:78.0) Gecko/20100101 Thunderbird/78.14.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit Precedence: bulk List-ID: X-Mailing-List: linux-ext4@vger.kernel.org On 10/27/21 10:36 PM, Vivek Goyal wrote: > [snip] > >> >> Is the biggest issue the lack of visibility to see if the device supports DAX? > > Not necessarily. I think for me two biggest issues are. > > - Should dax be enabled by default in server as well. If we do that, > server will have to make extra ioctl() call on every LOOKUP and GETATTR > fuse request. Local filesystems probably can easily query FS_XFLAGS_DAX > state but doing extra syscall all the time will probably be some cost > (No idea how much). I tested the time cost from virtiofsd's perspective (time cost of passthrough_ll.c:lo_do_lookup()): - before per inode DAX feature: 2~4 us - after per inode DAX feature: 7~8 us It is within expectation, as the introduction of per inode DAX feature, one extra ioctl() system call is introduced. Also the time cost from client's perspective (time cost of fs/fuse/dir.c:fuse_lookup_name()) - before per inode DAX feature: 25~30 us - after per inode DAX feature: 30~35 us That is, ~15%~20% performance loss. Currently we do ioctl() to query the persitent inode flags every time FUSE_LOOKUP request is received, maybe we could cache the result of ioctl() on virtiofsd side, but I have no idea how to intercept the runtime modification to these persistent indoe flags from other processes on host, e.g. sysadmin on host, to maintain the cache consistency. So if the default behavior of client side is 'dax=inode', and virtiofsd disables per inode DAX by default (neither '-o dax=server|attr' is specified for virtiofsd) for the sake of performance, then guest won't see DAX enabled and thus won't be surprised. This can reduce the behavior change to the minimum. > > - So far if virtiofs is mounted without any of the dax options, just > by looking at mount option, I could tell, DAX is not enabled on any > of the files. But that will not be true anymore. Because dax=inode > be default, it is possible that server upgrade enabled dax on some > or all the files. > > I guess I will have to stick to same reason given by ext4/xfs. That is > to determine whether DAX is enabled on a file or not, you need to > query STATX_ATTR_DAX flag. That's the only way to conclude if DAX is > being used on a file or not. Don't look at filesystem mount options > and reach a conclusion (except the case of dax=never). -- Thanks, Jeffle