From patchwork Fri Feb 9 16:40:11 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Max Kellermann X-Patchwork-Id: 199012 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:50ea:b0:106:860b:bbdd with SMTP id r10csp988658dyd; Fri, 9 Feb 2024 09:00:56 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCUVPP5R1VoQpOAAUEwX2vvPrSi0fIqKhmi5FF1y2nEyACJaVczvjERtUV9+qB3iEtDI4hOjySY6bZVRrUEWrx5A/nYS4g== X-Google-Smtp-Source: AGHT+IG2hBkzR1LoluivZkhoswqoRk5IktJokRhmAzLwWd3AQMmnfuysW2h1uds+UB3yU/9E+auW X-Received: by 2002:a17:902:784e:b0:1d9:6dc6:6616 with SMTP id e14-20020a170902784e00b001d96dc66616mr1931675pln.68.1707498055794; Fri, 09 Feb 2024 09:00:55 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1707498055; cv=pass; d=google.com; s=arc-20160816; b=WfE4xfNYC6lVxaOHgRhHkoqTkznajN2J74yr+LW1NIbQDp/y0Kq44rpfh8woP21XJn s2cmhh1diyilkyMxtY/Cv8+hbdjkBHlvZ0AuVL9SIxthhF9ED8sD8j8UkBh1Z+KDHGYJ WsoXn8f0o+bVUGQOdIDI6ZHFlX6PJNHAP0/IOZ6gUwJzKWUV87Kz8G0w9e+Qn7A8e8xt y8oZzdqAc/4IJRbtl8Dr0/rXr6rJ7k7u7bMUPD/R9DpFyVjGTomHHtgWu1AvOf7pmjYB IitU3mzN26pSoxKHBGpdeExwKHYDjDuy5obD9UvojVE4Prdp/OXq7AgbnytXdZVgH9Yx wzUw== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=EFeTZjQEhgBEZLUg6ibjUuFIwmiiAedXiRWCbx5Msz4=; fh=/0LAvmFqEpYFtx80jVlPqKR/F/kd+AbGFI8gbT26I2s=; b=OVTH0sxW6CuRI8x9Lcrcy3+VbXRXUcRKui87WApkuqB0fwXl2w25iclp58GuUd5tDX U+LDDm5xDBZqslQkE/z+qB9WEtAHtNUpnKinerOGa8k2F4Y/oEqGVlXASaef26V+Bz2Z GW5dMrm7YH2Mp3752V4AyrwZ7P0/eVJMQJA3dHI6wDFTBrgjgxzJV85geWOlNEM98bIo gT3/uVp2F6l3H1VEA9ZSisJ8FdEfps1JahsFe3LUqhAedATl/BPo4FoVLsTSs+qtXdCP jSiWEJ975RdMP5Y6BMMiqnye+2gkc9fEan66/SfZljYPuMXxx7sXBpbDFAELV3VVMDQq N1Qw==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@ionos.com header.s=google header.b="aQ/XmkdQ"; arc=pass (i=1 spf=pass spfdomain=ionos.com dkim=pass dkdomain=ionos.com dmarc=pass fromdomain=ionos.com); spf=pass (google.com: domain of linux-kernel+bounces-59637-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-59637-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=ionos.com X-Forwarded-Encrypted: i=2; AJvYcCVVYLQV/Kf8mX5jBa+LhQktdwguZjvvFOe12D5VXciqBxqEn8XFpu+CdNV5Xf/l+plJqTC1vylj6TjfZ+y247EQatAp0A== Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [147.75.48.161]) by mx.google.com with ESMTPS id q13-20020a170902dacd00b001d72ba4b3cbsi2056211plx.44.2024.02.09.09.00.55 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 09 Feb 2024 09:00:55 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-59637-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) client-ip=147.75.48.161; Authentication-Results: mx.google.com; dkim=pass header.i=@ionos.com header.s=google header.b="aQ/XmkdQ"; arc=pass (i=1 spf=pass spfdomain=ionos.com dkim=pass dkdomain=ionos.com dmarc=pass fromdomain=ionos.com); spf=pass (google.com: domain of linux-kernel+bounces-59637-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-59637-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=ionos.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sy.mirrors.kernel.org (Postfix) with ESMTPS id 02349B21B88 for ; Fri, 9 Feb 2024 16:44:40 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 67E521292FD; Fri, 9 Feb 2024 16:41:18 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=ionos.com header.i=@ionos.com header.b="aQ/XmkdQ" Received: from mail-ej1-f44.google.com (mail-ej1-f44.google.com [209.85.218.44]) (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 357C0823AA for ; Fri, 9 Feb 2024 16:41:05 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.218.44 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707496869; cv=none; b=SvSJhuZkAD+IOggXcDdk9M7smB95hF1XcHOp7+9NA+/ogGtDG8lh73OKRvnDFHTLnGkPuECrMDIJ3HyzwofQpptGunebYpLI2R8MMxJ27KAgbJOJM4fJuh8FBzRTKls2EDR/NciTVeI2BNeJ7lXqH7NGwkcIB+Cz/E3eM9Xfj0w= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707496869; c=relaxed/simple; bh=6/y0RKR7g9worsePTPRSST8SmwmbabeGMZ/hQjJ+S8E=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=f8qDl+Sr7VAv97t7ZYve2lvg3UZixAMOFAiSO/Nk1e8/2P6R/c1ySBQemdKjdt73nngPQKAYQP6NOmi8nlL8RhvnSm3i8Xwq0XcJNq3M/5hoOeO/8IICGjuz7twZdLgiMOfzsbKi+nmazawwRnIpzbU/TeYi3Lj9LEolDtN5sXU= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine 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=aQ/XmkdQ; arc=none smtp.client-ip=209.85.218.44 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=ionos.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=ionos.com Received: by mail-ej1-f44.google.com with SMTP id a640c23a62f3a-a3bf9012637so89502666b.1 for ; Fri, 09 Feb 2024 08:41:05 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ionos.com; s=google; t=1707496864; x=1708101664; 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=EFeTZjQEhgBEZLUg6ibjUuFIwmiiAedXiRWCbx5Msz4=; b=aQ/XmkdQ8jefAforhzGRI9ZcfeOgA7Rba8JHpvbcavul8Qk0cG01WSuU6jdVIFlPaG PjYg6OiQozxnEcy+pLeZu8fK8g1GgJ1XKEm1eNQyNH8Vs+RzhYzlKBTw2f3QJqQ3HVI/ SJOOFtj6vsWrRNwEWliwAgiVxakEwcDLSiklhObW2e56Gr1W3r/sycorltVa3C2Ny6Ai 9ytXM08IDCK0U2EFXrvdkNwPU6jcGAqj+nwaMaLxlNAf5XFDIhYgBgOsrhPfLgiYG929 UwFxBjbOim0E3fww7IYyWCDjlVHF18n6ZwjyFnNfRSVRqZELHU/hAGkSJWandGFDfJcY Ib4A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1707496864; x=1708101664; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=EFeTZjQEhgBEZLUg6ibjUuFIwmiiAedXiRWCbx5Msz4=; b=NW3mV7qM5SlDs5hhqPVR7leW22EzhbTVp9on06p4h6lByqVBHUe7DRwjnwWxqcpTsH GSWMUu8ZAoBYnWSe9Az64+iokuQql6k0WVIMPhHTv/AWoWB5i2K0UnY0RbM5R8Bi5sWe hD5TXFKZmqelrdbWPhkq/mawpwFv9Pir7tjGQiuLr/nWq/wvwMFfxkmRMYJ5JJWxzjqY /U1Oak/9ztFSsbRwQNhQ8mqfll/M48mYoNZg0O5kg5+P4yXbQDdnc8TFlqSih2G7cJwt THEIXJXmgNQvArWaTiSgj37+uPj4u2aLektV+0FnOTn4RnTKqTLqt18WXXfICQ5jgPDE yWJA== X-Gm-Message-State: AOJu0YyFXJpcru0Yzl5OqwmRwHRzE8VNom5xHygpkcYBgBkB0jSS4Ceb KKqFFInyXY0VBT5PRdsKGAITUeQupdNgplCz6uEjCn5MEOE03u9s2KzEYDQ+gjD+cNvLofbEYyE B X-Received: by 2002:a17:906:789:b0:a3c:17c:1e48 with SMTP id l9-20020a170906078900b00a3c017c1e48mr1180454ejc.31.1707496864061; Fri, 09 Feb 2024 08:41:04 -0800 (PST) Received: from raven.intern.cm-ag (p200300dc6f267100023064fffe740809.dip0.t-ipconnect.de. [2003:dc:6f26:7100:230:64ff:fe74:809]) by smtp.gmail.com with ESMTPSA id tl27-20020a170907c31b00b00a3bfe97fe27sm477724ejc.218.2024.02.09.08.41.03 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 09 Feb 2024 08:41:03 -0800 (PST) From: Max Kellermann To: linux-kernel@vger.kernel.org Cc: Max Kellermann Subject: [PATCH v2 19/35] bio.h: move bio_has_data() and bio_no_advance_iter() to blk_types.h Date: Fri, 9 Feb 2024 17:40:11 +0100 Message-Id: <20240209164027.2582906-20-max.kellermann@ionos.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20240209164027.2582906-1-max.kellermann@ionos.com> References: <20240209164027.2582906-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 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1790441480704659455 X-GMAIL-MSGID: 1790441480704659455 "struct bio" has nothing to do with "bio.h", the naming is just confusing. This move will allow narrowing other dependencies later. Signed-off-by: Max Kellermann --- include/linux/bio.h | 22 ---------------------- include/linux/blk_types.h | 23 +++++++++++++++++++++++ 2 files changed, 23 insertions(+), 22 deletions(-) diff --git a/include/linux/bio.h b/include/linux/bio.h index afae5a73b7cd..b8562d4b57b2 100644 --- a/include/linux/bio.h +++ b/include/linux/bio.h @@ -49,28 +49,6 @@ static inline unsigned int bio_max_segs(unsigned int nr_segs) #define bio_data_dir(bio) \ (op_is_write(bio_op(bio)) ? WRITE : READ) -/* - * Check whether this bio carries any data or not. A NULL bio is allowed. - */ -static inline bool bio_has_data(struct bio *bio) -{ - if (bio && - bio->bi_iter.bi_size && - bio_op(bio) != REQ_OP_DISCARD && - bio_op(bio) != REQ_OP_SECURE_ERASE && - bio_op(bio) != REQ_OP_WRITE_ZEROES) - return true; - - return false; -} - -static inline bool bio_no_advance_iter(const struct bio *bio) -{ - return bio_op(bio) == REQ_OP_DISCARD || - bio_op(bio) == REQ_OP_SECURE_ERASE || - bio_op(bio) == REQ_OP_WRITE_ZEROES; -} - static inline void *bio_data(struct bio *bio) { if (bio_has_data(bio)) diff --git a/include/linux/blk_types.h b/include/linux/blk_types.h index ad48c3f5ddd6..313db4b9b49e 100644 --- a/include/linux/blk_types.h +++ b/include/linux/blk_types.h @@ -284,6 +284,7 @@ struct bio { #define BIO_RESET_BYTES offsetof(struct bio, bi_max_vecs) #define BIO_MAX_SECTORS (UINT_MAX >> SECTOR_SHIFT) + /* * bio flags */ @@ -434,6 +435,28 @@ static inline enum req_op bio_op(const struct bio *bio) return bio->bi_opf & REQ_OP_MASK; } +/* + * Check whether this bio carries any data or not. A NULL bio is allowed. + */ +static inline bool bio_has_data(struct bio *bio) +{ + if (bio && + bio->bi_iter.bi_size && + bio_op(bio) != REQ_OP_DISCARD && + bio_op(bio) != REQ_OP_SECURE_ERASE && + bio_op(bio) != REQ_OP_WRITE_ZEROES) + return true; + + return false; +} + +static inline bool bio_no_advance_iter(const struct bio *bio) +{ + return bio_op(bio) == REQ_OP_DISCARD || + bio_op(bio) == REQ_OP_SECURE_ERASE || + bio_op(bio) == REQ_OP_WRITE_ZEROES; +} + static inline bool blk_op_is_passthrough(blk_opf_t op) { op &= REQ_OP_MASK;