From patchwork Mon Jan 24 09:11:00 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christoph Hellwig X-Patchwork-Id: 12721774 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 466C1C433F5 for ; Mon, 24 Jan 2022 09:12:07 +0000 (UTC) Received: from list by lists.xenproject.org with outflank-mailman.259779.448422 (Exim 4.92) (envelope-from ) id 1nBvOH-0005kZ-MA; Mon, 24 Jan 2022 09:11:57 +0000 X-Outflank-Mailman: Message body and most headers restored to incoming version Received: by outflank-mailman (output) from mailman id 259779.448422; Mon, 24 Jan 2022 09:11:57 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1nBvOH-0005jp-FO; Mon, 24 Jan 2022 09:11:57 +0000 Received: by outflank-mailman (input) for mailman id 259779; Mon, 24 Jan 2022 09:11:56 +0000 Received: from se1-gles-sth1-in.inumbo.com ([159.253.27.254] helo=se1-gles-sth1.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1nBvOG-0000Il-14 for xen-devel@lists.xenproject.org; Mon, 24 Jan 2022 09:11:56 +0000 Received: from bombadil.infradead.org (bombadil.infradead.org [2607:7c80:54:e::133]) by se1-gles-sth1.inumbo.com (Halon) with ESMTPS id ac7c8a71-7cf5-11ec-8fa7-f31e035a9116; Mon, 24 Jan 2022 10:11:55 +0100 (CET) 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 1nBvO3-002kGt-6c; Mon, 24 Jan 2022 09:11:43 +0000 X-BeenThere: xen-devel@lists.xenproject.org List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xenproject.org Precedence: list Sender: "Xen-devel" X-Inumbo-ID: ac7c8a71-7cf5-11ec-8fa7-f31e035a9116 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=Hmdul2b824Aw+W7hsxfLRPm+W2xGls7ShW1BUgArE2A=; b=pWc0N5kYb4bArsjIbr1mc2MULT 3C8ao+NuMPVQ2pEhWYD0pS4OEiDwzWJcF3OQWJ/7qPuRxogxWFPuvaH/AdXs6d9RZUXZ3YF8Gb0Z3 adpO4UBuk/hqPQGUGdkP7euk2NRZzk0iS7A1P8UCLCAKB11FO7xYa9uy+6z1r53Ll03uwC/sZF7Bz 2AYkMWod1x441+zLUUKusAzBIuZ96nUG4RvGk5j2uXutO+aMMny3ji5ZOHON/lia9Bdro8LDESVGt +7vVuZZXadeZX2arJ2UfxF0DCT0MLTUT8dyRYXfgOb5VGvKJj2KC8zrta0vgK9UgXnaGvmHM5Jw+1 YxPUbcZQ==; 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_Pau_Monn=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 12/19] xen-blkback: bio_alloc can't fail if it is allow to sleep Date: Mon, 24 Jan 2022 10:11:00 +0100 Message-Id: <20220124091107.642561-13-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 X-SRS-Rewrite: SMTP reverse-path rewritten from by bombadil.infradead.org. See http://www.infradead.org/rpr.html Remove handling of NULL returns from sleeping bio_alloc calls given that those can't fail. Signed-off-by: Christoph Hellwig --- drivers/block/xen-blkback/blkback.c | 14 -------------- 1 file changed, 14 deletions(-) diff --git a/drivers/block/xen-blkback/blkback.c b/drivers/block/xen-blkback/blkback.c index 14e452896d04c..6bb2ad7692065 100644 --- a/drivers/block/xen-blkback/blkback.c +++ b/drivers/block/xen-blkback/blkback.c @@ -1327,9 +1327,6 @@ static int dispatch_rw_block_io(struct xen_blkif_ring *ring, seg[i].nsec << 9, seg[i].offset) == 0)) { bio = bio_alloc(GFP_KERNEL, bio_max_segs(nseg - i)); - if (unlikely(bio == NULL)) - goto fail_put_bio; - biolist[nbio++] = bio; bio_set_dev(bio, preq.bdev); bio->bi_private = pending_req; @@ -1346,9 +1343,6 @@ static int dispatch_rw_block_io(struct xen_blkif_ring *ring, BUG_ON(operation_flags != REQ_PREFLUSH); bio = bio_alloc(GFP_KERNEL, 0); - if (unlikely(bio == NULL)) - goto fail_put_bio; - biolist[nbio++] = bio; bio_set_dev(bio, preq.bdev); bio->bi_private = pending_req; @@ -1381,14 +1375,6 @@ static int dispatch_rw_block_io(struct xen_blkif_ring *ring, free_req(ring, pending_req); msleep(1); /* back off a bit */ return -EIO; - - fail_put_bio: - for (i = 0; i < nbio; i++) - bio_put(biolist[i]); - atomic_set(&pending_req->pendcnt, 1); - __end_block_io_op(pending_req, BLK_STS_RESOURCE); - msleep(1); /* back off a bit */ - return -EIO; }