Received: by 2002:a05:6a10:af89:0:0:0:0 with SMTP id iu9csp3503500pxb; Mon, 24 Jan 2022 10:56:05 -0800 (PST) X-Google-Smtp-Source: ABdhPJzOzzH+KzbjA/cXpU9yXpsHRMgK5sYwF1cd4wCAWonXlrsu+1ab1xACw8rbYWPKx0GR25Ms X-Received: by 2002:a17:903:28c:b0:14b:4a6d:4693 with SMTP id j12-20020a170903028c00b0014b4a6d4693mr6592147plr.7.1643050565043; Mon, 24 Jan 2022 10:56:05 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1643050565; cv=none; d=google.com; s=arc-20160816; b=JBHyMmK7DivGXfmofqTc7r+o4Qik99UNg0SXaQGSJMOMvuYilhQVA5ObG99K5YZfod s6CSwui3TalvILUB+cQhblqW1Kt2uJZSarnQZH7oRdfO3MhlDiq+uibxKsVN6FBpKosR eAzY9zhErekoHmvzPeLF9SDQz6ZI9ZHec1zoUvovJ8NOLgvkWu+CuDUjeNbRQ/6krdBx zhBvjGbcWHDzYzaaeplwErIinQ72OHPaG2K913nH28kQewaFm/3L3F+hhF2OVVrXO5OL VOZB9sR5ilM4hctX4WSUYc/q6P7T9lo3eh9WDqYpfDKM7jSZnXmM7RAfHOBK17BFV+vB N2Aw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=pMAOIxwEWgivE8T/8jAutxBqi67ojpc7aSJ9Dfvp1Nk=; b=IbRzXCXOB4wi7NYSWHIv/ZFVmau/ISOmE6mInaEhoEig+hPBRpi4AgF8Zpy6ZRLRQI 0jo2L3ScvIjfBTz/CyhnMeXqOO53CW9Hj/Qedr4wkWVfllWL6F9vsXjWTWBuSlT2X+ip hrh+XO81Q2cRj03BfcnK+v/PDXPVlj0I1YZ8cruhe2KE/GR2xF6ck9eU4TI8qN2eLRPm ypacQM9hTJQZfE4t5CEs7uuOYby1ewGFwRomg/ZYNKz+ew7rtNoGyz6yfrbkIykklR27 o4q5q8P5yKXHsGwMQOnpPZxkj/wtBhjDFEqbWRL+xZ2Zs/iiBPqNjAqXe1H1i12seS+g BKwA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@infradead.org header.s=bombadil.20210309 header.b=xHe2ACiT; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id e7si13665861pgg.78.2022.01.24.10.55.51; Mon, 24 Jan 2022 10:56:05 -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=@infradead.org header.s=bombadil.20210309 header.b=xHe2ACiT; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S242613AbiAXJL1 (ORCPT + 99 others); Mon, 24 Jan 2022 04:11:27 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47252 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S242617AbiAXJLZ (ORCPT ); Mon, 24 Jan 2022 04:11:25 -0500 Received: from bombadil.infradead.org (bombadil.infradead.org [IPv6:2607:7c80:54:e::133]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id EF156C06173B; Mon, 24 Jan 2022 01:11:24 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20210309; h=Content-Transfer-Encoding: MIME-Version:References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From:Sender :Reply-To:Content-Type:Content-ID:Content-Description; bh=pMAOIxwEWgivE8T/8jAutxBqi67ojpc7aSJ9Dfvp1Nk=; b=xHe2ACiTwAYAjp/I5zJRyXa8ki JlnNLXudrLlXUiX6cEigCKlkTBhciArJsMDCFKqz+sqi60Z5HlA6HuKOjc7Lxa8uuV31Tjrrn9i2o fuitG3t8mkNF95ga5JGVLb/VdVUg2NdWllmOqOY00XjI0JRdDRzciunmhniPRzNPdtSaYWxdCyNzc Musr2zaRq8/xl+srtNtDGeIaNmqqS9DkkHEJKhT1AK/jQGaZWQNg+DZ6Yc1BQDudjwt+F39JP3zQ7 blPTtw58n/XnFVYKRC4Mt5UJvveE4UCZ4e+Nrt7XpLtReKDGM7X7AGj2ChOx6sVKSwUgI5CuSTWdy lzb9QxpQ==; Received: from [2001:4bb8:184:72a4:a337:a75f:a24e:7e39] (helo=localhost) by bombadil.infradead.org with esmtpsa (Exim 4.94.2 #2 (Red Hat Linux)) id 1nBvNd-002k0e-Og; Mon, 24 Jan 2022 09:11:18 +0000 From: Christoph Hellwig To: Jens Axboe Cc: Pavel Begunkov , Mike Snitzer , Ryusuke Konishi , Konstantin Komarov , Andrew Morton , "Md . Haris Iqbal " , Jack Wang , =?UTF-8?q?Roger=20Pau=20Monn=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 Subject: [PATCH 03/19] nfs/blocklayout: remove bl_alloc_init_bio Date: Mon, 24 Jan 2022 10:10:51 +0100 Message-Id: <20220124091107.642561-4-hch@lst.de> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20220124091107.642561-1-hch@lst.de> References: <20220124091107.642561-1-hch@lst.de> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-SRS-Rewrite: SMTP reverse-path rewritten from by bombadil.infradead.org. See http://www.infradead.org/rpr.html Precedence: bulk List-ID: X-Mailing-List: linux-nfs@vger.kernel.org bio_alloc will never fail when it can sleep. Remove the now simple bl_alloc_init_bio helper and open code it in the only caller. Signed-off-by: Christoph Hellwig --- fs/nfs/blocklayout/blocklayout.c | 26 +++++--------------------- 1 file changed, 5 insertions(+), 21 deletions(-) diff --git a/fs/nfs/blocklayout/blocklayout.c b/fs/nfs/blocklayout/blocklayout.c index fe860c5387476..38e063af7e98a 100644 --- a/fs/nfs/blocklayout/blocklayout.c +++ b/fs/nfs/blocklayout/blocklayout.c @@ -115,23 +115,6 @@ bl_submit_bio(struct bio *bio) return NULL; } -static struct bio *bl_alloc_init_bio(unsigned int npg, - struct block_device *bdev, sector_t disk_sector, - bio_end_io_t end_io, struct parallel_io *par) -{ - struct bio *bio; - - npg = bio_max_segs(npg); - bio = bio_alloc(GFP_NOIO, npg); - if (bio) { - bio->bi_iter.bi_sector = disk_sector; - bio_set_dev(bio, bdev); - bio->bi_end_io = end_io; - bio->bi_private = par; - } - return bio; -} - static bool offset_in_map(u64 offset, struct pnfs_block_dev_map *map) { return offset >= map->start && offset < map->start + map->len; @@ -171,10 +154,11 @@ do_add_page_to_bio(struct bio *bio, int npg, int rw, sector_t isect, retry: if (!bio) { - bio = bl_alloc_init_bio(npg, map->bdev, - disk_addr >> SECTOR_SHIFT, end_io, par); - if (!bio) - return ERR_PTR(-ENOMEM); + bio = bio_alloc(GFP_NOIO, bio_max_segs(npg)); + bio->bi_iter.bi_sector = disk_addr >> SECTOR_SHIFT; + bio_set_dev(bio, map->bdev); + bio->bi_end_io = end_io; + bio->bi_private = par; bio_set_op_attrs(bio, rw, 0); } if (bio_add_page(bio, page, *len, offset) < *len) { -- 2.30.2