Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp726333ybl; Wed, 8 Jan 2020 04:56:59 -0800 (PST) X-Google-Smtp-Source: APXvYqxXlxZ+enMYOd1ewU47YbOA86e3d4XKsdNJFoNIeVMwo7g97n1gNiFWiJycrbj4nQ3klupR X-Received: by 2002:a05:6808:b1c:: with SMTP id s28mr2948616oij.2.1578488219139; Wed, 08 Jan 2020 04:56:59 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1578488219; cv=none; d=google.com; s=arc-20160816; b=lqDFo/gcAKyjZNMCOPAUzcKi1oFlFY6Fmz4VDJ7fixlTnWvh5/TWGQo+jNePLSGAzw 44v+Rk//WqI2dIl+y6wS466X7+OOPEIfrgFUwswiP4dHdCEL/KGYaUChrdeUhKL3eikE 4K6WIsqf9PLODzNOBPzgwHPgNABdIHnoEW22gThPU7PkFm1sVaFhQMQL/JptO5T/vN8d Ml3wGI+iNaD7yf4sGVYayeL1BiP3z5xORUfedDeYWcnGcxO+sohLoLgfOzDkxtX+0GAO q21+BrIfoG4IJ5ihHlI9vY8A3vE71Rp6L/DRHajl7IBv0P0p1XBfv47q/yiMgnT2ZNks ciRA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:user-agent:references :message-id:in-reply-to:subject:cc:to:from:date:dkim-signature; bh=MN2cXAliraNErMytcQEiHA1DpubOJVOt0C1yY2AdeAE=; b=oVFJBSesSTyYr8uF7f6w2OE2NHoinBLQhQ2gaW4cL0Cn9+Tfbi4zhB2RWYFfUYXMCc XXfrgk1NHuQiIRrYZ+vD7S9F8ExXerJIjhvMX/3t26s9JrvPFHxTTV8wPOC0Z4uE/m6G YxY9kA4vmHNwvPQXm5BAAkhZPUNUMe22FvtQx64mhExPLplq3cFzzPv8OBji7hAk3vHp /kjDQXSS2fxwOzDboctxyFUt85HrQzz5sR0bEzMg2Q3idOffVjfWv6rywXsG+ywus2j8 kg+aKfXrVrjWjcCrtatmFy91YAeJYhIa2PloKNXPH06JdtwJfaqFDWJ2gwJqvNvRqVxn qfWw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=wG3zHLtX; 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; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id o16si1771543otp.289.2020.01.08.04.56.46; Wed, 08 Jan 2020 04:56:59 -0800 (PST) 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=@google.com header.s=20161025 header.b=wG3zHLtX; 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; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727946AbgAHK7P (ORCPT + 99 others); Wed, 8 Jan 2020 05:59:15 -0500 Received: from mail-oi1-f193.google.com ([209.85.167.193]:45133 "EHLO mail-oi1-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726290AbgAHK7O (ORCPT ); Wed, 8 Jan 2020 05:59:14 -0500 Received: by mail-oi1-f193.google.com with SMTP id n16so2206986oie.12 for ; Wed, 08 Jan 2020 02:59:14 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=date:from:to:cc:subject:in-reply-to:message-id:references :user-agent:mime-version; bh=MN2cXAliraNErMytcQEiHA1DpubOJVOt0C1yY2AdeAE=; b=wG3zHLtX0FTDuVGB48Ua3E3u7yYmSpghevtOvVV4FA5G/ldz3MPFPHyCjcCv1/DW1S 3+m61Tuequ2T1V3Citkfi/5gMEZjU3FSI/Cci2kszcw6QFy99z5pYpSW4vLadxT4XBUq zK49Liv5klhkpMKtLP/+soDQNlmVQjvq+8yFvXjPui+S2cm0TxM+IT9iX6vW97BAuSzh h+14nlny/zZkyCVmKLQslRx2wFPnKGFagzWn/c/F6YJAQkCw3LA1bq7oNGbWl1lnBeNW 8jTB+ryPX+AlQn50CSzsrJ/V2qa0wgZI5CHanL/68LDXJGdOrUVtOOTlpe8gX+M01BHa oeHQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:in-reply-to:message-id :references:user-agent:mime-version; bh=MN2cXAliraNErMytcQEiHA1DpubOJVOt0C1yY2AdeAE=; b=X8WwiKqTqO26HCKwuhZCX7jpVjtQ5HeST3CR+Z2EWDrksIHSzlQexYl2/3HjZfvXCq mlrQ2qRJACb7hZZeE6DVj+2a/CRbMnYsAQICFjNqHiEOSagVVr8eKz2xgSwjUGO7QHGL svFqrZglPVk23XOYeVlUdPYauAJkEnQifHcvOm8qKB3lnoOPtlZGTpvMzxqmsFseWCGy DEx0VSY55e97E8qmwAn9pWweRmPLvWr1fGHrY5wdddbIttY1XiwGE5OPWFRK40/b07bk ZYD2khSTVxV/mSvVmAm7gUSCckfkHeaccLfxw0qWy8AuZZreX+L5pifG9AVaA4P5qUVr JGeg== X-Gm-Message-State: APjAAAXi1WsTY3duFc2N/FFgFkBUpjJfKiW8/y1prrGkgG9qJvyXN1tB 0gu4yth3zEXMefmS8teo02cOYA== X-Received: by 2002:a05:6808:a11:: with SMTP id n17mr2484062oij.94.1578481153648; Wed, 08 Jan 2020 02:59:13 -0800 (PST) Received: from eggly.attlocal.net (172-10-233-147.lightspeed.sntcca.sbcglobal.net. [172.10.233.147]) by smtp.gmail.com with ESMTPSA id r205sm973416oih.54.2020.01.08.02.59.11 (version=TLS1 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 08 Jan 2020 02:59:12 -0800 (PST) Date: Wed, 8 Jan 2020 02:58:52 -0800 (PST) From: Hugh Dickins X-X-Sender: hugh@eggly.anvils To: Amir Goldstein cc: Hugh Dickins , Chris Down , "zhengbin (A)" , "J. R. Okajima" , Linux MM , Andrew Morton , Al Viro , Matthew Wilcox , Jeff Layton , Johannes Weiner , Tejun Heo , linux-fsdevel , linux-kernel , kernel-team@fb.com Subject: Re: [PATCH v5 1/2] tmpfs: Add per-superblock i_ino support In-Reply-To: Message-ID: References: <91b4ed6727712cb6d426cf60c740fe2f473f7638.1578225806.git.chris@chrisdown.name> <4106bf3f-5c99-77a4-717e-10a0ffa6a3fa@huawei.com> User-Agent: Alpine 2.11 (LSU 23 2013-08-11) MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, 7 Jan 2020, Amir Goldstein wrote: > > I vote in favor or best of both patches to result in a simpler outcome: > 1. use inop approach from Hugh's patch > 2. use get_next_ino() instead of per-sb ino_batch for kern_mount > > Hugh, do you have any evidence or suspect that shmem_file_setup() > could be contributing to depleting the global get_next_ino pool? Depends on what the system is used for: on one system, it will make very little use of that pool, on another it will be one of the major depleters of the pool. Generally, it would be kinder to the other users of the pool (those that might also care about ino duplication) if shmem were to cede all use of it; but a bigger patch, yes. > Do you have an objection to the combination above? Objection would be too strong: I'm uncomfortable with it, and not tempted to replace our internal implementation by one reverting to use get_next_ino(); but not as uncomfortable as I am with holding up progress on the issue. Uncomfortable because of the "depletion" you mention. Uncomfortable because half the reason for ever offering the unlimited "nr_inodes=0" mount option was to avoid stat_lock overhead (though, for all I know, maybe nobody anywhere uses that option now - and I'll be surprised if 0-day uses it and reports any slowdown). Also uncomfortable because your (excellent, and I'd never thought about it that way) argument that the shm_mnt objects are internal and unstatable (that may not resemble how you expressed it, I've not gone back to search the mails to find where you made the point), is not entirely correct nowadays - memfd_create()d objects come from that same shm_mnt, and they can be fstat()ed. What is the likelihood that anything would care about duplicated inos of memfd_create()d objects? Fairly low, I think we'll agree; and we can probably also say that their inos are an odd implementation detail that no memfd_create() user should depend upon anyway. But I mention it in case it changes your own feeling about the shm_mnt. > > Not-Yet-Signed-off-by: Hugh Dickins > > > > 1) Probably needs minor corrections for the 32-bit kernel: I wasn't > > worrying about that at the time, and expect some "unsigned long"s > > I didn't need to change for the 64-bit kernel actually need to be > > "u64"s or "ino_t"s now. > > 2) The "return 1" from shmem_encode_fh() would nowadays be written as > > "return FILEID_INO32_GEN" (and overlayfs takes particular interest > > in that fileid); yet it already put the high 32 bits of the ino into > > the fh: probably needs a different fileid once high 32 bits are set. > > Nice spotting, but this really isn't a problem for overlayfs. > I agree that it would be nice to follow the same practice as xfs with > XFS_FILEID_TYPE_64FLAG, but as one can see from the private > flag, this is by no means a standard of any sort. > > As the name_to_handle_at() man page says: > "Other than the use of the handle_bytes field, the caller should treat the > file_handle structure as an opaque data type: the handle_type and f_handle > fields are needed only by a subsequent call to open_by_handle_at()." > > It is true that one of my initial versions was checking value returned from > encode_fh, but Miklos has pointed out to me that this value is arbitrary > and we shouldn't rely on it. > > In current overlayfs, the value FILEID_INO32_GEN is only used internally > to indicate the case where filesystem has no encode_fh op (see comment > above ovl_can_decode_fh()). IOW, only the special case of encoding > by the default export_encode_fh() is considered a proof for 32bit inodes. > So tmpfs has never been considered as a 32bit inodes filesystem by > overlayfs. Thanks, you know far more about encode_fh() than I ever shall, so for now I'll take your word for it that we don't need to make any change there for this 64-bit ino support. One day I should look back, go through the encode_fh() callsites, and decide what that "return 1" really ought to say. It's inconvenient, I'm sorry, but I shall have to go quiet again for a few days - I'm here, but cannot afford to split my attention. Hugh