From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-wr1-f45.google.com (mail-wr1-f45.google.com [209.85.221.45]) (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 C15034854F9 for ; Tue, 18 Aug 2026 18:11:55 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.221.45 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1787076724; cv=none; b=WhEzVK4JsMyXkePMg9JevgLXsYv1QGtiA+N6mzFlF8EdDPJ1UD2IJYvWhJZhV855il3EWb0T9SYuzzuL1VwK704hsI71XEjIz4P/+/CjDXX7DrQIwBN4nyhJh3lDHWPU5zdy1Dw3lcgMWri7JRhyCV9t6/oI1geocyrqIpKt7tA= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1787076724; c=relaxed/simple; bh=vZ7gRo95tF/kqgzTVygqtXNVLMo92lelt/8iAfWrtpE=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=VmgqWMgg44ea/CzESa7g5YzKbFkwC2QzzuNkEfxRgtk3tmt1KSYBN5bsCRNscBR639kvAUayYGwPS7K8FqZ5LlvXSA1XGZJu867cCwIabcQItDq+snrRRVsWTA1jV18Gpd5P/A2E3sLyF4jxNymPb5ZO8I45D+WO7khWvvngPzo= 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=hIABmypc; arc=none smtp.client-ip=209.85.221.45 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="hIABmypc" Received: by mail-wr1-f45.google.com with SMTP id ffacd0b85a97d-4799b3f7c83so55456f8f.2 for ; Tue, 18 Aug 2026 11:11:55 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ionos.com; s=google; t=1787076714; x=1787681514; 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=hIABmypcrZFHZYpB5p6+mi7fJfg53bEUlGFnbSd6Mi9S7SBckXO7fLnKJnWqad5pkm Y+MZWIFKVThSdXT3rx7ictXaycUmtHHEM3oAIazhxaQlYM4IH1xdFkfCM+ZyKFB5an/e 4uIxdtagR92tQdqpmGCjeUvABnFNmZVGfS8wf2sWcld1J9ERaXMJ3ItNNupqf3Ckkc0m MsHx4GsoieNFTcbp3/WSrQC9Cic6UyEOZHL6Rqi664QpuQhTDLYSbVgwyRfK3Znho4IL 99WBYw45AeaeEOG7kNW2DyMelaXZ+Hm2XjSGIw+l0AJa08ddTLkLfCVOkTzqDV6TkCER pcgw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1787076714; x=1787681514; 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=Caizpw5NtGGK1D6BewJH0DhiHepZHkIrstGaTk2MmsDNp+xOzUioGY5OTs7qH5tURp bfvhz2UlTI3RzxGFmQMKOWYntkoPZLY5cWjGfXT8LUvYlvgu4KGO5HO3zh8Y0f+a6aof Ui5ByBjLlvskPPcJkB1VGPcXDz/r+bPISkVL7rioM9+a2vJNLB6ecaYSOQdaaw0ifI0I 0nS7BIx7boInELR89kpvSH48ni9oduTkeG2m/jPjh6aIL81njVqkRTrlPgBish4JDPzd N5HlZ8uJqM0L2sdMrio8bgHVzrNsvKF6mzQEu7oUEUNROneOVaU+o3ikOT/OB4STLVY6 7UzA== X-Forwarded-Encrypted: i=1; AHgh+Rrjbvn+T+nDYMK/qpA2pUXRqH8kTJ9bzV84Z3JilVDls7dULjs83otYNhTeXLo8c5Cv34+HYkHLPbxaS9g=@vger.kernel.org X-Gm-Message-State: AOJu0YyoI/Lyllhll8xAnD7Ll0K/Ke7v/dBek/OFnmPVl9E8zdHFIpxT /EetGWc4qAlHLdUUgGSl0VSlMoT9ILB+Rtim32ru7iec7m3qKH9TZH0oBUHYxKXW+Co= X-Gm-Gg: AR+sD13dW56eafrFu/WBqb2+R/c0L7hr57XjA6miSf8CNCTdw145AV8mAQppZDTiF93 FEhuVJlYELkWc0yKCYOwYNEO3LmSgqOYvqpAyswBEJkRtm4QHMYcBTdExpi6l4mgFwZ6CYhGz5B R3rELgOh0J8k4GmDyKBO0PMBaDDoTqA2bGmlp0gFdlcyznktKZVFAFArOS1ggZxMWRcPpxNV2/O 7tDDccfLDL+ZY6bT+5Vo5T43V72s1VySlqUDWffTazWtvesQk4wys6GvA6+dR+nvvaRtVINdxF3 zSFO3r7nmuPMubrYnp0v+dlPcWBDtUqHKp5jgQJt9Vszr4qoyD7qg23IvCZTEY5TGgt5d5PLrpB aQnPXeb52Hsz2RIq3EgnnT/fFXpa8mSrzMA0ZVhJ4rdK6ui5XullOOVPfnNDG+0E+Yko4Hk+2m4 h0R3TZNSHN9MqVIJH5jhaGDzEQvzzPV8NlioZ25V05y4n0V7kTLCgFW21nfLxqtcmQXSkKpm28U s8NgZwpCdiv48OBMoglp8ue3CRlRHEaCNYNrlwqur4GVQsQ8qkZ5JkOyySnFsTK X-Received: by 2002:a05:6000:601:b0:47f:e721:1f77 with SMTP id ffacd0b85a97d-4816075ebdbmr59122030f8f.13.1787076714244; Tue, 18 Aug 2026 11:11:54 -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-482a5a3b896sm14302641f8f.16.2026.08.18.11.11.53 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 18 Aug 2026 11:11:54 -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 v4 08/12] fs/ceph: remove i_truncate_mutex, use i_fragtree_mutex for both Date: Tue, 18 Aug 2026 20:11:40 +0200 Message-ID: <20260818181144.3541770-9-max.kellermann@ionos.com> X-Mailer: git-send-email 2.47.3 In-Reply-To: <20260818181144.3541770-1-max.kellermann@ionos.com> References: <20260818181144.3541770-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