Received: by 2002:a05:7412:d1aa:b0:fc:a2b0:25d7 with SMTP id ba42csp1722302rdb; Wed, 31 Jan 2024 07:16:59 -0800 (PST) X-Google-Smtp-Source: AGHT+IFY6P3gHo/JNACvHhX/vRW3i/2MbYTKnJF5doLo6YT2Byy5vRiB33xI/JHjMf4w8RrNZtxe X-Received: by 2002:a05:6a20:1824:b0:19c:a2aa:67f8 with SMTP id bk36-20020a056a20182400b0019ca2aa67f8mr1761425pzb.24.1706714219440; Wed, 31 Jan 2024 07:16:59 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1706714219; cv=pass; d=google.com; s=arc-20160816; b=bnhw2n656NK5HXO6Bg/LIujsYXz5iGftBSparec7kNT5PC9u11wA8by33x6gKOpv6X 89Xm9R56pKol+hfIAtU61o114d7X6jB/+jezP11DAtcmY2v9d8wIZrqDodKMZW9X/rTj T4CvFWhat3AsL5Y5gqJrWR+rvAkI0fa9MBTeOc2zaYgIbufBEa4v8EsHv7GHYeMysqJn zj1zISH9uplc9tkPat6ylINDbfPBUgm3cTloszquCtiWcJFmZF3sevJfQmpOGolNDFGU UtwlyWe1tCaxaM21lbdAOwL5DC1xvi4HjGiF+l+WdpUSblnMvt8JRw1bWqtMJFuyhPG6 5hsw== 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=oiFBM/EMkCCkjB2eKBAcYBjIG3J3PbUJDIO7IjNITIw=; fh=eTgx0pyNQ3DrMOaawnfr37NYV7YlPNXDujCZYAFckPA=; b=ry8Yy7O6n5P5InR4L6bDHRRcEqRCiDJKJ0SjKEAre5Tg0e3yu6lsZBzVllK+uWeokC xgk1Y1JFekwOAxiJcAInk6JkNEbeZr0QIpTESpQHy0E4CrgHGJ0AWhVv1jmAP7mwEDEZ fvrzBNwLCKxH0VcvW0YDEg9IZLGISLb1Mn7ZEr7baAQcbaVtVc6FOeFLY+rsu6PeqXC8 f3F0U5aSDmNWlQGldnDKPG3D4u7SzwigiX5HH8a/c+p+P6bEJViRLWNN7N6faMeGFWCK T+cizBijem3vDz32MpvggAu8CtPVZKvy+T3xtfDCK1wzCld/CASuIdRi1E0PS7GLIyYP Jt4Q==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@ionos.com header.s=google header.b=UGvQSYJx; 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-46652-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-46652-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=ionos.com X-Forwarded-Encrypted: i=1; AJvYcCUlTHv/nR75TwroFZ3ktUNgHoDJ87cvohe7XZD/bOB1kGi8b1/zBhAxcOxoSn1w9NQ/WZ3myxZ4G6BxsBYSjAT/lUilUmFlgOAng3IiGw== Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [139.178.88.99]) by mx.google.com with ESMTPS id le10-20020a056a004fca00b006d9b2420e50si9728667pfb.358.2024.01.31.07.16.59 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 31 Jan 2024 07:16:59 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-46652-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) client-ip=139.178.88.99; Authentication-Results: mx.google.com; dkim=pass header.i=@ionos.com header.s=google header.b=UGvQSYJx; 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-46652-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-46652-linux.lists.archive=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 sv.mirrors.kernel.org (Postfix) with ESMTPS id D8E26290D98 for ; Wed, 31 Jan 2024 14:55:09 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id DE1738288F; Wed, 31 Jan 2024 14:50:49 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=ionos.com header.i=@ionos.com header.b="UGvQSYJx" Received: from mail-wr1-f53.google.com (mail-wr1-f53.google.com [209.85.221.53]) (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 BA20012CDB5 for ; Wed, 31 Jan 2024 14:50:34 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.221.53 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706712638; cv=none; b=J4/zZYWhG6ULXdtGi8DZDI54zUQvStJi79K20zzRpCXnQicQyrT5gsvZYCbuAc1PJn0++mS8FY9gzl1eHrWrM7k9EgJPXagpgPQU1IKwx2WpiPXYK2zMI/ez2LpDWUqPHrfvTB5CVh+9F4CG0YNOHdkaDW6JCx90PDuh6naERA4= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706712638; c=relaxed/simple; bh=2TL9S1a7CAfvT5a3dQDGBKtCc+wGYZQWPNf9vz6whTc=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=g2DgYUNEjZZ5TIMzyZmeGyUH44N1CmIRumzZSqnol4AGAXeUKpwwi21o2Z/d7wTmeiyexWkcxFNNjWkRs/9oMA+NXo8+gmK7UqOTpGDofMeSV/aEyZ4E24yAtFM+jlpXGXJufY0d0YnFGVctntlxeY2T0HjzBT2cNEFmcVNfDIc= 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=UGvQSYJx; arc=none smtp.client-ip=209.85.221.53 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-f53.google.com with SMTP id ffacd0b85a97d-33af6129f3cso1438515f8f.2 for ; Wed, 31 Jan 2024 06:50:34 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ionos.com; s=google; t=1706712632; x=1707317432; 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=oiFBM/EMkCCkjB2eKBAcYBjIG3J3PbUJDIO7IjNITIw=; b=UGvQSYJxs/1mIfxf3DRfd2LyTmj5c351/aGb2gM4VqB/RCxoRWcOqy130BUvL/mE6g HjVO8KOkb8tKBtzR0UiQE98vPjv0mlgoYBBKrcaIhHprFrCuZgFGoCSxbIAJZBbT+rvQ FyNNfUa5UY7a0hOTkO50Kl7ErQQzKIvah42HKIRcir+Fy2Vis6hZDzBGMVByVNS36Ind 9W3sUJ1+7mQ7EsOl9Xi67xWx/oWmxoWfDPsnQbIpfiuRgDJk3kaLlYq8SzmUuRsd+R5J WK4K03MnPb6CZiMjMC0ZpRZq34XIum/5QSfzdSQrsX8aOVV0gyBh4KK//t+AEvyZXZjt 1DUA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1706712632; x=1707317432; 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=oiFBM/EMkCCkjB2eKBAcYBjIG3J3PbUJDIO7IjNITIw=; b=whqAg9A8D8iY9PN8447/pu7lFmw80vnW92vGbT1BP8E6dtbUkcmAbVlNdEv+gegsjT IYE0MMqfGVmZlcB70q8onI6bk37/JPgyx0+8GOJ1nRFQTmlNLOXdDTEEmFdZjd6SNmKK nWOukM182Yg1jZRVH8p8YWk+alx9/bYg3JIxQCAylWbZPWPB8zZCUb3wJSfT+vO+RO4N P2M9HIQ7DJrpZB/BFhtwceN8AIhXsvpke3/JCUxS8sFGogmZj/Yi6/sB4M91RJGpfA8t Je0JxTCn/4QZsi4GICSmYUCXs8Cd/pYGmDNzpGyOiihYwnloMWNElF205VPRI45Eauzg VJCA== X-Gm-Message-State: AOJu0YyfQNIVJtZbO7WN3BNh9v9Zkm7AU/610OPe60KGPsNXjGMuqKG1 Bo9+EXSt40IDYv3YzZESMwTU3uau1/Wxr+prU9iWPu8G3HQASw4EEKwhF1ZtmEtzi67dEb5GTaf L X-Received: by 2002:adf:e74c:0:b0:33a:e52c:975b with SMTP id c12-20020adfe74c000000b0033ae52c975bmr1347129wrn.70.1706712632530; Wed, 31 Jan 2024 06:50:32 -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.31 (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 20/28] bio.h: move declarations to bio_types.h Date: Wed, 31 Jan 2024 15:50:00 +0100 Message-Id: <20240131145008.1345531-21-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 Content-Transfer-Encoding: 8bit By providing declarations in a lean header, we can reduce header dependencies. Signed-off-by: Max Kellermann --- include/linux/bio.h | 74 +--------------------------------- include/linux/bio_types.h | 84 +++++++++++++++++++++++++++++++++++++++ include/linux/blkdev.h | 2 +- 3 files changed, 86 insertions(+), 74 deletions(-) create mode 100644 include/linux/bio_types.h diff --git a/include/linux/bio.h b/include/linux/bio.h index b8562d4b57b2..cada670f63d8 100644 --- a/include/linux/bio.h +++ b/include/linux/bio.h @@ -5,6 +5,7 @@ #ifndef __LINUX_BIO_H #define __LINUX_BIO_H +#include #include /* struct bio, bio_vec and BIO_* flags are defined in blk_types.h */ #include @@ -20,35 +21,6 @@ static inline unsigned int bio_max_segs(unsigned int nr_segs) return min(nr_segs, BIO_MAX_VECS); } -#define bio_prio(bio) (bio)->bi_ioprio -#define bio_set_prio(bio, prio) ((bio)->bi_ioprio = prio) - -#define bio_iter_iovec(bio, iter) \ - bvec_iter_bvec((bio)->bi_io_vec, (iter)) - -#define bio_iter_page(bio, iter) \ - bvec_iter_page((bio)->bi_io_vec, (iter)) -#define bio_iter_len(bio, iter) \ - bvec_iter_len((bio)->bi_io_vec, (iter)) -#define bio_iter_offset(bio, iter) \ - bvec_iter_offset((bio)->bi_io_vec, (iter)) - -#define bio_page(bio) bio_iter_page((bio), (bio)->bi_iter) -#define bio_offset(bio) bio_iter_offset((bio), (bio)->bi_iter) -#define bio_iovec(bio) bio_iter_iovec((bio), (bio)->bi_iter) - -#define bvec_iter_sectors(iter) ((iter).bi_size >> 9) -#define bvec_iter_end_sector(iter) ((iter).bi_sector + bvec_iter_sectors((iter))) - -#define bio_sectors(bio) bvec_iter_sectors((bio)->bi_iter) -#define bio_end_sector(bio) bvec_iter_end_sector((bio)->bi_iter) - -/* - * Return the data direction, READ or WRITE. - */ -#define bio_data_dir(bio) \ - (op_is_write(bio_op(bio)) ? WRITE : READ) - static inline void *bio_data(struct bio *bio) { if (bio_has_data(bio)) @@ -521,18 +493,6 @@ static inline void bio_set_dev(struct bio *bio, struct block_device *bdev) bio_associate_blkg(bio); } -/* - * BIO list management for use by remapping drivers (e.g. DM or MD) and loop. - * - * A bio_list anchors a singly-linked list of bios chained through the bi_next - * member of the bio. The bio_list also caches the last list member to allow - * fast access to the tail. - */ -struct bio_list { - struct bio *head; - struct bio *tail; -}; - static inline int bio_list_empty(const struct bio_list *bl) { return bl->head == NULL; @@ -656,38 +616,6 @@ static inline void bio_inc_remaining(struct bio *bio) */ #define BIO_POOL_SIZE 2 -struct bio_set { - struct kmem_cache *bio_slab; - unsigned int front_pad; - - /* - * per-cpu bio alloc cache - */ - struct bio_alloc_cache __percpu *cache; - - mempool_t bio_pool; - mempool_t bvec_pool; -#if defined(CONFIG_BLK_DEV_INTEGRITY) - mempool_t bio_integrity_pool; - mempool_t bvec_integrity_pool; -#endif - - unsigned int back_pad; - /* - * Deadlock avoidance for stacking block drivers: see comments in - * bio_alloc_bioset() for details - */ - spinlock_t rescue_lock; - struct bio_list rescue_list; - struct work_struct rescue_work; - struct workqueue_struct *rescue_workqueue; - - /* - * Hot un-plug notifier for the per-cpu cache, if used - */ - struct hlist_node cpuhp_dead; -}; - static inline bool bioset_initialized(struct bio_set *bs) { return bs->bio_slab != NULL; diff --git a/include/linux/bio_types.h b/include/linux/bio_types.h new file mode 100644 index 000000000000..bf0d8def2777 --- /dev/null +++ b/include/linux/bio_types.h @@ -0,0 +1,84 @@ +/* SPDX-License-Identifier: GPL-2.0 */ +/* + * Copyright (C) 2001 Jens Axboe + */ +#ifndef __LINUX_BIO_TYPES_H +#define __LINUX_BIO_TYPES_H + +#include +#include + +#define bio_prio(bio) (bio)->bi_ioprio +#define bio_set_prio(bio, prio) ((bio)->bi_ioprio = prio) + +#define bio_iter_iovec(bio, iter) \ + bvec_iter_bvec((bio)->bi_io_vec, (iter)) + +#define bio_iter_page(bio, iter) \ + bvec_iter_page((bio)->bi_io_vec, (iter)) +#define bio_iter_len(bio, iter) \ + bvec_iter_len((bio)->bi_io_vec, (iter)) +#define bio_iter_offset(bio, iter) \ + bvec_iter_offset((bio)->bi_io_vec, (iter)) + +#define bio_page(bio) bio_iter_page((bio), (bio)->bi_iter) +#define bio_offset(bio) bio_iter_offset((bio), (bio)->bi_iter) +#define bio_iovec(bio) bio_iter_iovec((bio), (bio)->bi_iter) + +#define bvec_iter_sectors(iter) ((iter).bi_size >> 9) +#define bvec_iter_end_sector(iter) ((iter).bi_sector + bvec_iter_sectors((iter))) + +#define bio_sectors(bio) bvec_iter_sectors((bio)->bi_iter) +#define bio_end_sector(bio) bvec_iter_end_sector((bio)->bi_iter) + +/* + * Return the data direction, READ or WRITE. + */ +#define bio_data_dir(bio) \ + (op_is_write(bio_op(bio)) ? WRITE : READ) + +/* + * BIO list management for use by remapping drivers (e.g. DM or MD) and loop. + * + * A bio_list anchors a singly-linked list of bios chained through the bi_next + * member of the bio. The bio_list also caches the last list member to allow + * fast access to the tail. + */ +struct bio_list { + struct bio *head; + struct bio *tail; +}; + +struct bio_set { + struct kmem_cache *bio_slab; + unsigned int front_pad; + + /* + * per-cpu bio alloc cache + */ + struct bio_alloc_cache __percpu *cache; + + mempool_t bio_pool; + mempool_t bvec_pool; +#if defined(CONFIG_BLK_DEV_INTEGRITY) + mempool_t bio_integrity_pool; + mempool_t bvec_integrity_pool; +#endif + + unsigned int back_pad; + /* + * Deadlock avoidance for stacking block drivers: see comments in + * bio_alloc_bioset() for details + */ + spinlock_t rescue_lock; + struct bio_list rescue_list; + struct work_struct rescue_work; + struct workqueue_struct *rescue_workqueue; + + /* + * Hot un-plug notifier for the per-cpu cache, if used + */ + struct hlist_node cpuhp_dead; +}; + +#endif /* __LINUX_BIO_TYPES_H */ diff --git a/include/linux/blkdev.h b/include/linux/blkdev.h index a5e41a54de18..09e8f023070c 100644 --- a/include/linux/blkdev.h +++ b/include/linux/blkdev.h @@ -14,7 +14,7 @@ #include #include #include -#include +#include #include #include #include -- 2.39.2