From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-wr1-f42.google.com (mail-wr1-f42.google.com [209.85.221.42]) (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 2AF0C3AFB07 for ; Mon, 6 Jul 2026 07:25:05 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.221.42 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1783322715; cv=none; b=fgtEr9wEcm4BxeBxol55xUjrzeW2DJfVcasSqtjQ8g/nKakDhOQKA8C6qqjC/xC1uTUJ+xdindJuYk9lP643U1VMsg2A4cjHOQoIotlePpKOcS7BKsfAFYnp4BTbDzCXa9IhUVRtj2494vE9lkdBQ/Y0QWoAwdXxzW2d7GwHpwQ= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1783322715; c=relaxed/simple; bh=9XEOCpJ92dHTmRtWjKTA/Gb5ilHulLiXFfGINfxa9k4=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=PV1Yc84T3XCYf77Q8jud+hwdhIfnTFnqQFXgfBWqv9N8Y/TwNzClxUP+NrGclAiXxX/vrAzfD1Bg1/tBErB6lKU8ki0ta5Kz7kpuoeyX/wN0akoPqyQIb+AZucKe7VqEaBilWqqgPCqPyG2loF2q7CL4aVCP59WTkilvzm6YEDg= 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=I4pXRH3S; arc=none smtp.client-ip=209.85.221.42 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="I4pXRH3S" Received: by mail-wr1-f42.google.com with SMTP id ffacd0b85a97d-47ddf7b09e5so786671f8f.1 for ; Mon, 06 Jul 2026 00:25:05 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ionos.com; s=google; t=1783322698; x=1783927498; 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=00c8rcUzxLCd7wLsw23nlyAOLrwAoUbKznwY4vUbxqs=; b=I4pXRH3StSrNgYaufuTOv8flH6uH0AKoRpC/rGrSBVuKIhjaSowEgjHLTPJLPC9gN1 +gwQacxtiiQMNrmOAo/vFRPyJGEBf7Fj2QzNlI3k7PkYsag/V4MWwUokz5321oEzfK2g VCXz+IrR/LzhyZFYtxPCuSoAwH2hZbbOwa7YTuqCUEy4fpOZg5GdGzAvjKfOlAOdA6Cb JozFzvE4Ke+ghIcFdtVvYE7RalBXH3gTr3S+5TAvx85NqkrtfSd1T8Qa6sGogkpOS/EX SXoBKSjeVhztarl5wpUxi8eWbyduSIDhRYB/zIBUrKRj0xAVxrnCFIB2V8m+1A2ADwXC 1g0g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1783322698; x=1783927498; 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=00c8rcUzxLCd7wLsw23nlyAOLrwAoUbKznwY4vUbxqs=; b=LiwBE9Nr72KQv+IUNiJ4kww+BhDyxpmztbfd0BqA3ARxh4otER8SII2NigCjhn3U4I eEm453LIhFdZ594BLr0M4Smu3kRCzciGOY9/tziAqALtH4ybrOz0lPXHAaWTPtCBP+kq KzBGbgGgKAerkowevyJeqw//gfQOK12S6LwPXQJfhqcgaO91R5Az/fTTvMI1wJnnWvgP 6Lv3705sxvFroWrL+gijr/KyVcPPlA2bYVeRlrzPaFo+Aryd3cznOv68DFF3Tny7Y+F7 bYfr6GSwsHth8Q8sTQqvluxcwwpZ4Lx+5VCFrptqiJfJ9tcjPgVyvH35SD468MBHA8+4 nYVA== X-Forwarded-Encrypted: i=1; AHgh+Rrg1ZzTavq+S65BOkfDGyWrLdr2hgfH5Cq7zFXFljcfjKDzGxC2ZizRxkad/dQWHyq4Bw9OJTD5O2eZ+KU=@vger.kernel.org X-Gm-Message-State: AOJu0YxctZ44S/gM5tO1kS4CM4aU0OMJHib0H758o7IzDQfX0G3kzmXl IH7C9LaUw24BA+ii4qa0AHvdOtLO7xef2SgdswAPVEzG6TlAGBd9zP0xi0PKhPSxutg= X-Gm-Gg: AfdE7cn3keXRaAsO2y22sYp0j2ja4M5rosvouu6rN+vUK2K70TUf2AFDxZ4/lXJBwk6 n/3dMo8Aa2j/+YCUOD1yvzBfEYmtDmIMAP0APssaZvTe8xub66OCCjOPTlI5K825rxh6P+f57xU sDeYTdUCgWfAiOiSFVuNsWDRVAC33FHvWswjAeS2rZOJ0lUTSW6okc2+xcFHBVgJc1SqwJh7jbO EhZBC4ucG9yExh2yzsvIqiN6edQObWpcee4APN/gQrgAavNPaoEidQE+2q9mrZ1yEBNanNLzr2b CmRoeYkdN7cfUrOr7WRysgikb4NlUtnEkFtN+kMP21FUHeAiIEso6qHITGLsD9pqnNyasXkaqY5 RsGf/VmAh2ZAe7bQnyNjh8uPvhVhd3mkDUX39Ribg6kluIE3tRnrhyOv+oATfTP8RouE+ubYhmr KMnNUsdqwTL0GFy+D20Xl1S/whugIFUqf+yMiVmjpGWC/tvdy0knz/6pVlRhpjoqdwa1OUSCoro DFUepnbfblwvtca X-Received: by 2002:a05:6000:18a5:b0:474:64bf:8fb6 with SMTP id ffacd0b85a97d-47aad54eaa7mr10471195f8f.39.1783322697650; Mon, 06 Jul 2026 00:24:57 -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-47a9de1d905sm22324916f8f.2.2026.07.06.00.24.57 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 06 Jul 2026 00:24:57 -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 v2 02/18] fs/ceph/super: make field `i_truncate_pagecache_size` optional Date: Mon, 6 Jul 2026 09:24:33 +0200 Message-ID: <20260706072450.3920010-3-max.kellermann@ionos.com> X-Mailer: git-send-email 2.47.3 In-Reply-To: <20260706072450.3920010-1-max.kellermann@ionos.com> References: <20260706072450.3920010-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 61d7c0b8161f..bdb82f123033 100644 --- a/fs/ceph/inode.c +++ b/fs/ceph/inode.c @@ -681,7 +681,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; @@ -866,6 +868,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); @@ -873,6 +876,7 @@ int ceph_fill_file_size(struct inode *inode, int issued, } else { ci->i_truncate_pagecache_size = truncate_size; } +#endif } return queue_trunc; } @@ -2332,7 +2336,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); @@ -2342,7 +2346,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 3cbd320b49a8..7023af704e14 100644 --- a/fs/ceph/super.h +++ b/fs/ceph/super.h @@ -468,11 +468,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 */ @@ -667,6 +670,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_FS_ENCRYPTION + return ci->i_truncate_pagecache_size; +#else + return ci->i_truncate_size; +#endif +} /* * Ceph inode. -- 2.47.3