Received: by 2002:a05:6a10:af89:0:0:0:0 with SMTP id iu9csp3503701pxb; Mon, 24 Jan 2022 10:56:21 -0800 (PST) X-Google-Smtp-Source: ABdhPJyDhkHl9Nx5HIDGZibCEcRnrW93ohEUnAWcICQQ+azS5m5Y4uvJNFrvdBvHaXstp15oAgJK X-Received: by 2002:aa7:9399:0:b0:4c9:6049:cb7e with SMTP id t25-20020aa79399000000b004c96049cb7emr5220993pfe.63.1643050580922; Mon, 24 Jan 2022 10:56:20 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1643050580; cv=none; d=google.com; s=arc-20160816; b=qrH5PQz6128dxAsqGB/MsKfOkaHPf2N0yNCwaGEwGwQDMA2HK/PZUSeTGPDXYXgBKR 7nzDLkbe9byVM++IovVoZaMICJSapJsxG5fXAkrj7/2wTuF6Rzr4ul5VnEJV/zX2WZaE FHDYpz8O2YRpa4pKjAD5xWXRgZXJ+Bw3WP5NHtImjpX1SYPbVyxTvFiCvhALFNdHglII Hy+5fcvBlIdR6+EfZnKPRz4S7bCVLocou5WXdoNY16S+xUrmEQFvgVgTS+6/ApTUkLrY J7uH5OZ5xkImIcu5Gn50I/4ZV62DRfmgHui+waKRG0cTwQvw/JQqBiPFQ+j12WenuxXV Ah0A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=VAKGKCfUBMSLG+YSR57H57ZEkLN6BewyVneVTtK6CWk=; b=igJ1uULhWrnkovu+GC7yLnsmnCYXL39jFirJlZTDnwEyuxre8uLkXDkkhlrIXzGKBh amI4ocGeCTWsP7GwDh3DSFROHmmHjnl0lGVMp2TxWQzwhY702D0EuowjtROkbNklSRl6 x8D8+MZUbrlIG70c4qKgx9EhqGd7vMSDOUnamdYkwW3tBERI4nwuooWzg8ZuaFxzy60b /8bP0WCXQvE3rr6tif8ecfSKVR4OIw2nf6IWzMWkb6gfdWpwZdJR5kY6lluo5fxsVWCH XO1OgjXL7T6NVCMTCAf+iJQszCYgYIou3MD7ZvtDGqcUu8yu/imfgyxTvzlr2+XheOoz 82CA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@infradead.org header.s=bombadil.20210309 header.b=oNwS32Sf; spf=pass (google.com: domain of linux-nfs-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-nfs-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id m5si11946458plt.311.2022.01.24.10.56.07; Mon, 24 Jan 2022 10:56:20 -0800 (PST) Received-SPF: pass (google.com: domain of linux-nfs-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@infradead.org header.s=bombadil.20210309 header.b=oNwS32Sf; spf=pass (google.com: domain of linux-nfs-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-nfs-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236500AbiAXJLy (ORCPT + 99 others); Mon, 24 Jan 2022 04:11:54 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47378 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S242632AbiAXJLq (ORCPT ); Mon, 24 Jan 2022 04:11:46 -0500 Received: from bombadil.infradead.org (bombadil.infradead.org [IPv6:2607:7c80:54:e::133]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9B012C06173B; Mon, 24 Jan 2022 01:11:46 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20210309; h=Content-Transfer-Encoding: MIME-Version:References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From:Sender :Reply-To:Content-Type:Content-ID:Content-Description; bh=VAKGKCfUBMSLG+YSR57H57ZEkLN6BewyVneVTtK6CWk=; b=oNwS32SfnvZJzN8YyHWJOl3UJU oK8E3D1k2MzQjGFbwP74nx+zncMg4ZWN26Kwvr8W7I4e9e+Y2L6hy8cpR3L2XvXtzzYDyhbNqnqQ9 w03qKB9NAJTwCUVmpEyQq/gm6i42QNyDMbAORMlSkObthZ5e+9xBZSkWvRXDHW2RLODBCZFFBDTrs EMymxa1CDJEFDnU1OlGtKeq3PjJ0QNeK8lOUxAaDnGzgcQJ8d/hZdCBE6puiu59q6FQ1mBBRCIzID FO2pjHe0vexE4Y0H8hjmtMw3SfeAJNZX3xL/2I1jXcD18x0pr5FmgVw5oBcO8INdt0T5mPhiusMMR kSjMrqTQ==; Received: from [2001:4bb8:184:72a4:a337:a75f:a24e:7e39] (helo=localhost) by bombadil.infradead.org with esmtpsa (Exim 4.94.2 #2 (Red Hat Linux)) id 1nBvNz-002kEY-Se; Mon, 24 Jan 2022 09:11:40 +0000 From: Christoph Hellwig To: Jens Axboe Cc: Pavel Begunkov , Mike Snitzer , Ryusuke Konishi , Konstantin Komarov , Andrew Morton , "Md . Haris Iqbal " , Jack Wang , =?UTF-8?q?Roger=20Pau=20Monn=C3=A9?= , Philipp Reisner , Lars Ellenberg , linux-block@vger.kernel.org, dm-devel@redhat.com, linux-fsdevel@vger.kernel.org, linux-nfs@vger.kernel.org, linux-nilfs@vger.kernel.org, ntfs3@lists.linux.dev, xen-devel@lists.xenproject.org, drbd-dev@lists.linbit.com Subject: [PATCH 11/19] rnbd-srv: remove struct rnbd_dev_blk_io Date: Mon, 24 Jan 2022 10:10:59 +0100 Message-Id: <20220124091107.642561-12-hch@lst.de> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20220124091107.642561-1-hch@lst.de> References: <20220124091107.642561-1-hch@lst.de> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-SRS-Rewrite: SMTP reverse-path rewritten from by bombadil.infradead.org. See http://www.infradead.org/rpr.html Precedence: bulk List-ID: X-Mailing-List: linux-nfs@vger.kernel.org Only the priv field of rnbd_dev_blk_io is used, so store the value of that in bio->bi_private directly and remove the entire bio_set overhead. Signed-off-by: Christoph Hellwig --- drivers/block/rnbd/rnbd-srv-dev.c | 4 +--- drivers/block/rnbd/rnbd-srv-dev.h | 13 ++----------- drivers/block/rnbd/rnbd-srv.c | 27 ++++----------------------- drivers/block/rnbd/rnbd-srv.h | 1 - 4 files changed, 7 insertions(+), 38 deletions(-) diff --git a/drivers/block/rnbd/rnbd-srv-dev.c b/drivers/block/rnbd/rnbd-srv-dev.c index 98d3e591a0885..c5d0a03911659 100644 --- a/drivers/block/rnbd/rnbd-srv-dev.c +++ b/drivers/block/rnbd/rnbd-srv-dev.c @@ -12,8 +12,7 @@ #include "rnbd-srv-dev.h" #include "rnbd-log.h" -struct rnbd_dev *rnbd_dev_open(const char *path, fmode_t flags, - struct bio_set *bs) +struct rnbd_dev *rnbd_dev_open(const char *path, fmode_t flags) { struct rnbd_dev *dev; int ret; @@ -30,7 +29,6 @@ struct rnbd_dev *rnbd_dev_open(const char *path, fmode_t flags, dev->blk_open_flags = flags; bdevname(dev->bdev, dev->name); - dev->ibd_bio_set = bs; return dev; diff --git a/drivers/block/rnbd/rnbd-srv-dev.h b/drivers/block/rnbd/rnbd-srv-dev.h index 1a14ece0be726..2c3df02b5e8ec 100644 --- a/drivers/block/rnbd/rnbd-srv-dev.h +++ b/drivers/block/rnbd/rnbd-srv-dev.h @@ -14,25 +14,16 @@ struct rnbd_dev { struct block_device *bdev; - struct bio_set *ibd_bio_set; fmode_t blk_open_flags; char name[BDEVNAME_SIZE]; }; -struct rnbd_dev_blk_io { - struct rnbd_dev *dev; - void *priv; - /* have to be last member for front_pad usage of bioset_init */ - struct bio bio; -}; - /** * rnbd_dev_open() - Open a device + * @path: path to open * @flags: open flags - * @bs: bio_set to use during block io, */ -struct rnbd_dev *rnbd_dev_open(const char *path, fmode_t flags, - struct bio_set *bs); +struct rnbd_dev *rnbd_dev_open(const char *path, fmode_t flags); /** * rnbd_dev_close() - Close a device diff --git a/drivers/block/rnbd/rnbd-srv.c b/drivers/block/rnbd/rnbd-srv.c index 6d228af1dcc35..ff9b389976078 100644 --- a/drivers/block/rnbd/rnbd-srv.c +++ b/drivers/block/rnbd/rnbd-srv.c @@ -116,9 +116,7 @@ rnbd_get_sess_dev(int dev_id, struct rnbd_srv_session *srv_sess) static void rnbd_dev_bi_end_io(struct bio *bio) { - struct rnbd_dev_blk_io *io = bio->bi_private; - - rnbd_endio(io->priv, blk_status_to_errno(bio->bi_status)); + rnbd_endio(bio->bi_private, blk_status_to_errno(bio->bi_status)); bio_put(bio); } @@ -131,7 +129,6 @@ static int process_rdma(struct rnbd_srv_session *srv_sess, struct rnbd_srv_sess_dev *sess_dev; u32 dev_id; int err; - struct rnbd_dev_blk_io *io; struct bio *bio; short prio; @@ -152,7 +149,7 @@ static int process_rdma(struct rnbd_srv_session *srv_sess, priv->sess_dev = sess_dev; priv->id = id; - bio = bio_alloc_bioset(GFP_KERNEL, 1, sess_dev->rnbd_dev->ibd_bio_set); + bio = bio_alloc(GFP_KERNEL, 1); if (bio_add_page(bio, virt_to_page(data), datalen, offset_in_page(data)) != datalen) { rnbd_srv_err(sess_dev, "Failed to map data to bio\n"); @@ -160,12 +157,8 @@ static int process_rdma(struct rnbd_srv_session *srv_sess, goto bio_put; } - io = container_of(bio, struct rnbd_dev_blk_io, bio); - io->dev = sess_dev->rnbd_dev; - io->priv = priv; - bio->bi_end_io = rnbd_dev_bi_end_io; - bio->bi_private = io; + bio->bi_private = priv; bio->bi_opf = rnbd_to_bio_flags(le32_to_cpu(msg->rw)); bio->bi_iter.bi_sector = le64_to_cpu(msg->sector); bio->bi_iter.bi_size = le32_to_cpu(msg->bi_size); @@ -260,7 +253,6 @@ static void destroy_sess(struct rnbd_srv_session *srv_sess) out: xa_destroy(&srv_sess->index_idr); - bioset_exit(&srv_sess->sess_bio_set); pr_info("RTRS Session %s disconnected\n", srv_sess->sessname); @@ -289,16 +281,6 @@ static int create_sess(struct rtrs_srv_sess *rtrs) return -ENOMEM; srv_sess->queue_depth = rtrs_srv_get_queue_depth(rtrs); - err = bioset_init(&srv_sess->sess_bio_set, srv_sess->queue_depth, - offsetof(struct rnbd_dev_blk_io, bio), - BIOSET_NEED_BVECS); - if (err) { - pr_err("Allocating srv_session for path %s failed\n", - pathname); - kfree(srv_sess); - return err; - } - xa_init_flags(&srv_sess->index_idr, XA_FLAGS_ALLOC); INIT_LIST_HEAD(&srv_sess->sess_dev_list); mutex_init(&srv_sess->lock); @@ -747,8 +729,7 @@ static int process_msg_open(struct rnbd_srv_session *srv_sess, goto reject; } - rnbd_dev = rnbd_dev_open(full_path, open_flags, - &srv_sess->sess_bio_set); + rnbd_dev = rnbd_dev_open(full_path, open_flags); if (IS_ERR(rnbd_dev)) { pr_err("Opening device '%s' on session %s failed, failed to open the block device, err: %ld\n", full_path, srv_sess->sessname, PTR_ERR(rnbd_dev)); diff --git a/drivers/block/rnbd/rnbd-srv.h b/drivers/block/rnbd/rnbd-srv.h index e5604bce123ab..be2ae486d407e 100644 --- a/drivers/block/rnbd/rnbd-srv.h +++ b/drivers/block/rnbd/rnbd-srv.h @@ -23,7 +23,6 @@ struct rnbd_srv_session { struct rtrs_srv_sess *rtrs; char sessname[NAME_MAX]; int queue_depth; - struct bio_set sess_bio_set; struct xarray index_idr; /* List of struct rnbd_srv_sess_dev */ -- 2.30.2