From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-ej1-f51.google.com (mail-ej1-f51.google.com [209.85.218.51]) (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 725BC388878 for ; Mon, 24 Aug 2026 18:42:15 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.218.51 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1787596937; cv=none; b=S9TDeTTYOYGw3FTBLKRFFsnWKqiLjmlN2eD80PgUUDIPbYG13CjZsJFWXPhkC0p2vQyUV9kESSPt6allMndNS2EOW8l3xqu+Tl7HU02C+0GQJ5iOOPip8TBBqluSM1MAhhwwZ8mVRFX7IFVHyJRSorgig0IU2Khg/wppXIwXXqo= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1787596937; c=relaxed/simple; bh=sxxzBpRiaRyofA6uPpa5Cfs5wYLvy8Bsjn4excVGr+U=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=LIIT88fIPdHxZkoEFW0pREW8VljCkWScL3MFODZAyuuINP13i8aaidJ65qxle6Xci3Wi5CsMitIYdr1lBiDM3X/asYfzguyTBEIjHiDp1OpH6us5hVi4bxCuq1p52gT184f3E8OhqZ7kb7g/5XpRhXdXqg2HjXeciOmBh35VeLA= 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=E7QdtdfS; arc=none smtp.client-ip=209.85.218.51 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="E7QdtdfS" Received: by mail-ej1-f51.google.com with SMTP id a640c23a62f3a-c169ae1cb26so38779266b.1 for ; Mon, 24 Aug 2026 11:42:15 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ionos.com; s=google; t=1787596934; x=1788201734; 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=tDTEVPij87eFXhlKecR4a0GN+N1xkI0QIa6z8RjNM10=; b=E7QdtdfSTcRzzzqnbyTPCzVuU3RfhIRxSMscQtlqb02WsfGxgYpIy2uBWejN9oVNIO UgevXlwC5RH0Y898jKDtvH1PDEb2sqgDcnjzRe+R6+6FGZCipJKQNAZi55NULtt4tt2v BuDQfnLcHoRm1lOxGLpBd3AEzU+Rn9KGHKIMOd4Eht+nnMnEElans4ZBWkB+tP4RaaMF 7f0cyY025LuumRkIECTs8ZZs/NkVhCsifpAouSlFYBnPz/9dyNpA4y38zDvx3X9bSg8f agSX3saf5X8HJO0+YCvnKOYaU1yGvo7igPHIULDaiOF2KvFLRSz9HoFo+x2BeY9kIts/ ZYqg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1787596934; x=1788201734; 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=tDTEVPij87eFXhlKecR4a0GN+N1xkI0QIa6z8RjNM10=; b=Fr2mCJfWu1Y5FDX1qMCRcN4HlLVPZw9yANh+XT8t3OLgtl/disY6khSduvxKFkMtpa +t69IJ+RVELnxBcHtfoC8DrG91ZrWxyOcNwJ/aB3CISuGiSWQHsxIo2kSYP5Rd4xlSvU fa9yuC5NEyLxGINasxerSors8CKNrcZZvmGkX9pYWlz6ttAlx0ov1/0FjP7Jt3eQlHMh K8ARs/JGVamLzI65YdSLuayFbQvvLq2jTLzmD1T56qEUSm/zU5HtQlHIU3yS14YVf1or 0xYz1+NYUk8fzdqlAOIR9WTJsLrYfmDFjmYNvdWv4G5f30jPQ6nILL2m0TkiJEa9KfAt uJBA== X-Forwarded-Encrypted: i=1; AHgh+RrOMzHQWjIq93k2hmqy+cuPDqxJE9Zw6ZeMJ6wRjQitj99owvTf1D8vuvXybTX8lpBKi01JtSBDGE4YgHU=@vger.kernel.org X-Gm-Message-State: AFuF++naJd7JNTfWvjDd9KnlJ+S3qZrbX+GAvbgwqeNs56G94YUgJFlD jICtx1B5uZBOCgHQaAwcnxgUIutFQNNPEy28OAaI/AOMiqkMnuwbmWckDfczjFA9pBZ/fW3BK0G +mCShvXg= X-Gm-Gg: AR+sD11gnQb6UsJoYhDGHxANwCq0shP0GK1ir6zwNJGZiuyH1UDJW44fVH73Tdsu6e0 jefjTkf8hy1Do1Tf66v91qMLmbpVwn5eEuyiKf/hrywVRdEsc04f2Wsq6ptGch2DphYl5GFEXIr Q4edfqhe9W8q1YE+KVobkOhLnKQ0NOq4n7jL2aIklWYQ/6EeX5Xti8aqvnY0kscjYC/u2deaNaW z5/ZwcpxmjgXsctnWay+LoVw6DQ/XIs4ZT0s27M36pNpVNUHnmzdqr44Dqk/4EcxbHzyzA5x7ke 64RAWy4sC4YIOshgHle0LEW1H0A5/gQdoRvLZYyvnsCbcfv4oYXGHKtjPH8ZLpCnkF7mYsjW+aA e3R28zyyHt6HVgw7NF2QD2AEGOV7KBCZmphcd5OJ0Bmg/oEbhNvL51r0dIU91UgBOCUOSZzGtsb zwdOvsbfsCPQr+809y8PhrX1ktiPC0M4AqndGCUkDjq8+Sxxws84IP0BOyjTlq1qIcFoysxRZAY eKY2MI9Md4wan93aZ0qvvB7l5f/oKhSyfSeuKlfmV5wgttjCY0X6/EHjz5FjB5c X-Received: by 2002:a17:907:a088:b0:c21:4698:ee9e with SMTP id a640c23a62f3a-c24e2d6905bmr74078266b.7.1787596933796; Mon, 24 Aug 2026 11:42:13 -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 a640c23a62f3a-c249606a8fasm1533526066b.8.2026.08.24.11.42.13 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 24 Aug 2026 11:42:13 -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 v5 07/11] fs/ceph: remove i_truncate_mutex, use i_fragtree_mutex for both Date: Mon, 24 Aug 2026 20:41:55 +0200 Message-ID: <20260824184159.240821-8-max.kellermann@ionos.com> X-Mailer: git-send-email 2.47.3 In-Reply-To: <20260824184159.240821-1-max.kellermann@ionos.com> References: <20260824184159.240821-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 | 7 ++++++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/fs/ceph/inode.c b/fs/ceph/inode.c index ce793ff934d0..a7cf9a7df756 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..beb7009f793c 100644 --- a/fs/ceph/super.h +++ b/fs/ceph/super.h @@ -466,7 +466,12 @@ 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