Received: by 2002:a25:4158:0:0:0:0:0 with SMTP id o85csp4497057yba; Mon, 29 Apr 2019 22:27:33 -0700 (PDT) X-Google-Smtp-Source: APXvYqz4j++8paUbTvrlCpbZfFK0K02UOcziSAGu59JpzTaATXcun0JZX1dXMDYZV6KvgBVx30FE X-Received: by 2002:a63:af0a:: with SMTP id w10mr64028031pge.67.1556602053077; Mon, 29 Apr 2019 22:27:33 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1556602053; cv=none; d=google.com; s=arc-20160816; b=XXW5w4pzGXlM36KrSisrgOSii2rHFmXNPcXdcYJnea1ofpP2+OnpKaVQQGwFov324z SLYwj7QF6wDIO+ImDqOlds3a7Ipkfqt65LLUnJet5P6cvcJHrWtW2ppsZAgwoBC/L8a5 w46thiGuaeEepk1HCBnUB275wWXUwp7G4YPYG7wk1N0Y7Ck9PVqvjg5oWW/97MkeBK7q z8YGq73exdNI7UBCSM7UIWLLyFmWUohTs1wivUFDFdE21c6Lb74zE6KhiNRRab3d8npH c5ncTMKSF0rM58d7shPlQaq0/e+BU+7RxyabnwXhA7dCps6zEC6S1xKTObLuUSDdXsax WW7w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:to:cc:in-reply-to:date:subject :mime-version:message-id:from:dkim-signature; bh=Bpxrrn0nhxg0QxbDmzcOwQzwDv1LTHTm0Bu1+pUS7w8=; b=cZHAob7QI2v3U6tmwTdYC3QA0xKZ6e59lXWJV21YD+HiPuVfAVkIkGbjC89kBmYXo4 ExP5nTxwCmyhqOvqCgia0BopbL6i851aqVfO8+EOATn4E8COJzQDZ4BrNS9UJTPfccha 521OrAZb2gpm2dQyiAit5WylDvN//XLjlbzOo7tQKLQB0YBeQuOHO8dLzwhjLVpWnKdE xF4eiU0lt0Sn3gjbrp/P6iVaAJvUs1HrI3ylgoraGd5GSz1s0VtLkvqHCZu1KjLhbLoZ 1ptSn2+C0D7o0y8Ss0z03NS36BPdaeeXNZasnlp6VTLN2bWf/NJ/E1fiAJJc+vw24HHX dV5w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@dilger-ca.20150623.gappssmtp.com header.s=20150623 header.b="nO/HIlKt"; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id o33si5220031plb.230.2019.04.29.22.27.16; Mon, 29 Apr 2019 22:27:33 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@dilger-ca.20150623.gappssmtp.com header.s=20150623 header.b="nO/HIlKt"; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726083AbfD3F0Y (ORCPT + 99 others); Tue, 30 Apr 2019 01:26:24 -0400 Received: from mail-pg1-f194.google.com ([209.85.215.194]:39641 "EHLO mail-pg1-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725906AbfD3F0X (ORCPT ); Tue, 30 Apr 2019 01:26:23 -0400 Received: by mail-pg1-f194.google.com with SMTP id l18so6287987pgj.6 for ; Mon, 29 Apr 2019 22:26:22 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=dilger-ca.20150623.gappssmtp.com; s=20150623; h=from:message-id:mime-version:subject:date:in-reply-to:cc:to :references; bh=Bpxrrn0nhxg0QxbDmzcOwQzwDv1LTHTm0Bu1+pUS7w8=; b=nO/HIlKtfAK2/1SkYjs9tvdr0hQBtMHhY7aKlt/T59XLtvScCsjGuvSdoWwODP1Fnk g+y27oy0qEq3YmJhkAIzcoBj/FDGUGg1OmHRCyoHMXEvj7I1Ehr1BE63S0t5LbQ+FnP3 ZuUmJmrlvmbkugShZo1RZv89Qy4f3wYp4XSTSej/hfm1wGpp9O5ibgr41I7rHXulXmnV 9LmhdIyHB/TZbUkIkXJzL67/kmpRHd2uz03LuwTmfXQKOsWPx/Dw1O6NgYtADHgpe2Re 2UQYk4/EjLTNVNm6BJLTbZjpJD2gjapyhvzuDPBtxBxL74BbueTzkv9OREFXIcwG+a3I R9GQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:message-id:mime-version:subject:date :in-reply-to:cc:to:references; bh=Bpxrrn0nhxg0QxbDmzcOwQzwDv1LTHTm0Bu1+pUS7w8=; b=mDOG9MLJxx1Rb91HFmV1slUh7Tjmcq7Vl7dh6cLf+Xux10VrIdT0MWmDUvrUttvf3d vEjqktyNo3jwk+zHB5+M5rvmocBpNm3jArxI9HA54uKUycHUh6+E/s1b1Rlq8ZLdjP14 SBkJ49awGjad06WPcFheBHPA9KDwhmI8kbjd8j1aJQp71+7Rp474ulcIamnuF1ar3Vhr 3kbzg4bCyUuU88y/vAQqqv0X+rdoDvRaA5+QBHGmh7SC9e1//DyLuUdYnKJwh2TNdqgd 5br+tgXDA5mpEXRU7VquHFvH/9H+zR+E7jh9AJLjH50gvhf6u1u9kfxnidfYJVoOf5Ay 6TYg== X-Gm-Message-State: APjAAAV9f78cH699sS2dFEx8dJ4DGhGkabdQlA6GFMnDRhOoO6xkp5ib Tge4spQpcQVt5u/SsVBgwE/twog36do= X-Received: by 2002:a62:4852:: with SMTP id v79mr68254296pfa.72.1556601982356; Mon, 29 Apr 2019 22:26:22 -0700 (PDT) Received: from cabot-wlan.adilger.int (S0106a84e3fe4b223.cg.shawcable.net. [70.77.216.213]) by smtp.gmail.com with ESMTPSA id m8sm54492464pgn.59.2019.04.29.22.26.20 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 29 Apr 2019 22:26:21 -0700 (PDT) From: Andreas Dilger Message-Id: Content-Type: multipart/signed; boundary="Apple-Mail=_E49322AE-A695-47B8-8F15-BAD54F0C2D97"; protocol="application/pgp-signature"; micalg=pgp-sha256 Mime-Version: 1.0 (Mac OS X Mail 10.3 \(3273\)) Subject: Re: [RFC][PATCHSET] sorting out RCU-delayed stuff in ->destroy_inode() Date: Mon, 29 Apr 2019 23:26:15 -0600 In-Reply-To: <20190430042623.GJ23075@ZenIV.linux.org.uk> Cc: Linus Torvalds , linux-fsdevel , Linux List Kernel Mailing To: Al Viro References: <20190416174900.GT2217@ZenIV.linux.org.uk> <20190430030914.GF23075@ZenIV.linux.org.uk> <20190430042623.GJ23075@ZenIV.linux.org.uk> X-Mailer: Apple Mail (2.3273) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org --Apple-Mail=_E49322AE-A695-47B8-8F15-BAD54F0C2D97 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=us-ascii > On Apr 29, 2019, at 10:26 PM, Al Viro wrote: >=20 > On Mon, Apr 29, 2019 at 10:18:04PM -0600, Andreas Dilger wrote: >>>=20 >>> void *i_private; /* fs or device private = pointer */ >>> + void (*free_inode)(struct inode *); >>=20 >> It seems like a waste to increase the size of every struct inode just = to access >> a static pointer. Is this the only place that ->free_inode() is = called? Why >> not move the ->free_inode() pointer into inode->i_fop->free_inode() = so that it >> is still directly accessible at this point. >=20 > i_op, surely? Yes, i_op is what I was thinking. > In any case, increasing sizeof(struct inode) is not a problem - > if anything, I'd turn ->i_fop into an anon union with that. As in, >=20 > diff --git a/fs/inode.c b/fs/inode.c > index fb45590d284e..627e1766503a 100644 > --- a/fs/inode.c > +++ b/fs/inode.c > @@ -211,8 +211,8 @@ EXPORT_SYMBOL(free_inode_nonrcu); > static void i_callback(struct rcu_head *head) > { > struct inode *inode =3D container_of(head, struct inode, i_rcu); > - if (inode->i_sb->s_op->free_inode) > - inode->i_sb->s_op->free_inode(inode); > + if (inode->free_inode) > + inode->free_inode(inode); > else > free_inode_nonrcu(inode); > } > @@ -236,6 +236,7 @@ static struct inode *alloc_inode(struct = super_block *sb) > if (!ops->free_inode) > return NULL; > } > + inode->free_inode =3D ops->free_inode; > i_callback(&inode->i_rcu); > return NULL; > } > @@ -276,6 +277,7 @@ static void destroy_inode(struct inode *inode) > if (!ops->free_inode) > return; > } > + inode->free_inode =3D ops->free_inode; > call_rcu(&inode->i_rcu, i_callback); > } This seems like kind of a hack. I guess your goal is to have = ->free_inode accessible regardless of whether the filesystem has installed its own = ->i_op methods or not, and i_fop is no longer used by this point. That said, this seems better than increasing the size of struct inode. > diff --git a/include/linux/fs.h b/include/linux/fs.h > index 2e9b9f87caca..92732286b748 100644 > --- a/include/linux/fs.h > +++ b/include/linux/fs.h > @@ -694,7 +694,10 @@ struct inode { > #ifdef CONFIG_IMA > atomic_t i_readcount; /* struct files open RO */ > #endif > - const struct file_operations *i_fop; /* former = ->i_op->default_file_ops */ > + union { > + const struct file_operations *i_fop; /* former = ->i_op->default_file_ops */ > + void (*free_inode)(struct inode *); > + }; Cheers, Andreas --Apple-Mail=_E49322AE-A695-47B8-8F15-BAD54F0C2D97 Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename=signature.asc Content-Type: application/pgp-signature; name=signature.asc Content-Description: Message signed with OpenPGP -----BEGIN PGP SIGNATURE----- Comment: GPGTools - http://gpgtools.org iQIzBAEBCAAdFiEEDb73u6ZejP5ZMprvcqXauRfMH+AFAlzH3HgACgkQcqXauRfM H+B8Uw/+Pe3e89BpYfhV3O4jATQofqb9PH/+i8TAZmKTVOC09IO5ole1zpaWHGV+ 8FQmrVvHUrUZLvz3GZJYAA7djWqJHIN58yPUllps35f6SGqfj54rEwwq3QAFSqFR kOiDHHtWpASu0oVRDG1Lw0xijx8wrTmfmdWOTTYSL0o58uFCFhcuBdU9oaBi/Wrs 9RHwrQb4pffl6aCMP6FTVp+DdqVtIRMQ4UNOKrJiwa8SLuJSCw1Nwj7tzwOIXu7e z2R9sFUQHOVx1r7cOgCrP+zpIZTNmOI7lsJnPUwgod5i4lLJqBylrGmz9B/lWbln 2PPtaUkFbB1VVnhxnz4K06Fp2AEE3S8DEzAwEyitCnb+FKvV9fCdRC/m/mx1pFhj Icc/L+2F8xuYcw1EqB/Nyc2UAVs7VgpUEnedUUwBWjg+Md5zT+BeZY6qOxzwGhXq vp3O2hSlRhNjgsGVpkWt7awa6JlUbvw1F76ktl2tiqiWl45X75FOS2RyjLxFt8Yw FIqp29O8HauMdaEQb1CXvgemvnzM3f6om8NCN6q+zAz8RUjwK6N1x+z0f95iHEq9 ZXxY4KYHW3cjhlhKyZpiowqlMq+1I43NWhJFhMi2AVrEzDBBleBSdH617/R6hNbd XJMyvjDo67gvOJ1UJeX+wAISpQz5M6l6EEZqoe/GcZTEtR9UNfw= =a4F4 -----END PGP SIGNATURE----- --Apple-Mail=_E49322AE-A695-47B8-8F15-BAD54F0C2D97--