From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-pl1-f171.google.com (mail-pl1-f171.google.com [209.85.214.171]) (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 204EB3314DB for ; Fri, 19 Dec 2025 20:07:13 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.214.171 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1766174836; cv=none; b=dMwiKUmziow+LoIBZ5V54CoqC19fnzs9vX8y1T4wpSH1G20gVrXeMX9m7X86fboU624jqsOaR47NeQIBqHrSNrksVIOsXXGDbtimhXq6e9wQurdvGcX10DAxBo9gov5kdCKRtrS1/aLTdM+1+BrW081oGo7P/U5SMipSUA52bJA= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1766174836; c=relaxed/simple; bh=x9g+r0B1cV6KQvgRgL/L46NdgXxy7px+2XlJPSBHJWI=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=u8TBlaX4gl9nn1zAjIUgLFXlwURen9t1owIRp1wZR0lBXWY2R50LGhflECiY+jlb6oSQwDQu5DuQtx+8sErwKRso9eD97AqswK6NMQZjt9P9ZRpSp/mKlJaZu/T1hS0eJhKMQadHHdDJ0cNpJjQcucjSV0f86Ej79uZkyzJAzWo= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com; spf=pass smtp.mailfrom=google.com; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b=jFoMRcnM; arc=none smtp.client-ip=209.85.214.171 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=google.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="jFoMRcnM" Received: by mail-pl1-f171.google.com with SMTP id d9443c01a7336-29e0753e5d8so211165ad.1 for ; Fri, 19 Dec 2025 12:07:13 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1766174833; x=1766779633; darn=vger.kernel.org; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:from:to:cc:subject:date:message-id:reply-to; bh=5chjM/Sk5rfJ/BgyBe1pD3THP6lmKgHTA4tgTmqpYoA=; b=jFoMRcnM/mngjR60SX/BohuB5r8ie3mOaMzLGzBgQm0ryC3nMVEpHoaQ7hgK8CGNv6 2m7AyXA6/Tbh6L3aqTAdhfzYqqkHoP3QoOKXcztE8uhHOLKigf4TNzN0DtOF+fsfzbN3 PxywGipQ8nfjHmOPjqMHwXgzsaSH/FqlZoYX7y9Ywkh5E2OALxJnXlRmnq210qaUK7lM cKK9pt3+xkFxVZWzQvdvY2DAVCfaRoDOtr+RTS3PkH3YbRJFVbEKmCT0zUN3rFwY/Q+R +oDly2S8iaaWgi0OtexZf/E2DmOKZCbV6QdFFvHjpmc6ZvU5mGtO/kCpUcpAX9nfkjnw VDCw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1766174833; x=1766779633; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-gg:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=5chjM/Sk5rfJ/BgyBe1pD3THP6lmKgHTA4tgTmqpYoA=; b=O61GuLf9/ya8O9tT60D9pwj3wnufPunR0JRjXipQbJlODY8XezMFkxkbI166WxVadi 0Qzq/gXS2vaGJaDe/hw52LLopgy2Ju+Dt7C0Ao7jBdECsSEJv2oGVwpCWHiDVuG4Zqlp LJdPH/kvikt+hjkoJzxy5gQpZNzLdKUuaJqraQ+iw++O0j5Kd6WBxNHdSwRxn4mohPfD UNNW5eIfuM/Rys4RmW9SitEvF3Nlyq4eQb6GCwtHB7Te/ToNiXE2Qc/ReQKnPGL+lvAI UaWuWu/rBud4wbNUteezKGuRSTU8lEWgOu9ct6+LBAYLC1eiGIuIrgl+ne83DDfJ9Fpg zk6g== X-Forwarded-Encrypted: i=1; AJvYcCVUWFCh6GyvUp0/NmwI45L4AGMEPgaqDWN19iCe8s0FOJVTA3TsZ/M48aHZcUtnc0KzFOxZ8armYDtDiP4=@vger.kernel.org X-Gm-Message-State: AOJu0YwPQVzSzqBA6ANNzoikCG8Eb3TPsAeBnSNL/RZIpQC7BHHvBnvt GublAzeNVkXtUbsU6/Hz+1N6ZA85KswHAbXDr4527rq+rfsJnsdzXe5goe8Bxa5fHg== X-Gm-Gg: AY/fxX71BbQ5VjTp/4o0t58eVML6K52HrqwF5lARjRpxFqJx18fm2LqF3W32PZYDVF9 35TyMOmuJE6WqC/xjDtt7eHtMVWaCN+rOy0XQit0xz/cH3okiXgCXSaTen2ODKhedrdlr+mDLMd LvdhfrYf2b4Qrl4GZeTjwqwFHZjZZldxJOGIEMrBWud/H0EQVN2BmgOlcD/Sug22X58JIul2gv1 M9t/uo3KSc00DBnb1IBtxeMOFjW0hgsdoKxS6kcvfzkkVrh//aQHFIVbMKghdPd9s+dLbPYW0Yb 3eMsK6OsiKgIuudDli60vIs0BKSg+GfX0zncBqR/FzQkr/NyTNbp5GOsN2ALNtRLGyT6SitdbXS 2jPRfgqxsa/RrswRzqdJpN2jlsdZpX2CjML2hs9JpJDHiR6FwJpbNPKEZF0qCRwNjT5zV7s2zfk m1lmbXb1bb2lwIVeBIOOMOWBGInM7/Kz8kF3g2lze1LxPywVczDvBHyUsT56k1hEt5Pg== X-Google-Smtp-Source: AGHT+IGraRFRdepC6AoX90L9fIl2imC1ZhHdm4L7Q8WhmO4BhOfo+SNFGmPnlklnJALRX5/FaYMKyg== X-Received: by 2002:a17:902:ce0d:b0:294:d42c:ca0f with SMTP id d9443c01a7336-2a31177cf63mr504845ad.2.1766174832616; Fri, 19 Dec 2025 12:07:12 -0800 (PST) Received: from google.com (99.181.125.34.bc.googleusercontent.com. [34.125.181.99]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-2a2f3c82a10sm30046535ad.26.2025.12.19.12.07.11 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 19 Dec 2025 12:07:12 -0800 (PST) Date: Fri, 19 Dec 2025 20:07:08 +0000 From: Sami Tolvanen To: Eric Biggers Cc: dm-devel@lists.linux.dev, Alasdair Kergon , Mike Snitzer , Mikulas Patocka , Benjamin Marzinski , Eran Messeri , linux-kernel@vger.kernel.org Subject: Re: [PATCH v2 2/7] dm-verity: make dm_verity_fec_io::bufs variable-length Message-ID: <20251219200708.GA2662043@google.com> References: <20251219192909.385494-1-ebiggers@kernel.org> <20251219192909.385494-3-ebiggers@kernel.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20251219192909.385494-3-ebiggers@kernel.org> On Fri, Dec 19, 2025 at 11:29:04AM -0800, Eric Biggers wrote: > When correcting a data block, the FEC code performs optimally when it > has enough buffers to hold all the needed RS blocks. That number of > buffers is '1 << (v->data_dev_block_bits - DM_VERITY_FEC_BUF_RS_BITS)'. > > However, since v->data_dev_block_bits isn't a compile-time constant, the > code actually used PAGE_SHIFT instead. > > With the traditional PAGE_SIZE == data_block_size == 4096, this was > fine. However, when PAGE_SIZE > data_block_size, this wastes space. > E.g., with data_block_size == 4096 && PAGE_SIZE == 16384, struct > dm_verity_fec_io is 9240 bytes, when in fact only 3096 bytes are needed. > > Fix this by making dm_verity_fec_io::bufs a variable-length array. > > This makes the macros DM_VERITY_FEC_BUF_MAX and > fec_for_each_extra_buffer() no longer apply, so remove them. For > consistency, and because DM_VERITY_FEC_BUF_PREALLOC is fixed at 1 and > was already assumed to be 1 (considering that mempool_alloc() shouldn't > be called in a loop), also remove the related macros > DM_VERITY_FEC_BUF_PREALLOC and fec_for_each_prealloc_buffer(). > > Signed-off-by: Eric Biggers Reviewed-by: Sami Tolvanen Sami