From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-wm1-f54.google.com (mail-wm1-f54.google.com [209.85.128.54]) (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 A689139A079 for ; Wed, 12 Aug 2026 20:30:04 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.54 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1786566608; cv=none; b=D9RNW679hYzZvYRqagN2+LbXSj6CW1JELXAPyEbz04a4ZGWJb2fRTPN6plcKMyJzFlbT3En/W60R4alnPDgUC5D/WawSa/t9JQuLIJnnpND0HShMlYXmxFFgJk6zG1+odK+OC2G8xU8TpA3pjbgMqQ830DCHFHf2mRgCg3gjFUA= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1786566608; c=relaxed/simple; bh=vZ7gRo95tF/kqgzTVygqtXNVLMo92lelt/8iAfWrtpE=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=kKVKcVzq/80cSBlLpry/QRWRjV7DRNMElvuEcZHS7Xh1+aPslGaoqfO7HTkx+6dOMfzVXvrxnU32AhA4nPKpieqDIe2nyja+p2LJxY49xk1RlVxgxCCLoMkgNrG6TXh9MTY69Pobp2HiZcEghpUuqPF/TGz5rAEdEkAja2wFpCw= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=ionos.com; spf=pass smtp.mailfrom=ionos.com; dkim=pass (2048-bit key) header.d=ionos.com header.i=@ionos.com header.b=dDhZT+mn; arc=none smtp.client-ip=209.85.128.54 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=ionos.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=ionos.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=ionos.com header.i=@ionos.com header.b="dDhZT+mn" Received: by mail-wm1-f54.google.com with SMTP id 5b1f17b1804b1-4953de5be0aso9846495e9.0 for ; Wed, 12 Aug 2026 13:30:04 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ionos.com; s=google; t=1786566601; x=1787171401; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to:content-type; bh=/h3RiEJriMYlQ3k6GEtIrqFIdNALC21eRy/CEabRiBs=; b=dDhZT+mni2/QOmcoF1waKr//UZZ+l/ysPVBA8HpK/li+axAivk/OCf6RLFZSH4ijgR bRxvEeogifwJIXDxMtaG5GufiLPB4BZXuqleUbeIJGJBw15WgPjVgjmXbefkCil90m/c xSPkjl/fOeGYsfiOoXMXwVPlphHl9W6PNbpqkafRZA9qOEfx1Xc8d1asvISc7rTolt4v x0Nrl4mI4P9xxPXgpwaE3UYzUB3euBelzsjoUnNbarLdfl69mO+NTaruyXRTCx7gcIuR Vnuw9Z/qilupqU9rsO26Qhi8XZXvRLSUgZnYtYwrtBF87wUPBrY39Tq/NstSN0byxc+i F0sQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1786566601; x=1787171401; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to:content-type; bh=/h3RiEJriMYlQ3k6GEtIrqFIdNALC21eRy/CEabRiBs=; b=IjK/3fFed88kYWC9vgkm4/BHGAj7lNLbCLFyI61eEfUjZ0peZgZCSHasZGI1NVN2z+ /Bd0G4UVuFA7HGBerXJEMMbAS8CSFQ44YaTodoX1ZpJEl6j8sbUVC1qS+I7sUgDYf5dm uGGzhFwHOeZkf7c4gx0j3X8fVgcXxa9i/bYu5oMK9R2eeu4CDys+moi6IGoAXtiEfQ9X vThzpIOPD4hrbCubCJeaYDLmHaW336Jj7H7EKpOicCP7spiv26C7PKIv/r4AD9GenggJ m/BQjYOkNSutMOQlkHyX07OmCtxPaEbvQfWD2lZXHgTbPV9bKhOch+2hOpcbhrLGFFmn Bw2g== X-Forwarded-Encrypted: i=1; AHgh+RrHgjKnIaQeTlOpoqQva6mlRmRMe+VapskXQeAWOEu5JciNwKXC2w8Jo0L/qvPFKWaO/1BfWGHX3uPC5O4=@vger.kernel.org X-Gm-Message-State: AOJu0YxyH/7C2Fhg7VxWPlS2604bl1WrGawJesHEiyhOSfhBXz+/p6ld q25jGJZjok+fQp1pUqUQT4YAq+FyHP99yIyuY+JkNrGfqfIfZfNQPaZ4CzTb6VGs/kE= X-Gm-Gg: AR+sD13x+5XOnXGFrqGhTwve7RreFEnYBF4gH0esxBm+FKQ4El81RbSwWFpwlBCna2g UWESFB1rRuMy/hi756Ir9JVDSlOKzl3Mpgygva43AG/e4GKodPB3VlxZljr6VLeVIXruelWAsRj zxSFG/N55HHgFELEedNIIbQw/8bEetXD7A1pgTryi/j1EjSU8ynR4RxILBU2DI7rVS/MVlKmxXI HVoqYl8fTqAmpgu+sZxI8W2aLftwQ8XqXDIktKfW1QN4Xm7uiSmPbwcFNQkt30sA3DBQzDqKnrU oim4vwv89+uG0rqlrw4Ln3clIzgcWWnBlnRsVU84CbkMpykElmhg2VyzYz4fIwAkWTH1WkHKj60 4g9jQEzn5TtAoXdr4OuFikYcManWr8jtC5FKVOg2D1cD3w9QlJ204Ruz2KVNvLS4LTJggCJfzkh pSnQ8tD8yerScTRApCCbGnYS1dzGSsDTukZNsaEqgiN/AIVdyR4+vDHvHp3H8l3C8K7Q88DxRD3 WqidhTPb6yAjcNUyMj+8ynzsz7wg8gf3lGNqg3st0FFnGoxf7+xmW5wzbseQlZM X-Received: by 2002:a05:600c:6995:b0:495:5890:8f6c with SMTP id 5b1f17b1804b1-4998216ad6cmr5510455e9.7.1786566601183; Wed, 12 Aug 2026 13:30:01 -0700 (PDT) Received: from raven.intern.cm-ag (p200300dc6f02b200023064fffe740809.dip0.t-ipconnect.de. [2003:dc:6f02:b200:230:64ff:fe74:809]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-4815a569ab3sm328979f8f.11.2026.08.12.13.30.00 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 12 Aug 2026 13:30:00 -0700 (PDT) From: Max Kellermann To: idryomov@gmail.com, amarkuze@redhat.com, xiubo.li@clyso.com, ceph-devel@vger.kernel.org, linux-kernel@vger.kernel.org Cc: Max Kellermann Subject: [PATCH v3 08/12] fs/ceph: remove i_truncate_mutex, use i_fragtree_mutex for both Date: Wed, 12 Aug 2026 22:29:45 +0200 Message-ID: <20260812202950.1800340-9-max.kellermann@ionos.com> X-Mailer: git-send-email 2.47.3 In-Reply-To: <20260812202950.1800340-1-max.kellermann@ionos.com> References: <20260812202950.1800340-1-max.kellermann@ionos.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit `i_fragtree_mutex` is only used for directories and `i_truncate_mutex` is only used for regular files. Since these two fields will never be both be used on any given object, let's merge them into one. (This is a minimal diff that defines a preprocessor macro, to avoid refactoring all code lines using these two mutexes.) This reduces the size of `struct ceph_inode_info` by 8 bytes. Signed-off-by: Max Kellermann --- fs/ceph/inode.c | 1 - fs/ceph/super.h | 6 +++++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/fs/ceph/inode.c b/fs/ceph/inode.c index e79ba09f2cdf..1f65aa387008 100644 --- a/fs/ceph/inode.c +++ b/fs/ceph/inode.c @@ -677,7 +677,6 @@ struct inode *ceph_alloc_inode(struct super_block *sb) for (i = 0; i < CEPH_FILE_MODE_BITS; i++) ci->i_nr_by_mode[i] = 0; - mutex_init(&ci->i_truncate_mutex); ci->i_truncate_seq = 0; ci->i_truncate_size = 0; ci->i_truncate_pending = 0; diff --git a/fs/ceph/super.h b/fs/ceph/super.h index 05452bc7eac1..35399689f0c1 100644 --- a/fs/ceph/super.h +++ b/fs/ceph/super.h @@ -466,7 +466,11 @@ struct ceph_inode_info { unsigned long i_last_wr; int i_nr_by_mode[CEPH_FILE_MODE_BITS]; /* open file counts */ - struct mutex i_truncate_mutex; +/* since i_fragtree_mutex is only used for directories and + i_truncate_mutex is only used for regular files, we use the same + field for both */ +#define i_truncate_mutex i_fragtree_mutex + u64 i_truncate_size; /* and the size we last truncated down to */ u32 i_truncate_seq; /* last truncate to smaller size */ int i_truncate_pending; /* still need to call vmtruncate */ -- 2.47.3