From patchwork Sun May 20 22:25:56 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kent Overstreet X-Patchwork-Id: 10413671 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 3EEE660365 for ; Sun, 20 May 2018 22:27:21 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 25EBC205A9 for ; Sun, 20 May 2018 22:27:21 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 1A7FF286EC; Sun, 20 May 2018 22:27:21 +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 BB875205A9 for ; Sun, 20 May 2018 22:27:20 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752659AbeETW0n (ORCPT ); Sun, 20 May 2018 18:26:43 -0400 Received: from mail-qt0-f194.google.com ([209.85.216.194]:36532 "EHLO mail-qt0-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752655AbeETW0h (ORCPT ); Sun, 20 May 2018 18:26:37 -0400 Received: by mail-qt0-f194.google.com with SMTP id q6-v6so16818701qtn.3; Sun, 20 May 2018 15:26:37 -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=o+W6NtTw6FUqTYA/codkuljI3gYPmhqpK8oSEEnP7to=; b=Y3azbDmDutkvnrn3sNLAvLEwlxg5HhaHDQas8xgW9/ZlOA31k2OuLLTM1TpbYhYk4T lGEA/ZgRWcP+52gmW9nFn32WFtQ+Dlip0qjWrr3h46VrgufjoSXoGs/AVRCi9OQFqk7p x0bhKcN0rWZ8Di6XDUP5V2I3JTC7FadbWls/x+p004d/EswoB4eJZf//iS72rfeg2Mcq rleFJxOcqMXOOxl4TBVpJ86CekrTUDcNLZDuusmwuq2/afLUdcD+drhqmbn2iCeHMNAR 6B0Pe8GzUw6uahAUdM5UmjZ7/7AFffKYjD5CbEvbd1wv7ADcHL1idtco0373t1WhOo8t 060w== 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=o+W6NtTw6FUqTYA/codkuljI3gYPmhqpK8oSEEnP7to=; b=hHkn2SZYzYVv0xMqDDiE/NIis9WuLkanaLP2EXxF4uDPh+BeTaik2o2EAkcvREZURB hxRxnrGyKuGT0w9QJ/EiKl+inb5azkjYaoVfYxXKtVWmhwFa/BVlQlltLIESzVn1hDxf 0cbqd9620XTKyvK9OcOUAsGS8cc2IvPmVxQ7qDADUyufmHSXQ1GvpVSHihqeP5GLjdNE lkdcQYxVFUuwAjMRXS+jDg7KJUuNYtRiLZITPsY3qsTrjqMuHOxCK/i3Euufg94P4ZDG F03rcOBwRBn8o++LS+5Gjse2yCzH7NTjnjC8a/4n7PGpVb+JvrNW73rlYsZtvUAHK1OI ze3g== X-Gm-Message-State: ALKqPwfc9kIuuBfGh3ESo2BNYpnJ167/P4Cpu4NllqZsxyTEb32BNktD u4DbFLxJtz1QSWg79MGaX0Kdh9k35Q== X-Google-Smtp-Source: AB8JxZpuYK06c/7i2y33Nbyev/HMC633GRo33d+sYsqBcKnH/qaNFZvb/uurw0vl994YPmilSU6pRw== X-Received: by 2002:ac8:21cd:: with SMTP id 13-v6mr17077249qtz.406.1526855196079; Sun, 20 May 2018 15:26:36 -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.34 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sun, 20 May 2018 15:26:35 -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 10/12] btrfs: convert to bioset_init()/mempool_init() Date: Sun, 20 May 2018 18:25:56 -0400 Message-Id: <20180520222558.7053-11-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 Acked-by: Chris Mason --- fs/btrfs/extent_io.c | 25 +++++++++++-------------- 1 file changed, 11 insertions(+), 14 deletions(-) diff --git a/fs/btrfs/extent_io.c b/fs/btrfs/extent_io.c index e99b329002..56d32bb462 100644 --- a/fs/btrfs/extent_io.c +++ b/fs/btrfs/extent_io.c @@ -26,7 +26,7 @@ static struct kmem_cache *extent_state_cache; static struct kmem_cache *extent_buffer_cache; -static struct bio_set *btrfs_bioset; +static struct bio_set btrfs_bioset; static inline bool extent_state_in_tree(const struct extent_state *state) { @@ -162,20 +162,18 @@ int __init extent_io_init(void) if (!extent_buffer_cache) goto free_state_cache; - btrfs_bioset = bioset_create(BIO_POOL_SIZE, - offsetof(struct btrfs_io_bio, bio), - BIOSET_NEED_BVECS); - if (!btrfs_bioset) + if (bioset_init(&btrfs_bioset, BIO_POOL_SIZE, + offsetof(struct btrfs_io_bio, bio), + BIOSET_NEED_BVECS)) goto free_buffer_cache; - if (bioset_integrity_create(btrfs_bioset, BIO_POOL_SIZE)) + if (bioset_integrity_create(&btrfs_bioset, BIO_POOL_SIZE)) goto free_bioset; return 0; free_bioset: - bioset_free(btrfs_bioset); - btrfs_bioset = NULL; + bioset_exit(&btrfs_bioset); free_buffer_cache: kmem_cache_destroy(extent_buffer_cache); @@ -198,8 +196,7 @@ void __cold extent_io_exit(void) rcu_barrier(); kmem_cache_destroy(extent_state_cache); kmem_cache_destroy(extent_buffer_cache); - if (btrfs_bioset) - bioset_free(btrfs_bioset); + bioset_exit(&btrfs_bioset); } void extent_io_tree_init(struct extent_io_tree *tree, @@ -2679,7 +2676,7 @@ struct bio *btrfs_bio_alloc(struct block_device *bdev, u64 first_byte) { struct bio *bio; - bio = bio_alloc_bioset(GFP_NOFS, BIO_MAX_PAGES, btrfs_bioset); + bio = bio_alloc_bioset(GFP_NOFS, BIO_MAX_PAGES, &btrfs_bioset); bio_set_dev(bio, bdev); bio->bi_iter.bi_sector = first_byte >> 9; btrfs_io_bio_init(btrfs_io_bio(bio)); @@ -2692,7 +2689,7 @@ struct bio *btrfs_bio_clone(struct bio *bio) struct bio *new; /* Bio allocation backed by a bioset does not fail */ - new = bio_clone_fast(bio, GFP_NOFS, btrfs_bioset); + new = bio_clone_fast(bio, GFP_NOFS, &btrfs_bioset); btrfs_bio = btrfs_io_bio(new); btrfs_io_bio_init(btrfs_bio); btrfs_bio->iter = bio->bi_iter; @@ -2704,7 +2701,7 @@ struct bio *btrfs_io_bio_alloc(unsigned int nr_iovecs) struct bio *bio; /* Bio allocation backed by a bioset does not fail */ - bio = bio_alloc_bioset(GFP_NOFS, nr_iovecs, btrfs_bioset); + bio = bio_alloc_bioset(GFP_NOFS, nr_iovecs, &btrfs_bioset); btrfs_io_bio_init(btrfs_io_bio(bio)); return bio; } @@ -2715,7 +2712,7 @@ struct bio *btrfs_bio_clone_partial(struct bio *orig, int offset, int size) struct btrfs_io_bio *btrfs_bio; /* this will never fail when it's backed by a bioset */ - bio = bio_clone_fast(orig, GFP_NOFS, btrfs_bioset); + bio = bio_clone_fast(orig, GFP_NOFS, &btrfs_bioset); ASSERT(bio); btrfs_bio = btrfs_io_bio(bio);