Received: by 2002:a05:6a10:af89:0:0:0:0 with SMTP id iu9csp1176864pxb; Fri, 21 Jan 2022 11:31:34 -0800 (PST) X-Google-Smtp-Source: ABdhPJzaN9/Z0XjC0JSB2ZDcZw8R7a9KPyZ03m9swbvc3S2NcdtiJwsNYgsFt+HEckWTUP0Qay41 X-Received: by 2002:a17:902:9a42:b0:14a:baa1:c7ee with SMTP id x2-20020a1709029a4200b0014abaa1c7eemr5500540plv.58.1642793494452; Fri, 21 Jan 2022 11:31:34 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1642793494; cv=none; d=google.com; s=arc-20160816; b=EfYD1OOnrtl0nMNEZYYLFqdO3F8wZPmbeLRSTl5+5CKfKqIWkTAg2kFxqCfg+FBtYY 6MVuEb55uEYfAelxWX+dA5K8yEET7B/aCgSNI9FzLyMzZ8AyH8CbMfw7EXeeYoYR/vJr C1zg4k0qBQid60uE99k+xvvqjp4K8R/jWHguw3jfQryMzBPLRhm4CBanGI5virO7BFOp vGn0YzOlybuodkcblKeHEjZ9jp+AAw4V/05BEqBLbwRFaYE1/adnR/jAQritfX33FU1A TQD7aRpYntJJ/ETZ+LfjfYoSb7kDKSlhFUurEUPr0VblIiT3plJr/nclJkoViq/teRyi kDEQ== 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=4ls4oJs6fjZ2al5mHDHmAP430pKGIHTChze7QOzvid0=; b=qAEORnbGkGI60YxkThvaMkNU8E78vnIUcjcC1L53KIey6S3DOkkpUHyPIsX0g5w8Cl mHnCtKLbjdlzil5ImeFfDUrJY7RAQWhEf3Wq8g2r9V96/R862U7wg93QnNF23omjDTac 8qJJZYJqRpw+RG6RxRwZkyuXvRcDmCg3idxsKgKIVb7PYjC8YUIT88p2imXvileBLd6c L1fpqFkMvXf3mDee31203dPKew7dTaQnMH9uiHUHAGkxZy/miGCxwbxM1dPu5dxpPs5i uZzCL90MVlpXg1Xw1A7ofgxi1Yuj9/u2A/xzkZKbASuBz25C1r7moEP/kc2qPV5XvE0s LxZA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ionos.com header.s=google header.b=RkLog8m2; 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 k20si5727556pll.387.2022.01.21.11.31.15; Fri, 21 Jan 2022 11:31:34 -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=RkLog8m2; 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 S1355743AbiASPdM (ORCPT + 99 others); Wed, 19 Jan 2022 10:33:12 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59904 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1355632AbiASPdL (ORCPT ); Wed, 19 Jan 2022 10:33:11 -0500 Received: from mail-ed1-x52b.google.com (mail-ed1-x52b.google.com [IPv6:2a00:1450:4864:20::52b]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 77AEFC061574 for ; Wed, 19 Jan 2022 07:33:11 -0800 (PST) Received: by mail-ed1-x52b.google.com with SMTP id z22so13685029edd.12 for ; Wed, 19 Jan 2022 07:33:11 -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=4ls4oJs6fjZ2al5mHDHmAP430pKGIHTChze7QOzvid0=; b=RkLog8m2MYBMRLjnz/lmwOPkWvyatJOpnc2C+SFqCB8A5+CgOtZNqgIcBiMLkIoMyh gEr8s1UGmpgpAGNwUfZNYyRI9qEflB+nBcS9X+xsueK5rC4Ez4sCexRGgPhN4+3TFriB ojHLQx/So9q0DEpS6wCB+RQONR2hQN+ZDAFsafTmgU6TGyrFxA/6lV1xY4IJet52lmjl bSyn079RsjIcJeBi+nhFSujNuqtCPXIfKFb/dYwAiTdrCxy5wjkDmXd+/ZabmuFSO4A1 5WQvp91C0WXDM8k7HDlkHelCzGm9OlpjE9UBZJN4WZKlgYFI7B59vtkfpfd/tSS650gp aHmw== 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=4ls4oJs6fjZ2al5mHDHmAP430pKGIHTChze7QOzvid0=; b=QACtx3XvyYMfkV8Lgs3UZoFHwBQCl7XmMByORtiElQUX8Hm+KyUDvd/SnTw8Wj9j6S 1num1yXUQSQ90vcvirrzjnyCAtKet6rxyqkhyPdfa4QC8XWDWsmVBmCpYlgr5vlAFEqf V/erbc+GbmcprpyZYKBPfosEM64cP+UTRDep9lQ9kb7dJ9k1l1hH61C4NkTBNv9Nlfml 67aH/xudgompOQLrSdzsla2yFx2I5sycoALzadczFWOcGRZ0fub8bZnlM1RDESX6FV9a Tk8Ge+0FsoeYu3/hBSp/Oafq9GCXUWsJqhlJDRzczT0xbiouhIDIbU+CiCywzV2akJ7D u5Jw== X-Gm-Message-State: AOAM532kPpl36YwWZTvldeJVuO5XP9cXHw25Px8EqiS1TuahHONhMhB5 LRwISGpBOnXE9J5XkjoIMByDL+04Og18z10QELm24g== X-Received: by 2002:a05:6402:195:: with SMTP id r21mr30344219edv.174.1642606389887; Wed, 19 Jan 2022 07:33:09 -0800 (PST) MIME-Version: 1.0 References: <20220118071952.1243143-1-hch@lst.de> <20220118071952.1243143-12-hch@lst.de> In-Reply-To: <20220118071952.1243143-12-hch@lst.de> From: Jinpu Wang Date: Wed, 19 Jan 2022 16:32:58 +0100 Message-ID: Subject: Re: [PATCH 11/19] rnbd-src: 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 Tue, Jan 18, 2022 at 8:20 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 there is one typo in the subject line, should be rnbd-srv. > --- > drivers/block/rnbd/rnbd-srv-dev.c | 4 +--- > drivers/block/rnbd/rnbd-srv-dev.h | 13 ++----------- > drivers/block/rnbd/rnbd-srv.c | 30 +++++------------------------- > drivers/block/rnbd/rnbd-srv.h | 1 - > 4 files changed, 8 insertions(+), 40 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 65c670e96075b..b1ac1414b56d5 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,20 +149,16 @@ 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))) { > rnbd_srv_err(sess_dev, "Failed to map data to bio\n"); > err = -EINVAL; > - goto sess_dev_put; > + goto bio_put; ok, bio_put is used here, I think it's better the move to patch 10. > } > > - 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); > @@ -180,7 +173,6 @@ static int process_rdma(struct rnbd_srv_session *srv_sess, > > bio_put: > bio_put(bio); > -sess_dev_put: > rnbd_put_sess_dev(sess_dev); > err: > kfree(priv); > @@ -261,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); > > @@ -290,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); > @@ -748,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 > with it fixed, the patch looks good to me. Thanks!