From patchwork Wed Jan 31 14:49:59 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Max Kellermann X-Patchwork-Id: 194821 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7301:2087:b0:106:209c:c626 with SMTP id gs7csp1968209dyb; Wed, 31 Jan 2024 07:32:31 -0800 (PST) X-Google-Smtp-Source: AGHT+IEddSzU8GqTsPLjSre/Kig+NPnenEDfpDHhMALcQkAvTi9Vj5z829AsYMYM4MM78uRQFkks X-Received: by 2002:a05:6a20:7a24:b0:19c:955e:7100 with SMTP id t36-20020a056a207a2400b0019c955e7100mr1599625pzh.62.1706715151201; Wed, 31 Jan 2024 07:32:31 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1706715151; cv=pass; d=google.com; s=arc-20160816; b=dikk3OqBeAStY16+GbClMNN1uuj1GydGXK+a/1vLazHZalP1YfMV8/deQ48LqNYtln 6GEx2KNr9NywPpYw45+3RaaaeKpdQfIRuRY0fWv6csUhSIGc1R+VxE7HJPdQffB/GinS CTNPSqEStj05NIJ23F5ZNv5+39M/F5Rd36zS9sHzDhwodZK0P8X3Cy8gNeMRnXo2ukDX 8M6ILGd5QGOk+IhxsUeQXLNrJxsFtVwCiR8677N05efWxtgs7OT+d244dvGp+mBUIvyT 0eK2angVoU5nlVH4sFbTAWtT0O+TlEeYhXg/SXs/+P1UvKFQGiTOe13PccXaGrtExyOv jVzA== 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=cydhL+ApQPkEdxBoPMjR2s4yTlEuphbbkRtD/j7jasc=; b=bJNRiqt1ut744U698YHfWOdfOVP70SMJTOu4ZLOUokMunGV1V5DYBhk1ZXAR4bUWMw pgrFkyDHL1L55BzWqAD31ATGQMaWjQVAUFrPvqJ+ymDpl6SDCPv/FLV+DmN/zLaIA1q6 n+lgFJxpNCUCs+8m9/oN1XUHPCzu0HQt9GlOV6PxupNMj2RpHfh2WyP0o5qRvXhhgJ8f Ob+l84zli/roG6frp83LH3OIajllQld6uVizAUBfW/R+J28ZKTerVWUrpD6KVNFrxQMA d6ipEeuzmg/xyJE5v3omQTe3S5fMPoVbRpBFYyyrwv8WJh3FUz7dT3zUZG2BNM6q4lJC ynng==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@ionos.com header.s=google header.b=MxkNGR+V; 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-46650-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-46650-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=ionos.com X-Forwarded-Encrypted: i=1; AJvYcCX8JfgDlIV+t18tAOkCyytxzfJlmC90S155Aa9D5iS1zorlPIiBf+a6rStGm987GfBfSEfecBdjsykSll76dpsdlhFGGA== Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [147.75.48.161]) by mx.google.com with ESMTPS id gx11-20020a056a001e0b00b006ddd026d1d8si9784773pfb.60.2024.01.31.07.32.30 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 31 Jan 2024 07:32:31 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-46650-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=MxkNGR+V; 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-46650-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-46650-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 12009B3049E for ; Wed, 31 Jan 2024 14:56:51 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 1D1A813B7B4; Wed, 31 Jan 2024 14:51:00 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=ionos.com header.i=@ionos.com header.b="MxkNGR+V" Received: from mail-wr1-f52.google.com (mail-wr1-f52.google.com [209.85.221.52]) (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 B45CA12CD9B for ; Wed, 31 Jan 2024 14:50:33 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.221.52 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706712637; cv=none; b=GS1O99NEPLf/oqmsdC7NEdRtU0NeOZR62klct3NqWFawLfOxZdiTV/wJuMqAshdK1PVF64sUJ93dJjqzVH6i0v9XytldVb470edD2aTXKvHFcdhyWfOcE2qvnsd81rP6HbFLcceMcRVJxR+5DZebHUSMtjCPCHl/qMri2+uAuDU= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706712637; c=relaxed/simple; bh=6/y0RKR7g9worsePTPRSST8SmwmbabeGMZ/hQjJ+S8E=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=bFIrBsFDrMHkQTRmu+ny0/eK2VdHyjQz7BeQQt0TwiYswY26CS6jkDUvbiy0sbHCDfWwjyDcc6ZGyW5h/ApOv/UCzwilvqoVp687PVzJwiwps03ldBWEjc+0S1FrlZYQzuu1L6BaG/t4zRDSyjjs5GC7qjtNlm+7YylLMOOv/Cs= 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=MxkNGR+V; arc=none smtp.client-ip=209.85.221.52 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-wr1-f52.google.com with SMTP id ffacd0b85a97d-33af40493f4so1832224f8f.3 for ; Wed, 31 Jan 2024 06:50:33 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ionos.com; s=google; t=1706712631; x=1707317431; 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=MxkNGR+Vm1kv6dDSLCe4WZKJwdD2arigdg5i2j+xFYEks1P5J5lUh76sycBJZL3eDw XJE4ziF3v+l3ubq0NiBBnYyNjgJN3MMn63tiLV35Djx+H4rBKYiLH0RdbYEDECQ2sEV6 uh7pewJsPc7jYrmMBVuordcwscT3fa5lpgpsH1GuTaUR/WZMWskXdPpsERZ0AToPNxjY udmpB+bY1SUwhMFsHPCy0ccrUMRBr+umNur0UNBOrNKclm78qo5RxDRSlJCTjT5GYKKu Aw4huEX5igUQV5sZnGq9Cu0V8N1nSYR5ZR5TpE67lttQwO+xoRB0xoTIfUXnBE1feU5A iygA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1706712631; x=1707317431; 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=AMi6IPpRMWxkEWfaBToUTrBySiRwmRNr/u6sH4T75fiO/zHfTUJJ+1vbqJjU4ldzKW 7P6N9/vzyHp4GCTPkHg9NZXqmNtwx+O6+7J6FekRP6RlPDtxTfcmaqzfaJZZB+QasRCo RlHDnTD2ODP3f0JcYTy3cekqvt3B4kGvN1zhzxjgE6R/RsvdaKhceYHzJlpfesLK3KnW gQJjrTTvokMOA038ZYG3KWASf2h8tjOSoIiI286QQhgAZilglLe5HC9N/RhinJzbfPOQ cd1PZ/ZwKbhcQ6KomHIpPlo5m+EJvgrJwpfdTMxNqraZvDwu9sRITYEi68u4o+rnp6zL T7gg== X-Gm-Message-State: AOJu0YzYsJ6wn1U0UXcfpJLuoE51RAWFXNfXpQRx+IJ37wMB64dTvbl6 gF609IaI/CxK4RVqq8T2u5x7OnAZvX1mcg/a02zGurU8VPeonYbg6kvIHQloSfJ98SqiIJ48Tbs d X-Received: by 2002:a5d:4ac4:0:b0:337:7086:b6f3 with SMTP id y4-20020a5d4ac4000000b003377086b6f3mr1346308wrs.21.1706712631671; Wed, 31 Jan 2024 06:50:31 -0800 (PST) Received: from raven.blarg.de (p200300dc6f2f5c00023064fffe740809.dip0.t-ipconnect.de. [2003:dc:6f2f:5c00:230:64ff:fe74:809]) by smtp.gmail.com with ESMTPSA id ch15-20020a5d5d0f000000b0033905a60689sm13850173wrb.45.2024.01.31.06.50.30 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 31 Jan 2024 06:50:31 -0800 (PST) From: Max Kellermann To: linux-kernel@vger.kernel.org Cc: Max Kellermann Subject: [PATCH 19/28] bio.h: move bio_has_data() and bio_no_advance_iter() to blk_types.h Date: Wed, 31 Jan 2024 15:49:59 +0100 Message-Id: <20240131145008.1345531-20-max.kellermann@ionos.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20240131145008.1345531-1-max.kellermann@ionos.com> References: <20240131145008.1345531-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: 1789620546428397835 X-GMAIL-MSGID: 1789620546428397835 "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;