Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp27965pxb; Wed, 27 Jan 2021 00:50:45 -0800 (PST) X-Google-Smtp-Source: ABdhPJzpqLb7Sw4lUkTKWJORnlWeaPEu5g4copAWRIXx9E6lprLMB1hMfVzKx4mYvPkNaCvh3b73 X-Received: by 2002:a05:6402:4391:: with SMTP id o17mr8072624edc.196.1611737444872; Wed, 27 Jan 2021 00:50:44 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1611737444; cv=none; d=google.com; s=arc-20160816; b=PwnDY+McDY3Rhm+ubJKIjvuwuMpa9rv9C6GHl9GxN90lRfBjMEiVr5lXnr0Ro1SHa9 ZRm24ODPQZhgigANS0nzsTl2KyaaBiu89av7eorvklzB6A7E2wkOz58jXBWVQUZBtVbA +VaS7YiCRYJuPwaQ5mDkHmQgpnHIDtX8bGuc1fnkMrc/fTSEadDl9bvE4d/Jlnv8o3O7 cSJDx9pR10kbPlKyOg174ooZ/tjQKwqNYvkHK7O6r5DYgJWmxkFFXPPRoY883+W5ifcR RuLh6D/DaeI7X1zQZo/T6B6Cc+2gLjrfv2/uYl9YW8zGiiqTzVCmO8f/PBrrfr60fMRI FtjA== 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=1VK3Qtpbfd08Y0+EHBVjyNuugqRW26buSmbPlvGpwqE=; b=Vb2L5wIk4TE/EnK/n+9Y4w0A6sm9KqwSYDx6uh4Z3GaUZx3TQiaCx7gtvL3sEcomBx Cd65Vkclh47p+DPJ3wBsE330EzPlV9Wx65rlYDlCnCfiO8CfAbL0U38EtwEzCUuLhaIU xmNxeLznxlHhE7Y6d9/yB3RoENnyxy4MdcsMu0FjmV4r3l5ccL9GHhHEMUR+guvbnvwW /uvo2Ziqd9ADuOYBYNydQ3bdPJ7LOEP/bZuflN5M9cvdMzKCmZHfDd0dDCM3JO/WJD5P LdYN7bItw+A42VFE81bdfm6Gc/Tb/Chdgk0WZnlWKEhWjF9Laofw1BBjtrLIsyL6zA8F G1jg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=aOcLULEJ; 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=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id hc19si562488ejc.634.2021.01.27.00.50.20; Wed, 27 Jan 2021 00:50:44 -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=@kernel.org header.s=k20201202 header.b=aOcLULEJ; 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=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233843AbhA0HYl (ORCPT + 99 others); Wed, 27 Jan 2021 02:24:41 -0500 Received: from mail.kernel.org ([198.145.29.99]:48200 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233559AbhA0HWJ (ORCPT ); Wed, 27 Jan 2021 02:22:09 -0500 Received: by mail.kernel.org (Postfix) with ESMTPSA id F0B662073C; Wed, 27 Jan 2021 07:21:28 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1611732089; bh=PHGvgPZS9fmzb8WwHWTDSJ0PUf4j0hQIB49cA17Ux8M=; h=References:In-Reply-To:From:Date:Subject:To:Cc:From; b=aOcLULEJAETe0ZlQOMFoWv+xV+961UgFHoRNBzUMPi/oFzrgBLf6fpFTjN/IS05QO zYzdqWHKfbJrw60OF8NQxrmzPpTarFG5BYYhXfdM82s2hq4GFbvrBTg0+/gc9t50It YL3Oe/Z9JLGMVM5I+aLWcGsKrktoXC5hMjaVZsxS33HhjLk4OG2Duzg5eJzML2qsTX SvIigcKxB7d/BjQsPegVpK8LEUO0LIj3aQP1HkoGMEQsssBIbzs2Nv5jASFVBV6Rrv RhIZkevlJdJVxgQR3wvBJsdnYdlgcaGm25mcIExHcY0pbsKd4dATwjIkTayV/aOI2P 9V2GznHJHrLLQ== Received: by mail-lf1-f41.google.com with SMTP id a12so1275057lfb.1; Tue, 26 Jan 2021 23:21:28 -0800 (PST) X-Gm-Message-State: AOAM532kN5kIFTnSDDNffFt8U5V1HRe1h0MbN/HVgBV6qoV0xLZPxmxN KmYwyOR4aAKVBpIVpB1CDNP8EMhivxYSCxNfDYg= X-Received: by 2002:a05:6512:b1b:: with SMTP id w27mr4516614lfu.10.1611732087108; Tue, 26 Jan 2021 23:21:27 -0800 (PST) MIME-Version: 1.0 References: <20210126145247.1964410-1-hch@lst.de> <20210126145247.1964410-12-hch@lst.de> In-Reply-To: <20210126145247.1964410-12-hch@lst.de> From: Song Liu Date: Tue, 26 Jan 2021 23:21:16 -0800 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH 11/17] md: remove bio_alloc_mddev To: Christoph Hellwig Cc: Jens Axboe , Jaegeuk Kim , Chao Yu , Philipp Reisner , Lars Ellenberg , Coly Li , Mike Snitzer , Josef Bacik , David Sterba , Damien Le Moal , Naohiro Aota , Andrew Morton , Ryusuke Konishi , linux-nilfs@vger.kernel.org, dm-devel@redhat.com, linux-f2fs-devel@lists.sourceforge.net, linux-block@vger.kernel.org, drbd-dev@lists.linbit.com, linux-bcache@vger.kernel.org, linux-raid , Linux-Fsdevel , linux-btrfs@vger.kernel.org, linux-nfs@vger.kernel.org, Linux-MM Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-nfs@vger.kernel.org On Tue, Jan 26, 2021 at 7:12 AM Christoph Hellwig wrote: > > bio_alloc_mddev is never called with a NULL mddev, and ->bio_set is > initialized in md_run, so it always must be initialized as well. Just > open code the remaining call to bio_alloc_bioset. > > Signed-off-by: Christoph Hellwig Acked-by: Song Liu > --- > drivers/md/md.c | 12 +----------- > drivers/md/md.h | 2 -- > drivers/md/raid1.c | 2 +- > drivers/md/raid10.c | 2 +- > 4 files changed, 3 insertions(+), 15 deletions(-) > > diff --git a/drivers/md/md.c b/drivers/md/md.c > index 7d1bb24add3107..e2b9dbb6e888f6 100644 > --- a/drivers/md/md.c > +++ b/drivers/md/md.c > @@ -340,16 +340,6 @@ static int start_readonly; > */ > static bool create_on_open = true; > > -struct bio *bio_alloc_mddev(gfp_t gfp_mask, int nr_iovecs, > - struct mddev *mddev) > -{ > - if (!mddev || !bioset_initialized(&mddev->bio_set)) > - return bio_alloc(gfp_mask, nr_iovecs); > - > - return bio_alloc_bioset(gfp_mask, nr_iovecs, &mddev->bio_set); > -} > -EXPORT_SYMBOL_GPL(bio_alloc_mddev); > - > static struct bio *md_bio_alloc_sync(struct mddev *mddev) > { > if (!mddev || !bioset_initialized(&mddev->sync_set)) > @@ -613,7 +603,7 @@ static void submit_flushes(struct work_struct *ws) > atomic_inc(&rdev->nr_pending); > atomic_inc(&rdev->nr_pending); > rcu_read_unlock(); > - bi = bio_alloc_mddev(GFP_NOIO, 0, mddev); > + bi = bio_alloc_bioset(GFP_NOIO, 0, &mddev->bio_set); > bi->bi_end_io = md_end_flush; > bi->bi_private = rdev; > bio_set_dev(bi, rdev->bdev); > diff --git a/drivers/md/md.h b/drivers/md/md.h > index f13290ccc1c248..bcbba1b5ec4a71 100644 > --- a/drivers/md/md.h > +++ b/drivers/md/md.h > @@ -742,8 +742,6 @@ extern void md_rdev_clear(struct md_rdev *rdev); > extern void md_handle_request(struct mddev *mddev, struct bio *bio); > extern void mddev_suspend(struct mddev *mddev); > extern void mddev_resume(struct mddev *mddev); > -extern struct bio *bio_alloc_mddev(gfp_t gfp_mask, int nr_iovecs, > - struct mddev *mddev); > > extern void md_reload_sb(struct mddev *mddev, int raid_disk); > extern void md_update_sb(struct mddev *mddev, int force); > diff --git a/drivers/md/raid1.c b/drivers/md/raid1.c > index 3b19141cdb4bc2..d2378765dc154f 100644 > --- a/drivers/md/raid1.c > +++ b/drivers/md/raid1.c > @@ -1104,7 +1104,7 @@ static void alloc_behind_master_bio(struct r1bio *r1_bio, > int i = 0; > struct bio *behind_bio = NULL; > > - behind_bio = bio_alloc_mddev(GFP_NOIO, vcnt, r1_bio->mddev); > + behind_bio = bio_alloc_bioset(GFP_NOIO, vcnt, &r1_bio->mddev->bio_set); > if (!behind_bio) > return; > > diff --git a/drivers/md/raid10.c b/drivers/md/raid10.c > index be8f14afb6d143..e1eefbec15d444 100644 > --- a/drivers/md/raid10.c > +++ b/drivers/md/raid10.c > @@ -4531,7 +4531,7 @@ static sector_t reshape_request(struct mddev *mddev, sector_t sector_nr, > return sectors_done; > } > > - read_bio = bio_alloc_mddev(GFP_KERNEL, RESYNC_PAGES, mddev); > + read_bio = bio_alloc_bioset(GFP_KERNEL, RESYNC_PAGES, &mddev->bio_set); > > bio_set_dev(read_bio, rdev->bdev); > read_bio->bi_iter.bi_sector = (r10_bio->devs[r10_bio->read_slot].addr > -- > 2.29.2 >