From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-wr1-f47.google.com (mail-wr1-f47.google.com [209.85.221.47]) (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 AA96840682F for ; Fri, 12 Jun 2026 16:52:23 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.221.47 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1781283145; cv=none; b=OFCxVN4Mvzp4Va2ojNb5n1iVJjdcbyvH7/vThkY3i67MRtm5uRzEviPwKpcFKYm8DKRFYOCLYX2X1yAFs30zU4sUy5X4cCzC3nY1wHyB5uqGiEq8ifqOWekkepTL3bLMd1LGtGQCYTI8vsX1kR66ITMyt63q69JnSnULRx/+Yq8= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1781283145; c=relaxed/simple; bh=WCvi62p0s3fHIXlZeoHs62WhMVUZhZim6gnCWmADCUE=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=X4YomoUWMWuNku6s3YZ0toz6UIPYWToI6r8blx4UMgKMNEdymhJ2BWm/615AMYiZHR8YIWzLyky7PttzcoyP8lQPI+KzSvrFkKtFS/wBFL2suYd7hi3agJWJ2cXCMQST6uH2LpK4EL1opAGkfS2a60Q+EnvFqLFsG5fQOWCbTwA= 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=id2czieD; arc=none smtp.client-ip=209.85.221.47 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="id2czieD" Received: by mail-wr1-f47.google.com with SMTP id ffacd0b85a97d-4600cbb06deso756056f8f.1 for ; Fri, 12 Jun 2026 09:52:23 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ionos.com; s=google; t=1781283142; x=1781887942; 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; bh=VCqt7oyGsVjspDM/y18Kry2A1s2sB2XfzOaWQj6iyLI=; b=id2czieDwORZpDEv4nN7S2Du2lQXtqfC2AaF6a8RD3y5tP2PnaD3sZc9G4EbahlaSj EjlzX2zCXkWNdZSupqvkeo7BOP7fz+Lz1apIaoxdhmzF3Ewf7opU6SRDUl+OAPRdBcEu Uq+RbkcoFGGi0xujMYBh9eGKpvj3Iu6E9ASpSXcT6bNLC49LvT/i1UojTe0V17Uq65N+ QTYTILb0YSgWb8OmPXbbFU4X34gOUNTqLyRb4iUAUiyufkSes6bxj6fh8QfA4uo7qHDP R6JP0mZGo3yCsWx0NsahC6CHherDA+RRlcgaiPACnCNdhu2A0DkdldBxRmUShRgquiIX zgbQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1781283142; x=1781887942; 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; bh=VCqt7oyGsVjspDM/y18Kry2A1s2sB2XfzOaWQj6iyLI=; b=j4XXiXNBmxJWdXpkcathAvpGVIBiuM2WooFAcdYP4qLENgdY9KINk0LTjovVblqGbd Ehwt3rOBqOtrJI+qx/zxE02U+6MRJXd7WglP5Z3YzvwGBaoSVg6kYQQF2cVKyEIeXDyh pXWzMsIZLgZXXScXWhx2Wgyr+j7cQert72Xdnka8k2qtlYlxuiS+OZ49Xz8RNHncfZDj TeJH/lcQOQGK1Jlz2kP/Vxm0uWYMzmDCONYydfn0X1koYYM5FWG/B8KWXb+pksj2eMvA 2QuIKiee1isnHp9Myq3Pk+uLbMWJoOIRszgqomjntP55zEx1HJdHcQizY8mKHrP4OfWH Kf1Q== X-Forwarded-Encrypted: i=1; AFNElJ8+6vbawtSvSfPlGuHxl6IHyyCM1EmQ2SSq29AKc1BDStDmN+vZDzv8C9Hy2c7JBh4HxCJn+Jl3PyiINCc=@vger.kernel.org X-Gm-Message-State: AOJu0Yy8Y2zbHnK+lu+gC6ZLr9RXCMQYNZ1GGLR2iZi8Ma330epU7GgD RsLQx0FgOl4DXIlkHcu9DPMXUYK/B+Qta9Koa+PLcnguq8d6PxTpCougq0fSiErGGRY= X-Gm-Gg: Acq92OH0nFKY0GpHPlWkUvxaV3ynDtMCPjWSqDUbJbscEkhngzlDz8uuOLavvrw1T5o jqDySa78BbZRFKW18NiLHkmHUg9F+QTb07zK9O2o3fGGVlSLUrgHZNSHMJuJD7VOxa0Skv+bBFL eiaOcEN+n+r1wN2I1vNI++jRdORvfVEiWYqq+YLj8d2ihLtYEJ8DCbDkcv50C9dtJR/8VsPJNTy aShykkAFugnvnom6Y5tA7J9IKkD6r2Kt/HsgC5nAGMMQi+1rrFkj610bEOkct9ERo27DMkTg6Xq E/soHtYdFqN2TJgQpILt2ZSQ1VWvpOUmDIkONZ8hwuflems47mWfRwTcPUw7DAzzuZgtGiei2Qn mszcBZoo2SSTA9QXGVUxX2Jin4C5IrUkvrxrw6OmG9SRp0f+9jPTvkVYgSTtFM4acuVRNoFl85S 7gmcuUS8YVOHChYp8pNpPSSDR6VufhDl96XdPR2FF5bGpD1KeGdhHY9SVDXmDfWIdIaUTjnNKyx nxK4jOIN0IGa2H4BEnhZoNBEU0= X-Received: by 2002:a05:6000:290b:b0:45d:4c30:81a6 with SMTP id ffacd0b85a97d-4606f21805amr4604484f8f.5.1781283142042; Fri, 12 Jun 2026 09:52:22 -0700 (PDT) Received: from raven.intern.cm-ag (p200300dc6f45eb00023064fffe740809.dip0.t-ipconnect.de. [2003:dc:6f45:eb00:230:64ff:fe74:809]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-4606f26f1cdsm7807377f8f.11.2026.06.12.09.52.21 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 12 Jun 2026 09:52:21 -0700 (PDT) From: Max Kellermann To: idryomov@gmail.com, amarkuze@redhat.com, ceph-devel@vger.kernel.org, linux-kernel@vger.kernel.org Cc: Max Kellermann Subject: [PATCH 08/12] fs/ceph: remove i_truncate_mutex, use i_fragtree_mutex for both Date: Fri, 12 Jun 2026 18:52:00 +0200 Message-ID: <20260612165204.86137-9-max.kellermann@ionos.com> X-Mailer: git-send-email 2.47.3 In-Reply-To: <20260612165204.86137-1-max.kellermann@ionos.com> References: <20260612165204.86137-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 17df694fe978..c0d88cf1f6e3 100644 --- a/fs/ceph/inode.c +++ b/fs/ceph/inode.c @@ -676,7 +676,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 646ebc03d263..19f26724b285 100644 --- a/fs/ceph/super.h +++ b/fs/ceph/super.h @@ -459,7 +459,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