Received: by 2002:a05:7412:3290:b0:fa:6e18:a558 with SMTP id ev16csp845549rdb; Fri, 26 Jan 2024 12:28:49 -0800 (PST) X-Google-Smtp-Source: AGHT+IHfFBWztJSvkYRJtl8YoMyqp8UySeYwqt11AwbiXgonL7wIiS3pQH5WiczMQSt3jJrhsnxN X-Received: by 2002:a17:902:cec7:b0:1d7:2325:ba46 with SMTP id d7-20020a170902cec700b001d72325ba46mr405419plg.7.1706300929045; Fri, 26 Jan 2024 12:28:49 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1706300929; cv=pass; d=google.com; s=arc-20160816; b=Gsczt6pcnkwY+lfNK+OvTHYZigX/rNCF0Pn1q12vux7pyT+KZEAi9g1FEPBHnzdATM a9oHMaiIgMvTdr1aD+pHu+o5poiX+KylZbnA9y4F4JOGl6gysXoByG6oFllfwCMJzuLX Mk6LzecS52dhEx9tONEglqm+GQyiyNCSKqARAyMa0kA1uQVbij/SAc9+iCFPlT3jeXTH /vSpAIyWXfmdR15ZKu+BsgqeG9zoInmVK4ira0YqVxURDN8tfzfI1zGRSxEJI4ZrGgU4 QFiGCyYt9KFO8dgVR6j0wHvRjeq7ZHVrrInR9Iqv8THMo9ufPchK3Hile4WZihHKRDLy A13w== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:user-agent:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:date:message-id:dkim-signature; bh=1NsdJCUMRWCKNx7mgY42T81UBfscTRCGhHQhid8v64U=; fh=yAAJKOQLLeiIgF4GlNSmdnYLYyAHU+bu1a0p2xIBmxw=; b=OhilwiiOtmIUN0gXBIOLkV0uiUNXhMJxLRcUaX07UjCxDJZnh5AejK46N0SoGqbZzu MusZclza+yprm+JEbCcp9OtROtxTYjFYVrkbPRjVIHIibKSnNsEUa6VL08mhp9yAKr17 CNkodpZ0/k714bwrNqyEt435E0gN81NQIU0Vfqneb2ynA69XLEYc5Lk0ttbBKIJtMaaB dMviMMoZXTlk74MBASs/OpOTKT1ahU3D/OjrGzkCmKDOefCKSEUGaNsdymZc7OVi2BIN RV6SQf6yhCJEUE//1VA0Q0xF/xMIe0UkyDy6Csh60h4YgT5oQMa5qhIDZjGbAxbULF9u GraQ== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@efficios.com header.s=smtpout1 header.b=S7Fn+2q7; arc=pass (i=1 spf=pass spfdomain=efficios.com dkim=pass dkdomain=efficios.com dmarc=pass fromdomain=efficios.com); spf=pass (google.com: domain of linux-kernel+bounces-40622-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-40622-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=efficios.com Return-Path: Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [147.75.48.161]) by mx.google.com with ESMTPS id j7-20020a170902da8700b001d6ee361679si1690626plx.489.2024.01.26.12.28.48 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 26 Jan 2024 12:28:49 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-40622-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) client-ip=147.75.48.161; Authentication-Results: mx.google.com; dkim=pass header.i=@efficios.com header.s=smtpout1 header.b=S7Fn+2q7; arc=pass (i=1 spf=pass spfdomain=efficios.com dkim=pass dkdomain=efficios.com dmarc=pass fromdomain=efficios.com); spf=pass (google.com: domain of linux-kernel+bounces-40622-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-40622-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=efficios.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sy.mirrors.kernel.org (Postfix) with ESMTPS id F2079B210E3 for ; Fri, 26 Jan 2024 20:24:33 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 19EB022F1F; Fri, 26 Jan 2024 20:24:23 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=efficios.com header.i=@efficios.com header.b="S7Fn+2q7" Received: from smtpout.efficios.com (smtpout.efficios.com [167.114.26.122]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id B288023742; Fri, 26 Jan 2024 20:24:18 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=167.114.26.122 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706300662; cv=none; b=NvQEpN6tgb7Fbmnuv+cyM3UUmqrcN54wJsCzgwU9C5mUrlMQ+1mprq3QuELkga6zraiYJi5VaDATSqREAMtSx8zkkuJ+Ene9PbiBG23CTr17SFMg7zGwijLTj40sP2RA/ovSVKLRGv/7RDS8eEkMtVDfUalsf9MJ+viLV5yTdYw= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706300662; c=relaxed/simple; bh=MewhNM/AnMv4gHjnvJ36YA4iTJBmyf65fpyPqm7gGSs=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type; b=BzkXHZnCKDn+ZIwd/Jq5WGt3IZWQJlKyTfB7I4dDdjuE2A+MlEtscECYfjumeHET+VawHY7yodu7wddHANYelX+gw5E5apnuTDVu7qgSRUgECCbErauAxVlL1MIb2c7Asa9iUmIJPbMLmMwAaEncxVi2uv792HdOEhvexjdvMBs= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=efficios.com; spf=pass smtp.mailfrom=efficios.com; dkim=pass (2048-bit key) header.d=efficios.com header.i=@efficios.com header.b=S7Fn+2q7; arc=none smtp.client-ip=167.114.26.122 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=efficios.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=efficios.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=efficios.com; s=smtpout1; t=1706300657; bh=MewhNM/AnMv4gHjnvJ36YA4iTJBmyf65fpyPqm7gGSs=; h=Date:Subject:To:Cc:References:From:In-Reply-To:From; b=S7Fn+2q7L/WWRHKaUQXYUdCAsI6rfmQG4XyHNpKQPkFyVLEAJNq2z2HSZjCtpUqkf U9B0tYXTnMcrRX0KND/ckeT8yez4CcuGxQ/QWstKiniki8Q4bz3agUHSljiU+a4n4i T+alU+hcHOfcTUTy47nhW6PNk91A2jtZcVHqVzmwTRC4RVwvX+Gow5EanLbhKmdbx0 Zf0QGltHsQABkO40/h+PRbdnUPPFKuXxuQcQLUoEbz97nInjR2iHPWtHJNmH52nzKi XiBHWUj9xGkSOxa1J/yfokY2BmurjSI7Xpn1d2NuQWonWT7LV2SAs7HxqkSU5zUwJM 0+ZQVOBmeZwUg== Received: from [172.16.0.134] (192-222-143-198.qc.cable.ebox.net [192.222.143.198]) by smtpout.efficios.com (Postfix) with ESMTPSA id 4TM8L93yJYzV3h; Fri, 26 Jan 2024 15:24:17 -0500 (EST) Message-ID: Date: Fri, 26 Jan 2024 15:24:17 -0500 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [RESEND] [PATCH] eventfs: Have inodes have unique inode numbers Content-Language: en-US To: Steven Rostedt , LKML , Linux Trace Kernel Cc: Masami Hiramatsu , Christian Brauner , Ajay Kaher , Geert Uytterhoeven , linux-fsdevel , Linus Torvalds References: <20240126151251.74cb9285@gandalf.local.home> From: Mathieu Desnoyers In-Reply-To: <20240126151251.74cb9285@gandalf.local.home> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit On 2024-01-26 15:12, Steven Rostedt wrote: [...] > diff --git a/fs/tracefs/inode.c b/fs/tracefs/inode.c > index e1b172c0e091..2187be6d7b23 100644 > --- a/fs/tracefs/inode.c > +++ b/fs/tracefs/inode.c > @@ -223,13 +223,41 @@ static const struct inode_operations tracefs_file_inode_operations = { > .setattr = tracefs_setattr, > }; > > +/* Copied from get_next_ino() but adds allocation for multiple inodes */ > +#define LAST_INO_BATCH 1024 > +#define LAST_INO_MASK (~(LAST_INO_BATCH - 1)) > +static DEFINE_PER_CPU(unsigned int, last_ino); > + > +unsigned int tracefs_get_next_ino(int files) > +{ > + unsigned int *p = &get_cpu_var(last_ino); > + unsigned int res = *p; > + > +#ifdef CONFIG_SMP > + /* Check if adding files+1 overflows */ How does it handle a @files input where: * (files+1 > LAST_INO_BATCH) ? * (files+1 == LAST_INO_BATCH) ? > + if (unlikely(!res || (res & LAST_INO_MASK) != ((res + files + 1) & LAST_INO_MASK))) { > + static atomic_t shared_last_ino; > + int next = atomic_add_return(LAST_INO_BATCH, &shared_last_ino); > + > + res = next - LAST_INO_BATCH; > + } > +#endif > + > + res++; > + /* get_next_ino should not provide a 0 inode number */ > + if (unlikely(!res)) > + res++; I suspect that bumping this res++ in the 0 case can cause inode range reservation issues at (files+1 == LAST_INO_BATCH-1). Thanks, Mathieu > + *p = res + files; > + put_cpu_var(last_ino); > + return res; > +} -- Mathieu Desnoyers EfficiOS Inc. https://www.efficios.com