From patchwork Sun May 20 22:25:54 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kent Overstreet X-Patchwork-Id: 10413707 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id BA4A3600F6 for ; Sun, 20 May 2018 22:28:55 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id A1424286EC for ; Sun, 20 May 2018 22:28:55 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 95A2628732; Sun, 20 May 2018 22:28:55 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, FREEMAIL_FROM, MAILING_LIST_MULTI, RCVD_IN_DNSWL_HI autolearn=unavailable version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 44B64286EC for ; Sun, 20 May 2018 22:28:55 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752542AbeETW2L (ORCPT ); Sun, 20 May 2018 18:28:11 -0400 Received: from mail-qt0-f194.google.com ([209.85.216.194]:35287 "EHLO mail-qt0-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752634AbeETW0e (ORCPT ); Sun, 20 May 2018 18:26:34 -0400 Received: by mail-qt0-f194.google.com with SMTP id f5-v6so16825742qth.2; Sun, 20 May 2018 15:26:33 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=9UEfV84VSLi/6jALffFykmQpE8lpseA695aDdaw7w4U=; b=jWkbfYY1qN0kP/aUbVqQ71ux0ZL7MlQaSD43v9Bdxl4i36KUUxczuZmcUBvwSO2aMt dLXs6O6FSlZ/Jb6qhau2cMM6ia3UBrBO1wJjKJ7ojXUreJuU8TUJQM+jIodZbguDU5LM 20oKAkk9tZv8H0etjo2LKgw4hfLa4Ro7YP106/66EySeaSpRB9YZw2BFxqI3OlDnR7be Gj9QhOCR0iJqdW7dNo4yt4yEL35AEVyUx6Pygs4Ny4N8+yBW9G3jtQE6dMuvh3cyUkBi WnGLdEaJFLzBUuO63W4lVeJyix9GCD6+ZSp4OZEEffKvO5lv6moxshXZHECGzwMoWVWt jXDw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=9UEfV84VSLi/6jALffFykmQpE8lpseA695aDdaw7w4U=; b=Emb8SgVqKYbElFRp4yBYPcMC2kgHuJfYGT747s+TOOinJ0dvE8iZqSQY1JTZ7Xm0FS fC5Lti3DERJHn0foQHGW/sQk7xDUoMGOeJkBMD3WBrgAzEQn3qmllKt/WQ7g4ZF6LL1Y 15Mp//gB6ewordidJbvGNMuxU9XZ/LlCsElS0y8j8juJ/1U1TAuNXUWuS6LshHaoka3Q OS9zhaIQYJ3lcLP6PqdhVfb93XeWjL1PcAuYKnviz1c22pxyXF4vtyfvIVTfPWppfN6P 5Xxb3fjxJL0K4rR/nDlk9evoi6pJYUgz7BYBfEObbS/kljNbQV4mVfGV6f3AI+UGgZDN it7Q== X-Gm-Message-State: ALKqPwf2ynCN7nYmuXMAfIK5hC8cSrGRp2UphNzSI3xFhGBHxcIIIae/ bqYZydpSBJdBM+JCPIW5yEW8wf4j3g== X-Google-Smtp-Source: AB8JxZrkWNcfc0DAUsSAvNCx+IAlGy0iTtUIwE2ehh5dTbPJhR4Pzggb+nHAmiammJSu21v3vj9VJQ== X-Received: by 2002:a0c:d92d:: with SMTP id p42-v6mr15704519qvj.78.1526855192433; Sun, 20 May 2018 15:26:32 -0700 (PDT) Received: from localhost.localdomain (c-71-234-172-214.hsd1.vt.comcast.net. [71.234.172.214]) by smtp.gmail.com with ESMTPSA id v14-v6sm8773169qto.72.2018.05.20.15.26.30 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sun, 20 May 2018 15:26:31 -0700 (PDT) From: Kent Overstreet To: linux-kernel@vger.kernel.org, linux-block@vger.kernel.org, axboe@kernel.dk, hch@infradead.org, colyli@suse.de, snitzer@redhat.com, darrick.wong@oracle.com, clm@fb.com, bacik@fb.com, linux-xfs@vger.kernel.org, drbd-dev@lists.linbit.com, linux-btrfs@vger.kernel.org, linux-raid@vger.kernel.org, neilb@suse.com Cc: Kent Overstreet Subject: [PATCH 08/12] target: convert to bioset_init()/mempool_init() Date: Sun, 20 May 2018 18:25:54 -0400 Message-Id: <20180520222558.7053-9-kent.overstreet@gmail.com> X-Mailer: git-send-email 2.17.0 In-Reply-To: <20180520222558.7053-1-kent.overstreet@gmail.com> References: <20180520222558.7053-1-kent.overstreet@gmail.com> Sender: linux-block-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-block@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Signed-off-by: Kent Overstreet Reviewed-by: Christoph Hellwig --- drivers/target/target_core_iblock.c | 14 ++++++-------- drivers/target/target_core_iblock.h | 2 +- 2 files changed, 7 insertions(+), 9 deletions(-) diff --git a/drivers/target/target_core_iblock.c b/drivers/target/target_core_iblock.c index 44cacd001a..ce1321a5cb 100644 --- a/drivers/target/target_core_iblock.c +++ b/drivers/target/target_core_iblock.c @@ -94,8 +94,8 @@ static int iblock_configure_device(struct se_device *dev) return -EINVAL; } - ib_dev->ibd_bio_set = bioset_create(IBLOCK_BIO_POOL_SIZE, 0, BIOSET_NEED_BVECS); - if (!ib_dev->ibd_bio_set) { + ret = bioset_init(&ib_dev->ibd_bio_set, IBLOCK_BIO_POOL_SIZE, 0, BIOSET_NEED_BVECS); + if (ret) { pr_err("IBLOCK: Unable to create bioset\n"); goto out; } @@ -141,7 +141,7 @@ static int iblock_configure_device(struct se_device *dev) bi = bdev_get_integrity(bd); if (bi) { - struct bio_set *bs = ib_dev->ibd_bio_set; + struct bio_set *bs = &ib_dev->ibd_bio_set; if (!strcmp(bi->profile->name, "T10-DIF-TYPE3-IP") || !strcmp(bi->profile->name, "T10-DIF-TYPE1-IP")) { @@ -174,8 +174,7 @@ static int iblock_configure_device(struct se_device *dev) out_blkdev_put: blkdev_put(ib_dev->ibd_bd, FMODE_WRITE|FMODE_READ|FMODE_EXCL); out_free_bioset: - bioset_free(ib_dev->ibd_bio_set); - ib_dev->ibd_bio_set = NULL; + bioset_exit(&ib_dev->ibd_bio_set); out: return ret; } @@ -199,8 +198,7 @@ static void iblock_destroy_device(struct se_device *dev) if (ib_dev->ibd_bd != NULL) blkdev_put(ib_dev->ibd_bd, FMODE_WRITE|FMODE_READ|FMODE_EXCL); - if (ib_dev->ibd_bio_set != NULL) - bioset_free(ib_dev->ibd_bio_set); + bioset_exit(&ib_dev->ibd_bio_set); } static unsigned long long iblock_emulate_read_cap_with_block_size( @@ -332,7 +330,7 @@ iblock_get_bio(struct se_cmd *cmd, sector_t lba, u32 sg_num, int op, if (sg_num > BIO_MAX_PAGES) sg_num = BIO_MAX_PAGES; - bio = bio_alloc_bioset(GFP_NOIO, sg_num, ib_dev->ibd_bio_set); + bio = bio_alloc_bioset(GFP_NOIO, sg_num, &ib_dev->ibd_bio_set); if (!bio) { pr_err("Unable to allocate memory for bio\n"); return NULL; diff --git a/drivers/target/target_core_iblock.h b/drivers/target/target_core_iblock.h index b4aeb2584a..9cc3843404 100644 --- a/drivers/target/target_core_iblock.h +++ b/drivers/target/target_core_iblock.h @@ -22,7 +22,7 @@ struct iblock_dev { struct se_device dev; unsigned char ibd_udev_path[SE_UDEV_PATH_LEN]; u32 ibd_flags; - struct bio_set *ibd_bio_set; + struct bio_set ibd_bio_set; struct block_device *ibd_bd; bool ibd_readonly; } ____cacheline_aligned;