From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-wr1-f48.google.com (mail-wr1-f48.google.com [209.85.221.48]) (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 DF181371CE3 for ; Fri, 12 Jun 2026 16:52:19 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.221.48 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1781283141; cv=none; b=C9MmgNd6InEqML4GWAq7HrkUibnBKgn+GNB2JemCewupPrB06jfGObamLJvgsH1vMAsNlW/vZds8+Qh25M4xbyYN6oMpX8nX4Oz4JqWOs2HcaZv3RgfzDmSRm470qovcYK/qWwsaKM6HxWPmWxaoMlPz1ZFSnuHcSPj941rTi+k= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1781283141; c=relaxed/simple; bh=nJp1aMuxWCUjupgbc4mKqK8um+RU1INVI+kbVugwGzI=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=UJC8XejAIV8Xm4U9OBcBBQCzJeb8ZeVEWPsnsqvdc7VOpzsKjXZ8XiAAMMz49I3xEQ9j94fiZ3VNIzsjOi0RV2/YvugtvZiecGzIGTHuS0QhNBBKV7sn9COcOwTH6ztTd6eryjYHDFlHM/NTcJAVaOlySFJgXyCJO7U5SVpNnyI= 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=gq4ucGi6; arc=none smtp.client-ip=209.85.221.48 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="gq4ucGi6" Received: by mail-wr1-f48.google.com with SMTP id ffacd0b85a97d-45eedcdaeaaso830880f8f.3 for ; Fri, 12 Jun 2026 09:52:19 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ionos.com; s=google; t=1781283138; x=1781887938; 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=jTxqEc8zWJL60yb7bcwj3bHWMC/wLLvml6JA4qzDLX8=; b=gq4ucGi6q3kldfgsa/GHvZRGvgf2pTSFp8AtLc/Mxj9T2jJsx2fKr7/3E9b7D3oiS1 m75orwNRRzvq7lyA50I5zNFrmYJyQHvYoDBIePGwSUPmAUFnHFoYPZlqwaRqaAiTzgnu 8Ss3OuAUjUKsnvhmyH85E8K+JWnuCa4ql6K3toy/FZt4UIb23U7kL4jGiVH97mei+mRD YCiqggTYdCkSCdTOkEtyD1d1P8R8AlH3DCOEGI3TekyIa9vEbPr8F1tGC7mE8oK9HRaA aNMHR/2XotXLXppvz5SFq/70sGARrR7CnLYYVdrdxxdU1R04acB1uKfd6/D2xg/YLkH6 fPEg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1781283138; x=1781887938; 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=jTxqEc8zWJL60yb7bcwj3bHWMC/wLLvml6JA4qzDLX8=; b=kp4qhUxdpdIGR80R5k+/SvNWFfsPD0Z28PWJd7sEylW+LHVMtzYyHdfw0m9pe/6wng 8iiL9rKOjGk7N/Bm9bcp8/wEGftCdC7G4QeP0SLQhUjYgfm0zVqTzb4haaw0rt22ZHX3 XjxcLca12rYDgIuxJ5zmEq73wlOawXSbCCUCa1uyxYas0MvAwKlfOTgMUuGWVAX0e4lC enF1ES4vt1hVQD59Y4ocRM9wEjnrylw8w3FSSEPndr/tptOluvkfXRa5aWOdeAIMg+iu dWhaHdgGKWs+pgX3fErDqcSOTIJ1OUhMt2dsPYlsM4lj0GHn4F2toJjmwFHMgaUDroTS ducA== X-Forwarded-Encrypted: i=1; AFNElJ9tXjWVkKVFYjTGgVdD7IIx5dcen6qbkvRzD7/uGCZQ3BtMxz3iBZqbT3ZDttPiAm/bvxA01qKKEJMfhFI=@vger.kernel.org X-Gm-Message-State: AOJu0YxOn9H9nVP+PqMeqtPpuHKveS+9WrUYvXGPer89sM8RRaMiDrvE imWQx+fLAhlIZ5D7Po9p68nHROrITonWFR/DQ680XcA7g9IEWr/Veko8rBHQuYeebJ2hDagpNkO +bpN+72E= X-Gm-Gg: Acq92OHzDjI1kY5IK+nhpXVjnSR8vveYIxOZahqPutoE2TisALUE0348JtLWd9MUXio iYCDm9KJSHbOGlrxZdkLxBqpYcLkmeoo8buAjdfgXEtvg/QP4+dLKjFgGayZH3tb3MMKIjjFFy4 njgowAuuAy1roa1K3o9Gf5qEVUJJ3mxlp1XLL3SN19QsFcjBGUNe0U3mGeTYWhXGkQDy0Efz8yG ra5+XVueo+1KDRWjlb220MJx1Pyk7l3sgfbLWc/L/kf+SN3wTovFQWbHD5VM8sFTqcazf5YzGof NrPtpIOMoKVtOewt56Wp7c8SY6FU9gA/Y7pU3roB9FcWPUpSizUR77K25xiJxx+CWeD7Kv7Pwbf 1j4SQ3hSMUfmqJyOflSL1rPnMvalrhnNZmWDFXQHaUYOkkV4PsiPV45SswGslg6H7hBdDLTCv5O Vn6zbNckanB3aVK/HxYh/NkYEMLk9YprZjOmspqI1o1ezpPEBoZjbuVagB/w3ZDFf4fVkOU2Mbp iV3D9un2gfdSdTwAf+SjN1sXas= X-Received: by 2002:a05:6000:607:b0:45a:e3dd:586b with SMTP id ffacd0b85a97d-4606da6dfe3mr5550212f8f.18.1781283138302; Fri, 12 Jun 2026 09:52:18 -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.17 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 12 Jun 2026 09:52:18 -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 02/12] fs/ceph/super: make field `i_truncate_pagecache_size` optional Date: Fri, 12 Jun 2026 18:51:54 +0200 Message-ID: <20260612165204.86137-3-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 This field is only used with CONFIG_FS_ENCRYPTION; without it, it always equals `i_truncate_size`. This reduces the size of `struct ceph_inode_info` by 8 bytes on kernels that have filesystem encryption disabled. Signed-off-by: Max Kellermann --- fs/ceph/inode.c | 8 ++++++-- fs/ceph/super.h | 11 +++++++++++ 2 files changed, 17 insertions(+), 2 deletions(-) diff --git a/fs/ceph/inode.c b/fs/ceph/inode.c index 22c7da1ea61c..1504b889622c 100644 --- a/fs/ceph/inode.c +++ b/fs/ceph/inode.c @@ -680,7 +680,9 @@ struct inode *ceph_alloc_inode(struct super_block *sb) ci->i_truncate_seq = 0; ci->i_truncate_size = 0; ci->i_truncate_pending = 0; +#ifdef CONFIG_FS_ENCRYPTION ci->i_truncate_pagecache_size = 0; +#endif ci->i_max_size = 0; ci->i_reported_size = 0; @@ -865,6 +867,7 @@ int ceph_fill_file_size(struct inode *inode, int issued, ci->i_truncate_size = truncate_size; +#ifdef CONFIG_FS_ENCRYPTION if (IS_ENCRYPTED(inode)) { doutc(cl, "truncate_pagecache_size %lld -> %llu\n", ci->i_truncate_pagecache_size, size); @@ -872,6 +875,7 @@ int ceph_fill_file_size(struct inode *inode, int issued, } else { ci->i_truncate_pagecache_size = truncate_size; } +#endif } return queue_trunc; } @@ -2331,7 +2335,7 @@ void __ceph_do_pending_vmtruncate(struct inode *inode) /* there should be no reader or writer */ WARN_ON_ONCE(ci->i_rd_ref || ci->i_wr_ref); - to = ci->i_truncate_pagecache_size; + to = ceph_get_truncate_pagecache_size(ci); wrbuffer_refs = ci->i_wrbuffer_ref; doutc(cl, "%p %llx.%llx (%d) to %lld\n", inode, ceph_vinop(inode), ci->i_truncate_pending, to); @@ -2341,7 +2345,7 @@ void __ceph_do_pending_vmtruncate(struct inode *inode) truncate_pagecache(inode, to); spin_lock(&ci->i_ceph_lock); - if (to == ci->i_truncate_pagecache_size) { + if (to == ceph_get_truncate_pagecache_size(ci)) { ci->i_truncate_pending = 0; finish = 1; } diff --git a/fs/ceph/super.h b/fs/ceph/super.h index 6aec40955387..f0f03aeb5b19 100644 --- a/fs/ceph/super.h +++ b/fs/ceph/super.h @@ -461,11 +461,14 @@ struct ceph_inode_info { u32 i_truncate_seq; /* last truncate to smaller size */ u64 i_truncate_size; /* and the size we last truncated down to */ int i_truncate_pending; /* still need to call vmtruncate */ + +#ifdef CONFIG_FS_ENCRYPTION /* * For none fscrypt case it equals to i_truncate_size or it will * equals to fscrypt_file_size */ u64 i_truncate_pagecache_size; +#endif u64 i_max_size; /* max file size authorized by mds */ u64 i_reported_size; /* (max_)size reported to or requested of mds */ @@ -660,6 +663,14 @@ static inline struct inode *ceph_find_inode(struct super_block *sb, return ilookup5(sb, (unsigned long)vino.ino, ceph_ino_compare, &vino); } +static inline u64 ceph_get_truncate_pagecache_size(const struct ceph_inode_info *ci) +{ +#ifdef CONFIG_CEPH_FS_SNAPSHOTS + return ci->i_truncate_pagecache_size; +#else + return ci->i_truncate_size; +#endif +} /* * Ceph inode. -- 2.47.3