From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-wr1-f41.google.com (mail-wr1-f41.google.com [209.85.221.41]) (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 6D57633D6D6 for ; Sat, 28 Mar 2026 15:38:21 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.221.41 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1774712302; cv=none; b=qGXOBchUR9D9TUIcC58SOfEIkVp3fopGpv8PORPZlnU0XEvNORHCXHrS+aCBxQq6YyE3+O9N6C5zTusRFtH40skzLmiLfGEwXg0zScDskEt7uZNX+OwdE6OB3REZiQTawGYBUk8M9bbq6uO/gDvUJ5yFnD2dARLYVBR4IVFDal4= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1774712302; c=relaxed/simple; bh=0143IXXElNSyg7Nm9oVd4wH33qpnhWZ280pBxKmpmMw=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=QkCbDQRhUUTLT84b34DZYiCy3As+avoiY9E+cxVwRYk+YA0dXONdjvqsmQ8M8NvllrdGgFFysAdyIOd7O+51Lmv2kSD0Vl7VwyAeGv37S6p6hARc6gJezLkkheNyRv8Zz0TC6cZI7qdrDAWctbdmTiPZBgQQuDMoYNzFAJJ6MrQ= 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=qO/hFLUN; arc=none smtp.client-ip=209.85.221.41 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="qO/hFLUN" Received: by mail-wr1-f41.google.com with SMTP id ffacd0b85a97d-43cf5fbacc9so150614f8f.1 for ; Sat, 28 Mar 2026 08:38:21 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1774712300; x=1775317100; 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=+GSleJR0+hRkD8atg6lLhmCsk3DjIcRPohzR53U7fmU=; b=qO/hFLUNlUBFPEG1gEyz6aucYeoEU16kj9rYi/JpDH0DyUw9p1TH85cChRQULznd7D j85vVaQUAofS2n6+9hB5/tjMsli4JKe9BQFnNvZLxCm32VADBy2yuNRWoMNZEvcpOf4g fxekaw2UwvG14gaqNK61p0Bm3EmD7INe2AtLebIOTrVrUe+vFnsTmXQLnrER1XqF9qlD sLi+Zjip7N3BWoyXZK89kxMVg9G1IMLOHh0q6mC2s/umcxkOh2OZe8UNLuG5AE/ij3q4 V47enBESuNgrZoa65GZ8ZfpBtmG7ldF0n192elfirCSg1BUKFt3ZqcOjBSCK29K8aMl8 AHJQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1774712300; x=1775317100; 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=+GSleJR0+hRkD8atg6lLhmCsk3DjIcRPohzR53U7fmU=; b=PmxciXRGTpiZjkPFkcJdzn2W2r8MVaZx6uWCyVqRqkjpWFhmVx6wETXoy1RnjRhjqk PwtHGgdzlJ+c6/KvaI7QxuLIln4NsIN5qKiafncZRSGjv/yQrIUW0JQ53HFTrvVca4Ck l1gkXXX3/MnWqut+uuAgbIWFuqsobjxRwsAgw88kqXpmKlw6D6VCsiiibaDRP+whkCAW XktRtJYxRgn9JX4xVtT7ZFhH0jc67i6eNiw2efVCPdCZgfHnR5X/DpFkE0p7zvb+zIGb /5NP4B63CF1nJdNlHZuKqWWPl7GfschpYhGl6A3cMeKLoZbhZ9j0L+G5rR9kIIww5qac e/yg== X-Forwarded-Encrypted: i=1; AJvYcCWtiscIjSiD+ibr5vuNaWP2POLrIof26YObuQeN2I11W52zkcMQ13YyJdcqlk4CBgPAtX8I7RzpJCEh+HY=@vger.kernel.org X-Gm-Message-State: AOJu0Yz60AzikU/XzC+PkwOEsk8K4TU/WcpPSqA6spT9QzS78i8PpTZr Dl7aOYIMOjPGz4/k56DKVi/E3CrLZ6s9qH1eE3iRmLJHrgEraygvxMB/ X-Gm-Gg: ATEYQzxjYyVplyQkCl5am8zNqcRIInI2PF23xQy/LX37MRZ6PdUW/o1vTLeTYwt6xHQ ewkJSUyEbqRgHjCOXDusUnAqgn9KzwV/TnKUGumW+3OngVRyXwozgjWUsqLsAXbAfrd9xhDPUer 7Cx276nXfljRv6RcZRfVD3C5miVrt682YNbHm05a62LLqN74zhbGnnINdZbBoLmIgKbrfCVjN2q Evo4gK5IDoc06ce7x72Q+ZHwM+gKB4DNoMQaUIM8wF22E9hailS3Cr+u4rA5xalywnbabfGu0JA lxykksk9IJZEM2QtDAo8PuhvJgMit4ZC9uOA1pOfbY4UiQ/nHrIp21YVJCH20ghGoZTPyUhbvwv gBtPbFN4a3jafGIGt2MUSRIFcrhaC9gJH63B4qeK7Qyg5G+YuZHykqRvwU79eGKKecdfZXzedls iZgHUGYGZx8xiyDoEsgc0P8wV/DTkaWrTmuV8qJjqQwC9Rzzb+EhGU9V3u0DtR7hkohuJkf60xn w== X-Received: by 2002:a05:6000:2387:b0:43b:94bf:6400 with SMTP id ffacd0b85a97d-43b9eb399f1mr10973752f8f.24.1774712299878; Sat, 28 Mar 2026 08:38:19 -0700 (PDT) Received: from f.. (cst-prg-89-171.cust.vodafone.cz. [46.135.89.171]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-43cf247102dsm7196887f8f.27.2026.03.28.08.38.18 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 28 Mar 2026 08:38:19 -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 v2 0/5] assorted ->i_count-related changes Date: Sat, 28 Mar 2026 16:38:02 +0100 Message-ID: <20260328153807.3368975-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. [this is v1 except without the unrelated patch] 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