From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-wr1-f44.google.com (mail-wr1-f44.google.com [209.85.221.44]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 56CEE38F9C for ; Sat, 28 Mar 2026 15:31:59 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.221.44 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1774711920; cv=none; b=CvKIoeXCdYnvBI/w4QwKr8m71ljFJWAPkCGH1TKvydZFCfabiIqfuSJ/4iusKnKLqhdK77cZs6WBILsqMLe/XnfIwLHo/mft6tOSuLNNK3eMc3bs/CbZhNWMUTGvawrl+ukIzZskrO3IH03WzzQWGc1i1yVvj6Wk8NC6+eTdEOc= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1774711920; c=relaxed/simple; bh=0F7j9rUuiWlBNk8YVlJPt64MaBp5s5MausN3CBgy3rM=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=IVUx2yOzeP0teBEiBfhZBlQeY+Y2pYOVL3whS1E6RFQvlTM4D/3QmQxGv+lC7aWPb6D/swQjpzyOtcji8ZzagMOqelIJAQfRIsxHA+QYOyt8M9QpnvhCRuwu6xxruVWhvwR74bVarjqTBSkORtD+PmbgqZ8eIsLvgLhbm3lJQ0s= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=b5PnOZGl; arc=none smtp.client-ip=209.85.221.44 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="b5PnOZGl" Received: by mail-wr1-f44.google.com with SMTP id ffacd0b85a97d-43cf5d14d6eso311936f8f.0 for ; Sat, 28 Mar 2026 08:31:59 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1774711918; x=1775316718; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=u7mQPIC0ps2Jv1aGIJBEdjAFDdHo2SlLPn6PZfFqoiY=; b=b5PnOZGl7F4N4e2QALbzE6BGiFQqkaUhbCbpLtAkggoDUR9LiGC5O9/nB68r4bHgOt jWR7UHsQDMAOXanbgFuAsKBiTy2vU1KJwmpuLSukZ7C1nM4ZKUHp2GlOsZuio1N+dFL9 bGYe2c3QKYFIu72dbsVHmBJgtoS0xLd7TV7TBxNi20FRPHibxZL1mTSByJ0/SHmt3Sr9 8IylnffV23FMF32b1/+wXQz1JH85/8aTbczssmvPjcRsv+5otAdov3h0rFzw7D8/cwLn 4Ua4npl5Rex9FX8mZiH7XoXtV6aIdI85y/stNkr9N/75DV1pamEScQsjCniOOthrxyJI wgvg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1774711918; x=1775316718; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-gg:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=u7mQPIC0ps2Jv1aGIJBEdjAFDdHo2SlLPn6PZfFqoiY=; b=mM1+Kpp+nwgUP54vr1Q+MoyBVYsIorPGNKlqP597fUSVSLyUIRmgmF+xR1+C/xpdyC uuczj2050o4dDlTvU6r6Ia++gGnNbludyKJEILG5l9gjkU8xfQ9YnWlFK8ymtUXnNfUf RbfR2hsCRT2kkI0DJARpstRpYTnr4nG83t4p3Wu4xKfuTb5lXdfwPMurZBNvLomuvOU0 OHmnrdJoSoj9ziGRhiH2S5p1LteNpkJJGASmUUs31bVUa3oebWgUGHjI5Zx34Zrw+svm HhLRrcm2OD7nro4otpncp2nYar/iZkhC2BgXSgArX+9D6aOl6hkJnHaT0KTgIC2ivkZB dtYw== X-Forwarded-Encrypted: i=1; AJvYcCXqPor+cpOa7BxyobDB090hJLUkaqDB9CZHUDfytvR97BjA23G1crKRZdnEIlBCbKLW1IaZ+rWc6pIGJ5s=@vger.kernel.org X-Gm-Message-State: AOJu0YxZygQiz+p6kzwSggW9HTbTQh3JWDNB4vItW2JNUgKuFzVrWJ3K Yx9TCF92X6QpHE9vWZHcYgybb9LKuGuelnGs3lNz3fftSHNiJ3YPEkit X-Gm-Gg: ATEYQzwXMlnZsFCylht3AmGZX1vLLyUKmpLWN19zhPv6pxG5eko+SEY16Zvxg8aSMHO nPjwYlFRDM6wiHtbUxOfdzNEOfwadxo12voaG/IQNeHb/XwCbL1qwUxY7yhviFU10ipbCa+AP34 xfAWPC9cztqd5rGTfgG/5ZLJw5G0yFVua1ApduWltAp1u/09dnnkV6i0FrtgnLLXrkW7d/4vqVQ BpEeH78NSkJPNf+tI1ZRIHFFo+LGV7pl5venV15eXQBFeVxE35HoByTjMqfKEaji5LDgzUBe4DJ QPfUgJkdnD6Pj5K4byVJBSuHW9ryTIKugKhEu6wCzhGXcFNp/kjDYiuE0DRhlxznVqaeiizKZt3 ACjVh4SIYV0fl7hT/BUHhQFt7tWH7jh/O3ZSiezGzOC6uhEPSIJc1MTgOl5EneL0sgCsNzG3w4d 4Nfth/cN6f9JjgeV4xATztO50IRkR7t3Ix+jxJZpnKI+0yxx+/5IwfVLcaxinRe00E8vIRjNQ5X g== X-Received: by 2002:a5d:584f:0:b0:43b:54c9:7d1b with SMTP id ffacd0b85a97d-43b9ea638c4mr11428917f8f.41.1774711917400; Sat, 28 Mar 2026 08:31:57 -0700 (PDT) Received: from f.. (cst-prg-89-171.cust.vodafone.cz. [46.135.89.171]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-43cf245f8a3sm6725310f8f.24.2026.03.28.08.31.55 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 28 Mar 2026 08:31:56 -0700 (PDT) From: Mateusz Guzik To: brauner@kernel.org Cc: viro@zeniv.linux.org.uk, jack@suse.cz, linux-kernel@vger.kernel.org, linux-fsdevel@vger.kernel.org, Mateusz Guzik Subject: [PATCH 0/5] assorted ->i_count-related changes Date: Sat, 28 Mar 2026 16:31:40 +0100 Message-ID: <20260328153146.3368470-1-mjguzik@gmail.com> X-Mailer: git-send-email 2.43.0 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit The icount_read_once() stuff lines up with inode_state_read_once(). The prefix is different but I opted to not change it due to igrab(), ihold() et al. There is a future-proofing change in iput_final(). I am not going to strongly insist on it, but at the very least the problem needs to be noted in a comment. Finally, igrab() gets lockless treatment. I verified btrfs likes to call into it in writeback code with the count > 1, same with procfs during process reaping. Grep shows nfs also calls there, but I have not checked how often that happens. This is a minor single-threaded speed up at least as a lock trip is avoided in the common case. Mateusz Guzik (5): fs: add icount_read_once() Use icount_read() and icount_read_once() as appropriate. fs: enforce locking in icount_read(), add some commentary fs: handle hypothetical filesystems hich use I_DONTCACHE and drop the lock in ->drop_inode fs: locklessly bump refs in igrab as long as it does not transition 0->1 arch/powerpc/platforms/cell/spufs/file.c | 2 +- fs/btrfs/inode.c | 2 +- fs/ceph/mds_client.c | 2 +- fs/ext4/ialloc.c | 4 +-- fs/hpfs/inode.c | 2 +- fs/inode.c | 42 ++++++++++++++++-------- fs/nfs/inode.c | 4 +-- fs/smb/client/inode.c | 2 +- fs/ubifs/super.c | 2 +- fs/xfs/xfs_inode.c | 2 +- fs/xfs/xfs_trace.h | 2 +- include/linux/fs.h | 13 ++++++++ include/trace/events/filelock.h | 2 +- security/landlock/fs.c | 2 +- 14 files changed, 55 insertions(+), 28 deletions(-) -- 2.48.1