Received: by 2002:a25:7ec1:0:0:0:0:0 with SMTP id z184csp3690493ybc; Thu, 21 Nov 2019 12:09:47 -0800 (PST) X-Google-Smtp-Source: APXvYqxZ84Stv5SNJv/S1mtVKuJCpaelfdYEmUc+JNohBwl8/z4LFFlK0Cp2b256MlfrySiMmH4q X-Received: by 2002:adf:d4d0:: with SMTP id w16mr13581717wrk.184.1574366986966; Thu, 21 Nov 2019 12:09:46 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1574366986; cv=none; d=google.com; s=arc-20160816; b=Gi7JxZweEn3JTdGX2izkUpIfYNv00n7KrVNGECCMoe5Jj9+zL3c3mtNxxKx85jIibF LexrUHuzi2YWnZBkvi49pta9q4tPqgh+414Ci6fpVrxA6vklwgWOiJsd/t2e/B4xwgy5 MMaEPt80AtVwxQ7pV8j5I9jIZKN2WDomUZZ/SFALbZLblH5NPLKR1qAvdtPVd5bDz6Gp F9Hh5kNp1l0nRaq5wd2ghItY5V6RDDZPgK+YjaqcaEn68sZE2sV/ZvE2JACo+kKPwiaA Gn/h8On2coHt5oDVYNuQ4Uxsk9EEVqYV1Pe8MzRPDAZ2tdVZSWap9+uUR9EZ8P1DW50v SlSw== 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=7gJkYA2Ya9RG5lGDwn1afx4TWUN9AxI8xhu9u772h5Y=; b=0sIuY60PIxagoTTAsOOZ1IGRDgkiE2yy7g/zcI8mRngvgKSyEhLHvjwvF1fggZCIo6 DctCbZFftSNwVZRN/2r/vt4QUPi9BjNFjvedzSVLadSsxU9/YrcYKQELCFZN17ItOQLZ ITHYwpUs8CKCayMxv/8V+qsurVV51baYHxVbaM9jY/s/wVaGp/0tk+XLd3Z+Ml8KERL+ F+75T4XTOagsyYFOuVswpnNB5T+2ucQNdRKjza0kKtb+w07Qsn4I5NpFkY2W6ohvSqJS L0327Z0D3G83IMxc7xYoXiXCFA1JqkaVaV9kZNpKRrpyw5LegSTWjO5a2LoHIqw/YvMp MZzQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=WWaVFGqW; 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 f21si2657567ede.253.2019.11.21.12.09.21; Thu, 21 Nov 2019 12:09:46 -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=WWaVFGqW; 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 S1726792AbfKUUHr (ORCPT + 99 others); Thu, 21 Nov 2019 15:07:47 -0500 Received: from mail-pj1-f68.google.com ([209.85.216.68]:33027 "EHLO mail-pj1-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726379AbfKUUHr (ORCPT ); Thu, 21 Nov 2019 15:07:47 -0500 Received: by mail-pj1-f68.google.com with SMTP id o14so1994857pjr.0 for ; Thu, 21 Nov 2019 12:07:46 -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=7gJkYA2Ya9RG5lGDwn1afx4TWUN9AxI8xhu9u772h5Y=; b=WWaVFGqW2/oLxe+xGDL8ESIk7ySRmIkSvNHhrf3ay4rMeCqCreUEnGYrb3YqkcRzo4 yRUMbJqjYpaWyd/M3ApB49phxSn22Tkt/DEwr2CVkF2PVed8jfyG2lSW7K3zDd33oJzF tQIOItlo/zsfuWmI7lb647H81Tr6LFN6RYD/3JCGBtVLLR6G5aPrpY6ZapVYE9oA/qPW a7wk3oS+mOfc0L7UWgYe3GNkXEndoeAsEE1wla1/BHD9tneTq8XfW6orHSB6TWBr3KUp TLHs6XQA789q2a8MMiZtp/LM3c06I0HNlkUd1vXg2LJ2ukqy+jS41qevVnmv5kaV1rsg 3/zg== 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=7gJkYA2Ya9RG5lGDwn1afx4TWUN9AxI8xhu9u772h5Y=; b=dQ9OASASzSQlhPckDsirFjeaOVFn86MuEAmKFjSQ0lrKXjIVjI0syb6d5ZXNw30rzu pIP8BIIqODFuaH0c0O0eIjsJ0trNVh1r9CUp5/YSGBrFTgIWfrDWVpzGBfBfE84i0tSm aGMXu4gTf4cyTODMBKIO08dwPJcbxkLyq7HW/C2lvHjAi8ZTNoly7hhuJRgYKe5C6ulv /abW9I320aCuwPH9sfPWJEo5EL4bhi5GjQgLth1xHXH32IZuP0T/4+rof7hbgvcW3OJW XoAtLZK9oCjgaku4BOQY5n17tUeU6SdjXzlSK79ryp5BFN6f5DgFKVZsHvAB3gDINTQW nEIA== X-Gm-Message-State: APjAAAWwZIeKUgm/luIXxlU7fIwkn2oypDyVl0Hy2N+rVRvcYoCK4CQo pXWnm+LHSmfuaxQ5pw/qv52QWw== X-Received: by 2002:a17:902:8502:: with SMTP id bj2mr10719141plb.303.1574366865400; Thu, 21 Nov 2019 12:07:45 -0800 (PST) Received: from [100.112.92.218] ([104.133.9.106]) by smtp.gmail.com with ESMTPSA id b24sm4411116pfi.148.2019.11.21.12.07.44 (version=TLS1 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Thu, 21 Nov 2019 12:07:44 -0800 (PST) Date: Thu, 21 Nov 2019 12:07:43 -0800 (PST) From: Hugh Dickins X-X-Sender: hugh@eggly.anvils To: "J. R. Okajima" cc: Hugh Dickins , "zhengbin (A)" , Matthew Wilcox , viro@zeniv.linux.org.uk, linux-mm@kvack.org, linux-kernel@vger.kernel.org, houtao1@huawei.com, yi.zhang@huawei.com Subject: Re: [PATCH] tmpfs: use ida to get inode number In-Reply-To: <32188.1574336426@jrobl> Message-ID: References: <1574259798-144561-1-git-send-email-zhengbin13@huawei.com> <20191120154552.GS20752@bombadil.infradead.org> <1c64e7c2-6460-49cf-6db0-ec5f5f7e09c4@huawei.com> <32188.1574336426@jrobl> 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 Thu, 21 Nov 2019, J. R. Okajima wrote: > Hugh Dickins: > > Internally (in Google) we do rely on good tmpfs inode numbers more > > than on those of other get_next_ino() filesystems, and carry a patch > > to mm/shmem.c for it to use 64-bit inode numbers (and separate inode > > number space for each superblock) - essentially, > > > > =09ino =3D sbinfo->next_ino++; > > =09/* Avoid 0 in the low 32 bits: might appear deleted */ > > =09if (unlikely((unsigned int)ino =3D=3D 0)) > > =09=09ino =3D sbinfo->next_ino++; > > I agree with that "per superblock inum space", but I don't see your > point. How can you manage it fully? I mean how can you decide whether > the new inum is in use or not? > For example, > - you create a file which is assigned inum#10. > - you or other people create and unlink over and over on the same tmpfs. > - then sbinfo->next_ino will become zero, skipped, ok. > - and then it will be 10. > I don't think you want to share the same inum by two inodes. 64 bits. I haven't done the arithmetic to work out the amusing number, but zhengbin mentioned the script taking 10 days to duplicate an inode number in 32 bits, so: a larger number of years than I need to care about. > > Moreover, SysV SHM uses tmpfs and shmget(2) overwrite inum internally. > It will be another seed of a similar problem. I was totally ignorant of that peculiarity in ipc/shm.c, thanks for alerting me to it. But it doesn't affect what we're doing in tmpfs, and apparently suits the users of SysV SHM: I don't see any need to worry about it. Hugh