From nobody Mon Feb 9 03:11:03 2026 Received: from mail-dy1-f228.google.com (mail-dy1-f228.google.com [74.125.82.228]) (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 E56C92FF14C for ; Thu, 8 Jan 2026 17:22:31 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=74.125.82.228 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1767892953; cv=none; b=O/ze2mSjQiLp2yK5BOKLqSHrXgRLqn0Iny/jsecZboIrMwJzrr/qokEsYAllxdKkYP7vyB0KZAmh6MEoxz71a8g/JGhZ+aVlUwStZ8Yyv21HBDG/BWao+itQwX7m6w0XHuI7nISing7t/93svvaxFJgJRWrUXsE3ogQMiLv191g= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1767892953; c=relaxed/simple; bh=uSp6bgEKbOC3tTzvHqcKfBiWs/omsHUdUObr3QB3yFg=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=oufArWkmg7uFwz6u6I2nmyPzIaciXPI9QggACh8SRoakq9JCimNfz958dINapYlWDhDt/Hs2NpsrPaDQPzYz45qTkmX7ySniv0SA36Ds5pVvzKz9oWmEQeminfQX+FaRLzn3bEKwjwM+Aly8Wv5265SRps0P+zdU6NHlw5va0K4= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=purestorage.com; spf=fail smtp.mailfrom=purestorage.com; dkim=pass (2048-bit key) header.d=purestorage.com header.i=@purestorage.com header.b=Mstndcqe; arc=none smtp.client-ip=74.125.82.228 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=purestorage.com Authentication-Results: smtp.subspace.kernel.org; spf=fail smtp.mailfrom=purestorage.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=purestorage.com header.i=@purestorage.com header.b="Mstndcqe" Received: by mail-dy1-f228.google.com with SMTP id 5a478bee46e88-2a49022ae5dso210794eec.1 for ; Thu, 08 Jan 2026 09:22:31 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=purestorage.com; s=google2022; t=1767892951; x=1768497751; 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=mGTTq8K3vQ+V+uQpl8CqSqa2h/Tj/HL+yYnwJhFFpIE=; b=Mstndcqe7JoWjeRacZGw3DMPhZ5pFIhSg9eTj7v7gVu27+aLfux6wLaBUzpBrE1Ep5 EbufN0R52mYWR4KaBtL4SJM4TumoWCCB+oUYf5NsUsq2lYLrzmk1qW1xL3qNDZ5mBjMy sM0kc7tZg2L29F0VIS62J/PyGivNzdyjA2ndDaiEZoInUpceHkPTikyJ99e7E9ojGnu3 bgx12avOsoed5Qg7NqZrkY84YRD0V5cJFTnjZ0mUohv1hKpKJerSi0wdNFsKmBGp+b1N 6P1YXGS4+J8NZgv1REP0UxIaN4qQCk59entYshzbp3zJDfud+Rolm3dZ/ZtgL+/4pd3R m6Og== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1767892951; x=1768497751; 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=mGTTq8K3vQ+V+uQpl8CqSqa2h/Tj/HL+yYnwJhFFpIE=; b=JzGjiPV32ouLoCsuwMFO9oc+umqb3eBLTg0Hx8rjUD+Yu9Sb1INVQIWke2jPrkYgQm RxI2QJIWIOfEMKl6z0kis+kM5IpMpYWl8C4rTzeqdjfEGwCM+mhVM5hB+ffAU3eg2mfV ez3dvRSNIKB/dggJYJxSmsRdhnZIgYUhRx6rg5gr9NxVh0wnKKFllgWNKRRxTxqJNr+y VTarIwYvg+3nBsi0rU+QT2OAydCL39Poc52PTbF6ozvRL50PQu8AJn5qILZP6wwkyRZy x9D3yxE7dpwAdynPxoL7yxXeU51IMzjZ3A9HRshqjyBZX0qvxl1o/cR/POd4LsdQ1jys hm/Q== X-Forwarded-Encrypted: i=1; AJvYcCXu08SLJDmoIeb8/9CvcFxNCdW+A6DXb+8xoGSnXQUmYbIzXaJK7M94WDV7RYKAgrFFhaC1f5tdAlz234U=@vger.kernel.org X-Gm-Message-State: AOJu0Yzzv8f92hfHbT1sjdbsIoiDmO40c34Qqwm5jqVKARGlUGrEqOv+ sggb0Wkl9l5q8EVU7cAepMuFMZjYGBjDSWwY4YO9YGxn+zliTT/8e2Pesi2TKOrJlVQNP3A2AQ3 D7tUGWP/XoKMkXJ1801RJIpJO0mDFB3KfOt0biCD70MX+MRyuT8CH X-Gm-Gg: AY/fxX7z3t5F39hZwws7OKcs6IGRdzL/mtibVrMAKZWhTmjWcYzSTXv5J5a/nywsdg0 No0JBjkGlQnx4s8tTO5aoEOxoEOoH2wcwS3odC2cx8PPsnT/iphbRN7UTxfXAJReOidMvYXnFge gX530MkgmSzoL598j0/b8ZI4Wp6sb+4x0SfrlgP6pQgcwhDV3WjaCKYZQC7/09/alcXqkiVxNd5 mOxKBiI7VlP8lfN2eCLbiPolc9DpWsj7JL5TqGka1duAZVbVeko8BrFdjjGELzNbr8BPMNbwpF0 l2Y4b9u4aTqMn7p/EJfKckw4R18OOk2gkYTq1MfGfPzvxndhIA1BpQGJ+u9FUJhVKJf45iEA9fo +etAlt26MaKBzt32LxaXWFPW5B8I= X-Google-Smtp-Source: AGHT+IFJWaVqXL8QZVhWAMzKEfobRXwlVmAyoGeEH2E3UTRcXBRpGCtErafdB8C1hiJLzqQPDnJzA1hizh0L X-Received: by 2002:a05:7022:2483:b0:122:33e:6ec1 with SMTP id a92af1059eb24-122033e706emr617564c88.0.1767892950828; Thu, 08 Jan 2026 09:22:30 -0800 (PST) Received: from c7-smtp-2023.dev.purestorage.com ([2620:125:9017:12:36:3:5:0]) by smtp-relay.gmail.com with ESMTPS id a92af1059eb24-121f23c0e38sm1872968c88.0.2026.01.08.09.22.30 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 08 Jan 2026 09:22:30 -0800 (PST) X-Relaying-Domain: purestorage.com Received: from dev-csander.dev.purestorage.com (dev-csander.dev.purestorage.com [10.112.6.120]) by c7-smtp-2023.dev.purestorage.com (Postfix) with ESMTP id 5BE58340794; Thu, 8 Jan 2026 10:22:30 -0700 (MST) Received: by dev-csander.dev.purestorage.com (Postfix, from userid 1557716354) id 51786E42165; Thu, 8 Jan 2026 10:22:30 -0700 (MST) From: Caleb Sander Mateos To: Jens Axboe Cc: linux-block@vger.kernel.org, linux-kernel@vger.kernel.org, Anuj Gupta , Christoph Hellwig , Caleb Sander Mateos Subject: [PATCH v2 3/3] block: use pi_tuple_size in bi_offload_capable() Date: Thu, 8 Jan 2026 10:22:12 -0700 Message-ID: <20260108172212.1402119-4-csander@purestorage.com> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20260108172212.1402119-1-csander@purestorage.com> References: <20260108172212.1402119-1-csander@purestorage.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" bi_offload_capable() returns whether a block device's metadata size matches its PI tuple size. Use pi_tuple_size instead of switching on csum_type. This makes the code considerably simpler and less branchy. Signed-off-by: Caleb Sander Mateos Reviewed-by: Anuj Gupta Reviewed-by: Christoph Hellwig --- block/bio-integrity-auto.c | 14 +------------- 1 file changed, 1 insertion(+), 13 deletions(-) diff --git a/block/bio-integrity-auto.c b/block/bio-integrity-auto.c index 605403b52c90..626bbe17eb23 100644 --- a/block/bio-integrity-auto.c +++ b/block/bio-integrity-auto.c @@ -50,23 +50,11 @@ static bool bip_should_check(struct bio_integrity_paylo= ad *bip) return bip->bip_flags & BIP_CHECK_FLAGS; } =20 static bool bi_offload_capable(struct blk_integrity *bi) { - switch (bi->csum_type) { - case BLK_INTEGRITY_CSUM_CRC64: - return bi->metadata_size =3D=3D sizeof(struct crc64_pi_tuple); - case BLK_INTEGRITY_CSUM_CRC: - case BLK_INTEGRITY_CSUM_IP: - return bi->metadata_size =3D=3D sizeof(struct t10_pi_tuple); - default: - pr_warn_once("%s: unknown integrity checksum type:%d\n", - __func__, bi->csum_type); - fallthrough; - case BLK_INTEGRITY_CSUM_NONE: - return false; - } + return bi->metadata_size =3D=3D bi->pi_tuple_size; } =20 /** * __bio_integrity_endio - Integrity I/O completion function * @bio: Protected bio --=20 2.45.2