Received: by 2002:a05:6a10:af89:0:0:0:0 with SMTP id iu9csp3503644pxb; Mon, 24 Jan 2022 10:56:16 -0800 (PST) X-Google-Smtp-Source: ABdhPJzN9w+d9wIWPiS5yoAOXUpZl4EPwnsat2ok44FxqZHWPwuYSVxfu1WrSGu0Gs3phpUs7yb6 X-Received: by 2002:a65:5887:: with SMTP id d7mr6079748pgu.503.1643050576414; Mon, 24 Jan 2022 10:56:16 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1643050576; cv=none; d=google.com; s=arc-20160816; b=bF4FvPr3IaDuCXj4Lb5K1mBulUNywhG8gcfstBnrwlMcTBTmJgZckll5Dw/eD7rMQZ gvpGl0WgL8XTTn7JCRjYXI0NZbOuBXCYbzg9vBzaGsmoEvp+c17K1umNIeS1+18eRS4e jqvnOBAiZEm5Tdoy53nLJuMh7vxp1kMAHGqoUb7Dqmm7JVIqzEFSZQSv11wPdy1amWeF x2cagaNMhTteu/ItCN2zAT6XgfN+gmYU88P3w4E9WGBaTUzr4T+Wy8luoRG4DozUxC7I 2fv3GimuO0/qGXzcTymP0a9XrBlxS78aPF2+hud4W/lYQyE++XJWtEF0JGoQDkfHMjyt oKzg== 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=7QPyuzOR2N2LqXuXA08GkKhJ7fsHc2fxZXqTeovi8aQ=; b=CWdrBYvqVL6uFOTyaH1Rd+qhK1Ej5dg8hJfDk4qdaUnvx48uh/H9o1AsM23g7SRPkb 84AH7mM9ltRjhPjfc/25kihqFIKXQsfN/ejGOwzNMVTeGU3n+QM+w67BJkYvMEEJqFRZ VHV3rbqogj1KiO+jN8HXwG41GhE8Zbc4D7yNxwzizMebG+C1Rr+IGhoPJGgscwml/Y9T Rf+7jLGEHqY96R5XJyQ/Htir4T1hSGrcv4iQDsiUt/FboHFG7lgm7V/XXX6u+gZ35lUi lfi7dBTalE35uPDWumB3ttFIc1t6uk097PmT8LmLN5gN2qrqdH1SC9aUXzRiVqSS32tj NcyQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@infradead.org header.s=bombadil.20210309 header.b=2kZbM0T8; 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 k9si16512622pfu.226.2022.01.24.10.56.03; Mon, 24 Jan 2022 10:56:16 -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=2kZbM0T8; 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 S242614AbiAXJLZ (ORCPT + 99 others); Mon, 24 Jan 2022 04:11:25 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47234 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S242600AbiAXJLX (ORCPT ); Mon, 24 Jan 2022 04:11:23 -0500 Received: from bombadil.infradead.org (bombadil.infradead.org [IPv6:2607:7c80:54:e::133]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4FF60C061401; Mon, 24 Jan 2022 01:11:22 -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=7QPyuzOR2N2LqXuXA08GkKhJ7fsHc2fxZXqTeovi8aQ=; b=2kZbM0T8QbsM92lbMKqXzE0qN2 BriYoV4AmiZRKSGpRmt1ddIwn28XJ7g+yBaV1K4id1qDq8Pv48KVl9NtssO6c1vWo4jkhX3iORWze kh5EiBljdNHNvsDLJO6R+tnfX9vWUmnrDiZYXxyIrOEeexYhsimX7cdkKwI+Ju4bAO8b7afxXuYfB ZGoprdRWUIkzCymUv80hK8SCFVqF4kUf0wcLCJaVymk3vX6D/JEMW+djci/m/kvJDut4IzkrML+3l aTXx4e+8l8JI71daFpL4tsVOfzrp/ZSz3X2y4SzN0vz4tycRc583YoUfd0/5Dt/Q1+sjPg/e9lr6d WjO16WFA==; 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 1nBvNa-002jzZ-UA; Mon, 24 Jan 2022 09:11:15 +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 02/19] nilfs2: remove nilfs_alloc_seg_bio Date: Mon, 24 Jan 2022 10:10:50 +0100 Message-Id: <20220124091107.642561-3-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 nilfs_alloc_seg_bio helper and open code it in the only caller. Signed-off-by: Christoph Hellwig --- fs/nilfs2/segbuf.c | 31 ++++--------------------------- 1 file changed, 4 insertions(+), 27 deletions(-) diff --git a/fs/nilfs2/segbuf.c b/fs/nilfs2/segbuf.c index 43287b0d3e9b6..53b7c6d21cdd8 100644 --- a/fs/nilfs2/segbuf.c +++ b/fs/nilfs2/segbuf.c @@ -371,29 +371,6 @@ static int nilfs_segbuf_submit_bio(struct nilfs_segment_buffer *segbuf, return err; } -/** - * nilfs_alloc_seg_bio - allocate a new bio for writing log - * @nilfs: nilfs object - * @start: start block number of the bio - * @nr_vecs: request size of page vector. - * - * Return Value: On success, pointer to the struct bio is returned. - * On error, NULL is returned. - */ -static struct bio *nilfs_alloc_seg_bio(struct the_nilfs *nilfs, sector_t start, - int nr_vecs) -{ - struct bio *bio; - - bio = bio_alloc(GFP_NOIO, nr_vecs); - if (likely(bio)) { - bio_set_dev(bio, nilfs->ns_bdev); - bio->bi_iter.bi_sector = - start << (nilfs->ns_blocksize_bits - 9); - } - return bio; -} - static void nilfs_segbuf_prepare_write(struct nilfs_segment_buffer *segbuf, struct nilfs_write_info *wi) { @@ -414,10 +391,10 @@ static int nilfs_segbuf_submit_bh(struct nilfs_segment_buffer *segbuf, BUG_ON(wi->nr_vecs <= 0); repeat: if (!wi->bio) { - wi->bio = nilfs_alloc_seg_bio(wi->nilfs, wi->blocknr + wi->end, - wi->nr_vecs); - if (unlikely(!wi->bio)) - return -ENOMEM; + wi->bio = bio_alloc(GFP_NOIO, wi->nr_vecs); + bio_set_dev(wi->bio, wi->nilfs->ns_bdev); + wi->bio->bi_iter.bi_sector = (wi->blocknr + wi->end) << + (wi->nilfs->ns_blocksize_bits - 9); } len = bio_add_page(wi->bio, bh->b_page, bh->b_size, bh_offset(bh)); -- 2.30.2