Received: by 2002:a5d:925a:0:0:0:0:0 with SMTP id e26csp923359iol; Thu, 9 Jun 2022 17:44:00 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxxTc9Ztq1F9fznEWLHFXOcFQUYDLhwNjEsWgdFcUtX7H/Jvd9Le35VEALGAPfAGFSOE/Bp X-Received: by 2002:a17:907:e91:b0:707:c7af:93aa with SMTP id ho17-20020a1709070e9100b00707c7af93aamr39275172ejc.382.1654821839958; Thu, 09 Jun 2022 17:43:59 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1654821839; cv=none; d=google.com; s=arc-20160816; b=lbmU06c7e6Il8huEg646f6kzS2BgYKD3FXgl/tSyUjFuFzQkpqkv2numMS1GAcNHQf dQgGwypAWuGDBkDnznzzKeNkDTI1wYUTbgvGyOFLNwHH0bJLL929ipctFfXFFM6SBQNu k+7TdSTsaHuIAoEJ3AVh3oodsJOxv9nHcO3g0jQQ9V0/SsaqwryGpauj065XYmkbZySj 1X1ArOWycWgviYxF7bKWqm3ChN+V18+aqG54nYIH+tvtGxellRfQFT9s+fDr5vpJg/6n aBXGqoZHMAhtr47JgCYh+sMAyhD7WfAZV3y8Q/EJre4LreKabWNKiAso/Zwws5m+BKOi khYw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=HZmJDZ9hQK0bNfmPnAorsPdU9x3OOxEaC2i3SyIrcpc=; b=wZFPzF19uTYY/G1yn8e/aBSjVm95lmcTHybCNTtN/+V/wLeKpWTzKm+aFOUa1ABlCg 41/aws146auuXaBVWAR/Yp2u1AWUYJ0FgEMbnvubPfJGjM4oCHY6AqpAO4N62nBL4ZIW xsoPy9UOpNNZdRehhSve4Ssqt0N4VPWdWBgbKrxea1A6Uu1Dhsqpok+ainN3WDhyI2sD TTkTmCg4Ic1l0FHttvHkiQKJQH8bw04fUYnzBfclUgWJ6s9sLqJlefvmSpfx0IkX11rj uMPahHdMyogAqzkbM6Yh16GoS4jm9ZFY/7BX4X4DNudmpmatxOq0CchLrtpaKZEGwM3S F4hw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=AQ6Bpzpl; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id ne12-20020a1709077b8c00b0070fc7c9d71dsi7315377ejc.989.2022.06.09.17.43.30; Thu, 09 Jun 2022 17:43:59 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=AQ6Bpzpl; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-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 S237672AbiFIX7n (ORCPT + 99 others); Thu, 9 Jun 2022 19:59:43 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49292 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229924AbiFIX7k (ORCPT ); Thu, 9 Jun 2022 19:59:40 -0400 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id D6DA0237943 for ; Thu, 9 Jun 2022 16:59:36 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1654819175; 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: in-reply-to:in-reply-to:references:references; bh=HZmJDZ9hQK0bNfmPnAorsPdU9x3OOxEaC2i3SyIrcpc=; b=AQ6BpzplLkPCPtjRb/jpDfYmvcvsO5kmkGtchoueXPIITBBRIjFIWlMPo8DFxn0T8Qnf32 1sVc43YT4NPJF+zD2+euv1CPKS4cLpigPO0/uxDQMKqsyNRXm6gSvtR8DjasTs6m9pQ+OB 0Dv0VRATZa1RTZ0qcBfyoXptzphTHn0= Received: from mimecast-mx02.redhat.com (mx3-rdu2.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-657-c-TqIG6yNmK9PlqI69ymhQ-1; Thu, 09 Jun 2022 19:59:32 -0400 X-MC-Unique: c-TqIG6yNmK9PlqI69ymhQ-1 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.rdu2.redhat.com [10.11.54.3]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id D795E1C04B4F; Thu, 9 Jun 2022 23:59:31 +0000 (UTC) Received: from rh (vpn2-54-75.bne.redhat.com [10.64.54.75]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 361B81121314; Thu, 9 Jun 2022 23:59:31 +0000 (UTC) Received: from localhost ([::1] helo=rh) by rh with esmtps (TLS1.3) tls TLS_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1nzS3k-00H7Qv-34; Fri, 10 Jun 2022 09:59:28 +1000 Date: Fri, 10 Jun 2022 09:59:25 +1000 From: Dave Chinner To: Linus Torvalds Cc: David Howells , Kees Cook , Philipp Zabel , Shawn Guo , Sascha Hauer , Fabio Estevam , Sven Schnelle , Heiko Carstens , Vasily Gorbik , Alexander Gordeev , Linux Kernel Mailing List Subject: Re: [PATCH] s390: disable -Warray-bounds Message-ID: References: <20220422134308.1613610-1-svens@linux.ibm.com> <202204221052.85D0C427@keescook> <202206081404.F98F5FC53E@keescook> <4147483.1654784079@warthog.procyon.org.uk> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Scanned-By: MIMEDefang 2.78 on 10.11.54.3 X-Spam-Status: No, score=-3.3 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, SPF_HELO_NONE,SPF_NONE,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Jun 09, 2022 at 11:20:02AM -0700, Linus Torvalds wrote: > On Thu, Jun 9, 2022 at 7:14 AM David Howells wrote: > > > > Note that Dave Chinner would rather I converted code like: > > > > struct myfs_inode *myfsinode = xyz; > > myfsinode->netfs.inode.i_ino = 123; > > > > to something like: > > > > struct myfs_inode *myfsinode = xyz; > > struct inode *inode = VFS_I(myfsinode); > > inode->i_ino = 123; > > > > where the translation is wrapped inside a VFS_I() macro in every filesystem > > and wants this across all filesystems. > > What? No. That's absolutely disgusting. > > Maybe I'm mis-undestanding. Perhaps, because I think what I said looks very different when taken out of context. I saw a heap of different implementations of the same thing with no consistency across them (i.e. inode container definitions) and a mess of a patch to convert them without solving the problem that there's no consistent convention for doing filesystem inode -> VFS inode container conversion > The usual way filesystems should handle this is that they have their > own inode information that contains a 'struct inode', and then they > have an inline function to go from that generic VFS inode to their one > using "container_of()". > > And yeah, maybe they call that container_of() thing MYINODE() or > something, although I think an inline function without the ugly > all-uppercase is right. Right, BTRFS_I(), EXT4_I(), F2FS_I(), AFS_FS_I(), P9FS_I(), etc. It's a convention, it dates back to macro days (hence upper case even though most are static inlines these days), and it obvious no matter what filesystem code I read that when I see this XXX_I(inode) convention I know the code is accessing the filesystem inode in the container, not the VFS indoe. > But the way they go the other way is literally to just dereference the > inode that they have, ie they just use a > > if (S_ISREG(inode->vfs_inode.i_mode)) .. The problem with this is that we have very similar names in both the VFS inode and the filesysetm inodes (e.g. i_flags), and without a clear demarcation of which inode is being referenced it can lead to confusion and bugs. > kind pattern. There's no reason or excuse to try to "wrap" that, and > it would be a big step backwards to introduce some kind of VFS_I() > macro. If the result of adding a helper convention is that every reverse inode container resolution looks identical across all filesystems, then we no longer have to know the details of the fs specific container to get the conversion right. All the code across all the filesystems would look the same, even though the wrapper would be different. We do helper conversions like this all the time to make the code easier to read, understand and maintain, so I really don't see why this would be considered a step backwards.... > There's also no reason to make that generic. At no point should you > ever go from "random filesystem inode" to "actual generic VFS inode" > in some uncontrolled manner. We never do any conversions in an uncontrolled manner. We often need to go from fs inode to vfs inode because we are deep in filesystem implementation code passing around filesystem inodes, but the piece of information we need to access is stored in the VFS inode (e.g. uid, gid, etc). That's what this netfs inode container was requiring in the patchset... > But maybe Dave is talking about something else, and I'm missing the point. Perhaps - my comment was not about the VFS_I() name or implementation; I used it simply because I can point at code that uses it as an example of having a symmetric, easily recognisable convention. My point was that the fs inode to vfs inode conversion is a common operation performed across all filesystems that lacks any consistency in implementation. Some filesystems use a symmetric API for these container conversions and so I was simply suggesting that converting them all to use a common symmetric convention would simplify the maintenance of filesystem code in future and make it easier for other people to understand... Cheers, Dave. -- Dave Chinner dchinner@redhat.com