Received: by 2002:a05:7412:3b8b:b0:fc:a2b0:25d7 with SMTP id nd11csp1046356rdb; Fri, 9 Feb 2024 08:43:35 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCWEgNfyPIN7oUksCp0TduBzeCx17MTV2h7XOwzomb01ccvz8yam2cQY/KV9KuHfwq22u7y3KwpGNW+OMKGyI5Oee1L+u3AldxFuBMwebw== X-Google-Smtp-Source: AGHT+IHLy2IUCvtvL1T9+Z+z73MRyHE7xBBw0JXR//MB6JdFGpOc52lDRfez5C3ULuQjUzsD6FzF X-Received: by 2002:ac2:43ad:0:b0:511:62b4:2a03 with SMTP id t13-20020ac243ad000000b0051162b42a03mr1632526lfl.62.1707497015747; Fri, 09 Feb 2024 08:43:35 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1707497015; cv=pass; d=google.com; s=arc-20160816; b=nldvJ2lulXOHSaCmg6wXQMIe3AnS4VAr3ojNlcoqyVP6/emT/H7oSACk1Su8XADZsx 6cEmWUHPdwRIh+TpUAihksw63bIY1G/fj35OXrOv0aXDTlOXFhQtK4gbs3b0DEy6gX18 da8oBeK/8OzTIFcVxg7n6y+ms/Y6m0rcxA23csUy3A9XNAz2mkwzrCKt9inpwqTtFXTj WIGiT2mEW8bC+vNKaPEqlJrzaHD6LIpWwjKlPExuDuzgIfk3lYuiO7/Wqgy0nxNsvmP3 UYaELs0vDkr6bpADKkOcAhnl2txLBHpbYpwkDCyzDDAh+sh5AbWJa7Br7HerYNAwi5gU hKBQ== 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=55y/MpLm4siZas8N+/jjEVmpsMcuf6T3/F4NQL7Vz68=; fh=04jAz9+LC5/uGCbIgSH+Txq1nV7rL/sXjv6yNH7gWn8=; b=wqHVKQgNo7gYdneMlMQNFQ/wWfv509HNj22SO/fV35MPWXxn0yZBS88dOm0tE9P44U 8a6sILzSxjA/3TGN9JYo/X9D9WM3tjTYxyObjY/Uz0ZPBTx/nMPy5DE76hhRQueDOYdu ASCx4Ydy/NDQ5NwNMC7FYd7854L6hIM9PvMNNFoSN1rIhGY67FhNI3Pmm39oCxefVkQ9 SMb2eOMINyxC0mEm5AcsMR7HP2zVz8A0F4HFjPVDx+OboeJAJMDOaYARmvesIHM1AY5Q IlCo9wagfafXENoQFG5YAPt59ot3vfZaGWMHndeTJKFWH67HAZME+NUxNNT/xVtFWh28 vWEw==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@ionos.com header.s=google header.b=Pbj42Ruu; 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-59638-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-59638-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=ionos.com X-Forwarded-Encrypted: i=2; AJvYcCXWBZd1d7dT0OjX3CfpMcaJ269Wb+LIzw6sp1N0QTK6PwOIwAKjw5wWjP4yF+UH+qwA9DYqGcuJRVsLsVNnvc1u0A1jFrzSeoMMAs5srA== Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [147.75.80.249]) by mx.google.com with ESMTPS id lg23-20020a170906f89700b00a3ba3dadf53si1009185ejb.36.2024.02.09.08.43.35 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 09 Feb 2024 08:43:35 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-59638-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) client-ip=147.75.80.249; Authentication-Results: mx.google.com; dkim=pass header.i=@ionos.com header.s=google header.b=Pbj42Ruu; 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-59638-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-59638-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 am.mirrors.kernel.org (Postfix) with ESMTPS id 552861F25802 for ; Fri, 9 Feb 2024 16:43:35 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 6E6CB1272C7; Fri, 9 Feb 2024 16:41:13 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=ionos.com header.i=@ionos.com header.b="Pbj42Ruu" Received: from mail-ej1-f47.google.com (mail-ej1-f47.google.com [209.85.218.47]) (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 E21177BB02 for ; Fri, 9 Feb 2024 16:41:06 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.218.47 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707496870; cv=none; b=F6hxTdKAmk2374NbA9NQjbn0hYJbejcX8miT9ydNGGKl+yVhbLq2IqzBmZq1pNyD8LuWEv6oiUzMRZkxAlvB/SUdYCV1StlcQQrOZ5Da2Yh5CwBkfL5bws/52nJPNg3U06SmRmna+AhXzo2VIDF224ZWEPzlhgUep5eDePrqnZQ= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707496870; c=relaxed/simple; bh=4QO81KEDKay0yFCAsc2rxdLCjv2qqeiYr3qK18+rth8=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=HhqjzNDpvjGBkHtk1gQiEgg23f7Bak9Y2a/iveA8cSQAHjNwAit6PyMHVK4W14PrBMdaqUC3blZkZ+ZOjjhUlRdcN35iq9TrOvgUdWgFhXMD682FTdeB3pIRya7Qdeak0OLmnNErdtn40LII9/op2LTl3BItOuydklCUFGL9i/0= 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=Pbj42Ruu; arc=none smtp.client-ip=209.85.218.47 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-f47.google.com with SMTP id a640c23a62f3a-a26fa294e56so151821966b.0 for ; Fri, 09 Feb 2024 08:41:06 -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=55y/MpLm4siZas8N+/jjEVmpsMcuf6T3/F4NQL7Vz68=; b=Pbj42RuuyS6HCvjRCjl7V+R3GJ8LdeH196ae5vGt/4QMKPl5PUBopzzLWChFZZ8gSx qBzek+22s5WiS0EGX3AKrleKm2DPcCgyTYgRiPBsLHVNeDmCA2Znl6dbTUXhk8eMTXfJ b2ti209U6k12B0W1rlPe6HlXBOrqM2B4hlcDcjeMtj+iQ9ctxIgWHYAYYx7VEgU3NAop 48cF1elK8bS/owvVYgWEz6TG4GoFAWR3WkqQfcvHrizeWQWC3QZyGrjf1iQRv1lcoy+G IuAoEUqXylLvvu19naqkarnEe0CIPkx2AZ7kDFr4NfaR5IGcl7wPIkk00QV/ChL7uNzF PVDw== 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=55y/MpLm4siZas8N+/jjEVmpsMcuf6T3/F4NQL7Vz68=; b=VtGOWRMMQetos0wOES2ws4Oop6B8O7GFzBYeEImvf2Ha8FO0XDf7AN4TQWSoajSVe9 GOHLlRIwGKqIfzIHvKxyPizdbtNBkUah/RxQ6jXsUoE+B4/G66h8Pqv+0ZFfT9rqYl5a CP+X357dcNMESAO1gJo4iEgbbUQehz0O+8OB8T3Q5C7oaU9NZLgo4AD2YyXQpicQPtGw Maw3bCM+2fyi0HLIleqGBcPt10iXdWphkPx/EzZidH8TOFPLqE0AoOYa4a5TEdoHPXTY nGmyKRyJXiY1aaHcrK59p9bs3x71qCYQ5xsvNVvlZeiqOhqvuJ9IdMD1HWd0wREHttXy MVQA== X-Gm-Message-State: AOJu0YyxrIKZp4lNi5mkzCsXYQ6yXYpy1lVty6msirAq2JnzQPsHW65q rRzx1SA44mKENLYV0445ANpNeaWCTGFs7ny7x4AnsyfuQ/rCA8S5U/7nuBSBdgXfYq2oluoDhsp o X-Received: by 2002:a17:906:1cc1:b0:a35:aadc:a522 with SMTP id i1-20020a1709061cc100b00a35aadca522mr1562288ejh.57.1707496864714; 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.04 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 09 Feb 2024 08:41:04 -0800 (PST) From: Max Kellermann To: linux-kernel@vger.kernel.org Cc: Max Kellermann Subject: [PATCH v2 20/35] bio.h: move declarations to bio_types.h Date: Fri, 9 Feb 2024 17:40:12 +0100 Message-Id: <20240209164027.2582906-21-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 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 6bfa4b92bb32..6747965c3580 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