Received: by 2002:a05:6a10:f347:0:0:0:0 with SMTP id d7csp349700pxu; Tue, 1 Dec 2020 12:52:09 -0800 (PST) X-Google-Smtp-Source: ABdhPJy/wCBeTkykjXJGskrvck7dg+vi6OA9T2MhDisJhjzGy5c50sZ+QjHKgo3r86kAlBj/Wj9p X-Received: by 2002:a17:906:3b5b:: with SMTP id h27mr4749000ejf.450.1606855929194; Tue, 01 Dec 2020 12:52:09 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1606855929; cv=none; d=google.com; s=arc-20160816; b=dfOlbs3eQLDUHkSX02DPlexglPn+XTmXihCkJdlY6//yjlHqv/yhMvM6kWNA/SSHga c9JuVZvHO7UdSQA/IaZGlklObc2Pjd9GBh7GhChl9ch/nJNaXGmkSn7yaKhqiLxu6nLY CW/c/r/EOeSIw84VpveAO5KmWrbaWAxLEr71DoFmrEoFxrIit4W5+n7oyW6rBn1opJR8 eVpBJokHLglL9mc1Bl+AuM690OIwOuCiU5CZe0epSkX1wkXphmqc6GrbBa7KnqXD4rRW KUtNNYZ2sj18RcU8AutCUMTiR7gLvNk9vIC1Tte+iGdkilwCU6m2veZe/0WwvxMWEeFY 8hzg== 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:dkim-signature; bh=38FF9xvt73XKnUpkOFgpB6GdwGCUNHg/lXcETcqJqJM=; b=krqH9JNt45U1N7zuDXan1/bBUmS5Y1M2s+CagPbdHWWaFts5NDERrug2D8BIDg23lg FAdSp7SHF+GNMrj36vblcTQu/hfs/b1MMuKpgNjkmwRQdWO3HEp425bryz7Lt7l1HWtZ MAJQ2YuRAoonJ0taXpp+KToA2FdJFyNaKSsToBo1ZpbQ/yAa9GyVqMZ+WKgrRCE/swNN Zgykx1A1j/k5Fo9Q8xxESnJNvLrL4PHhxu3WP0HyGGSQrPRujtnmnag8o1OCaWTH5e0B P7gQLSxMxzv3MW1AcVPewirByBplzU+oFhFTwbmPqoRrkme6Mzyh/VtlZXtRCk/4Frm7 V3QQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=dVLVm04h; 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=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id u2si633822ejo.423.2020.12.01.12.51.40; Tue, 01 Dec 2020 12:52:09 -0800 (PST) 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; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=dVLVm04h; 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=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727953AbgLAUvg (ORCPT + 99 others); Tue, 1 Dec 2020 15:51:36 -0500 Received: from us-smtp-delivery-124.mimecast.com ([63.128.21.124]:20034 "EHLO us-smtp-delivery-124.mimecast.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727483AbgLAUvg (ORCPT ); Tue, 1 Dec 2020 15:51:36 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1606855810; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=38FF9xvt73XKnUpkOFgpB6GdwGCUNHg/lXcETcqJqJM=; b=dVLVm04hW0J4Tt1NLrbB6IEtfjuKCOxxKCpZbY2n72oGtSYdsjW2BG0o49X20ed4FFR4qR 9lnsSmSJf8YjBT+nEVQZ+R/pObeA7YLToYRqp3XBQYFRIa/feRSS3+fxUWn59LdH+aRwAe ++seubfMdigWG+7yayCTb5ZREohd9w0= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-506-Pvsvy1TONwmm5e62aNgFyQ-1; Tue, 01 Dec 2020 15:50:06 -0500 X-MC-Unique: Pvsvy1TONwmm5e62aNgFyQ-1 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 4D321185E480; Tue, 1 Dec 2020 20:50:05 +0000 (UTC) Received: from liberator.sandeen.net (ovpn04.gateway.prod.ext.phx2.redhat.com [10.5.9.4]) by smtp.corp.redhat.com (Postfix) with ESMTP id 6A5845D6AD; Tue, 1 Dec 2020 20:50:04 +0000 (UTC) Subject: Re: [PATCH 2/2] statx: move STATX_ATTR_DAX attribute handling to filesystems To: Linus Torvalds Cc: Miklos Szeredi , Ira Weiny , David Howells , linux-fsdevel , linux-man , Linux Kernel Mailing List , xfs , Ext4 Developers List , Xiaoli Feng References: <05a0f4fd-7f62-8fbc-378d-886ccd5b3f11@redhat.com> From: Eric Sandeen Message-ID: <71eecee3-3fc9-d18d-8553-d8326f6d73b3@redhat.com> Date: Tue, 1 Dec 2020 14:50:03 -0600 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:78.0) Gecko/20100101 Thunderbird/78.5.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 Precedence: bulk List-ID: X-Mailing-List: linux-ext4@vger.kernel.org On 12/1/20 2:04 PM, Linus Torvalds wrote: > On Tue, Dec 1, 2020 at 8:59 AM Eric Sandeen wrote: >> >> It's a bit odd to set STATX_ATTR_DAX into the statx attributes in the VFS; >> while the VFS can detect the current DAX state, it is the filesystem which >> actually sets S_DAX on the inode, and the filesystem is the place that >> knows whether DAX is something that the "filesystem actually supports" [1] >> so that the statx attributes_mask can be properly set. >> >> So, move STATX_ATTR_DAX attribute setting to the individual dax-capable >> filesystems, and update the attributes_mask there as well. > > I'm not really understanding the logic behind this. > > The whole IS_DAX(inode) thing exists in various places outside the > low-level filesystem, why shouldn't stat() do this? > > If IS_DAX() is incorrect, then we have much bigger problems than some > stat results. We have core functions like generic_file_read_iter() etc > all making actual behavioral judgements on IS_DAX(). It's not incorrect, I didn't mean to imply that. Current code does accurately set the DAX flag in the statx attributes. > And if IS_DAX() is correct, then why shouldn't this just be done in > generic code? Why move it to every individual filesystem? At the end of the day, it's because only the individual filesystems can manage the dax flag in the statx attributes_mask. (That's only place that knows if dax "is available" in general, as opposed to being set on a specific inode) So if they have to do that, they may as well set the actual attribute as well, like they do for every other flag they manage... I mean, we could leave the statx->attributes setting in the vfs, and add the statx->attributes_mask setting to each dax-capable filesystem. That just felt a bit asymmetric vs. the way every other filesystem-specific flag gets handled. -Eric