Received: by 2002:a05:6a10:af89:0:0:0:0 with SMTP id iu9csp3674934pxb; Mon, 24 Jan 2022 15:04:32 -0800 (PST) X-Google-Smtp-Source: ABdhPJz+qUAd7vmsuP5T6N3TS650gWDe6d3ObgV+pQW6aJNJJtb1ZgzTA93yAlVNGftp3PSJ2Jsd X-Received: by 2002:a17:90b:4d11:: with SMTP id mw17mr576176pjb.100.1643065472329; Mon, 24 Jan 2022 15:04:32 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1643065472; cv=none; d=google.com; s=arc-20160816; b=XdG73WNOYCJWf/VP2g8JW1Ob95x3Tnwa67bzhNDMcuWuefs3Bsxld2BBZi7Z+VPWw0 gzbkA/7g/Wuix+I9ahfcN/dHCiwWkkVBWHZKLEwxIBTxiqeZflksfiHrl48F2//wYune a7meRa4Dppc+hnDQCdRvVO+n8L4H64LV/kviu8FkhVL4QiKzuIDSXOi6+Ga5sfTW3+aa cjVJWCqZxPjlh1x097+/R21evosr27lbTvb3cDLp4oP3a7iTDDhxvMpYp6zP/8oebMJO bsZaDAJnPrLrXUqFU+5WToZwFjN7/FpCvUoNRmEKvbmTuZKA+7pcCxmWnrY4jAcGJg1X WWFw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=ePWzg4KksjRUDSjqr+o9tEK0DbR7L8NzVM+5lIUlDPo=; b=HVvWW/jmkkEFA7VHtDI6Kyenpc/VVHuDU5RfehZnd2bvX6MRHImQsAQXs8bNfbCO3L 7nC5Q8IifOq9LUoSeKsT0BSkmF+WXGC2OzfZlfFndV/BY64CZd/r+Bm2ZpBFdzHksC5g RuPLrg0c2r/VzDxdYafCIPf9FKn53GsAMvUwPorzjkuxzlCk+3VNJBfLnwIyljTN+j0m g080ttnJtCDm9lJTOK9aWhhZzos3POHuIG+/8+VcJVSdeoTbkrn9AkEr/BRPWpqM+dPq yqLqiz+BZ+IHWTNOeTHJEz9d9oaAPIPbKWnLJUsZoMegte37TzwZtNhyb/g1RUZ9yQey NZiQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ionos.com header.s=google header.b=UryOzKtT; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=ionos.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id f8si536436pjp.69.2022.01.24.15.04.09; Mon, 24 Jan 2022 15:04:32 -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=@ionos.com header.s=google header.b=UryOzKtT; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=ionos.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1841246AbiAXW6G (ORCPT + 99 others); Mon, 24 Jan 2022 17:58:06 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44322 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1839098AbiAXWtw (ORCPT ); Mon, 24 Jan 2022 17:49:52 -0500 Received: from mail-ej1-x633.google.com (mail-ej1-x633.google.com [IPv6:2a00:1450:4864:20::633]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8ABADC06809E for ; Mon, 24 Jan 2022 13:07:39 -0800 (PST) Received: by mail-ej1-x633.google.com with SMTP id ah7so24862984ejc.4 for ; Mon, 24 Jan 2022 13:07:39 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ionos.com; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=ePWzg4KksjRUDSjqr+o9tEK0DbR7L8NzVM+5lIUlDPo=; b=UryOzKtTd2BAlxPDRNgCwCESf13lD5IW6bNOSpBDepFbuH7r9fjbsT6cE5x5Ghft6m mvPNVWtkz01mVJrSqeC/gB7JTH8T6qFvFS/VnIIFZHW5/gP/sOhhcnNoyYhFzrPdUaVF FvDL8M4vNuURIqj/n/AdjkvXl39lYlpRohMIl+wO54x442N5Kx3ijGlQ972NHhWQkaPM 2PB2Ht3BymPWofX9NOCMsDhYcC+73YD1E+ldRp1Zbpzgc9ITLFFrLh5PDvAi6v8hFREw ZBIZaScnPoiVR8zI3lCx6RkrB7DD23Vmu/ZR3nC2SK8GmSX6IQ39leUg3dHZiL44CE+y QY2Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=ePWzg4KksjRUDSjqr+o9tEK0DbR7L8NzVM+5lIUlDPo=; b=1ycS38Fl9nv8sKGeiJEvj7dcFjJMaVkXAbShM2YLA3tWvjnLepDt/4P4u8iCIcrXGU VVpVSmZtW5rTj7mE/0c8b/R0d+hs+m49rS1e6PkOpeMggntAabCe/1BlDgrR2ZuPQef6 VVP2UDfzP0SR6mSSRMls3OWLFx9kNSW8eCCA2zJ2sH0Lqwfe1VjCBqh6/UVLMkvVHSle 2StLIq+uDw2I4YoxwlzyW1nJn50hGHhOO4JmhWWSXXkeKzwvqw0qZ1GT5cVbyRcDYSbv kwptfyetlE3kMWolW8o55/wNRpSHlR49WLb0IIuIDwhxXHPmzPqZzbW2vU+mQ7a+9UCD n10w== X-Gm-Message-State: AOAM533RP80fJbfO5Vbl8WZs4oOxYfvdkQpP5l6SKbcfZ75TCKNQ3eC2 9zUlHQvz7Ptp4sp/7HUyIAmtXFV4JLf66AMtJ9UWFw== X-Received: by 2002:a17:907:1c23:: with SMTP id nc35mr11335786ejc.624.1643058458017; Mon, 24 Jan 2022 13:07:38 -0800 (PST) MIME-Version: 1.0 References: <20220124091107.642561-1-hch@lst.de> <20220124091107.642561-12-hch@lst.de> In-Reply-To: <20220124091107.642561-12-hch@lst.de> From: Jinpu Wang Date: Mon, 24 Jan 2022 22:07:26 +0100 Message-ID: Subject: Re: [PATCH 11/19] rnbd-srv: remove struct rnbd_dev_blk_io To: Christoph Hellwig Cc: Jens Axboe , Pavel Begunkov , Mike Snitzer , Ryusuke Konishi , Konstantin Komarov , Andrew Morton , "Md . Haris Iqbal" , =?UTF-8?Q?Roger_Pau_Monn=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 Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-nfs@vger.kernel.org On Mon, Jan 24, 2022 at 10:11 AM Christoph Hellwig wrote: > > 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 Reviewed-by: Jack Wang Thanks! > --- > 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 >