Received: by 2002:a05:6a10:9afc:0:0:0:0 with SMTP id t28csp13110pxm; Tue, 1 Mar 2022 13:54:27 -0800 (PST) X-Google-Smtp-Source: ABdhPJzEn33SUuOrmFY1a2x4lji29B7R3FZ/jfKVlHbm/n3wyUpXkzjGtqvUX4gWQgYriwkTfhqj X-Received: by 2002:a17:90a:5802:b0:1b8:b737:a62b with SMTP id h2-20020a17090a580200b001b8b737a62bmr23918012pji.123.1646171666675; Tue, 01 Mar 2022 13:54:26 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1646171666; cv=none; d=google.com; s=arc-20160816; b=FJiU82pu+VBVCJuuo30yj95hyJ03x1x32Kuj1lIf9AaEtF9Xf7HQnXRQfyQ+pyPApg xX+SoyDIpBAhVNQSc9BhgeEBwJxooIWqkBsaqWfVdBQGk9ddDL5pXncIFno8odcd/+D0 yzb6iA45noZBb2u1fJ2BL+EuwJQ/f2EKzTjZl6Cr1MM4/xvzMQR/jdTsrSFdRbNRozUl 6iEP9M5pfIX6avptq1fyKD5XA1iSBT95Z2FFRFghvSms7opx0RY9OQk12fEXnLEAAOIF JP9yLxAthRBXr45NutpiX4R4uh1WkyZQ0sWiz3j+anaVL1cS2rwcgtB8NsZZVt6m98qo XQ4w== 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=PIwmC/45DWKh9veAl53jqG4nMVgnAvBfs+f+Iys/sgk=; b=qeM6v2ZPSCm93fTJfHSZMS0FbLUaMO4FpdrdsCDdn3s9BiW1IRTcA6VsRMJMGSt/Ok c6+HYueXbfbudbn/zEpD7Fni9W+yNDp24F2uohqURzvZbPxuV0RunPF17XqIVR+iuNIf qucIpJ1fER2aUTuk5vsgVRUCTFBoOs0/7eXMV6rmiJH/tdrR8Z6PszO/7ieakQBPxl0W CgFls5dmahJh6QRYLYh6p12k2s96sl5iRPA5mNU7tBQ8kypC52Z9mQytlINOeRK1kv6H WzWRw2ujJt3oRbgxjMs7Nr+BgXFnwi+FWievFZzQ0cXGD6nxzKX9MCzugpxaQTWIZcyf j2ow== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@infradead.org header.s=bombadil.20210309 header.b=cVatoR0y; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id o8-20020a170902d4c800b0014f61886291si16226147plg.172.2022.03.01.13.53.54; Tue, 01 Mar 2022 13:54:26 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@infradead.org header.s=bombadil.20210309 header.b=cVatoR0y; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233507AbiCAIq6 (ORCPT + 99 others); Tue, 1 Mar 2022 03:46:58 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60764 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233505AbiCAIqw (ORCPT ); Tue, 1 Mar 2022 03:46:52 -0500 Received: from bombadil.infradead.org (bombadil.infradead.org [IPv6:2607:7c80:54:e::133]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 39429887A8; Tue, 1 Mar 2022 00:46:12 -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=PIwmC/45DWKh9veAl53jqG4nMVgnAvBfs+f+Iys/sgk=; b=cVatoR0ymAYV0qkd6qq/uvEU7K HeqFKc/bZ8QFoD5QhqdE7bmqU89/KWubNGPa/ji/9kVZhLy3IWZixcLVm81jA1WxOiX3NQ6Ws8bfw RU21nikvID52vLUrJZhRnsfVxQ+8uTeVc4/9CTSwTZv8J+EeUtokRLlfhJwM2nxlVIrHUd80/hvUc MxnOS6ZQ+zyc2D6yEqI0GLnZcFUuto+VxA8gnzeD1P2cbr0MkmRTJg/7LSLpsMdNxBwR5dvq8rUhW SfoDFXBbZ0ofT2yWnNUsPYT7s7x8WMigAenpsHcCYoaE1cQFo4zlpYkO8GDTgfNNIx62k+uFEemf4 Vzj76smQ==; Received: from [2.53.44.23] (helo=localhost) by bombadil.infradead.org with esmtpsa (Exim 4.94.2 #2 (Red Hat Linux)) id 1nOy8x-00FfPs-7Z; Tue, 01 Mar 2022 08:46:04 +0000 From: Christoph Hellwig To: Jens Axboe Cc: Coly Li , Mike Snitzer , Song Liu , "Martin K. Petersen" , Josef Bacik , David Sterba , Phillip Lougher , linux-block@vger.kernel.org, dm-devel@redhat.com, linux-kernel@vger.kernel.org, linux-bcache@vger.kernel.org, linux-raid@vger.kernel.org, target-devel@vger.kernel.org, linux-btrfs@vger.kernel.org Subject: [PATCH 2/5] squashfs: always use bio_kmalloc in squashfs_bio_read Date: Tue, 1 Mar 2022 10:45:49 +0200 Message-Id: <20220301084552.880256-3-hch@lst.de> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20220301084552.880256-1-hch@lst.de> References: <20220301084552.880256-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 X-Spam-Status: No, score=-4.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_EF,HEADER_FROM_DIFFERENT_DOMAINS, RCVD_IN_DNSWL_MED,SPF_HELO_NONE,SPF_NONE,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org If a plain kmalloc that is not backed by a mempool is safe here for a large read (and the actual page allocations), it must also be for a small one, so simplify the code a bit. Signed-off-by: Christoph Hellwig --- fs/squashfs/block.c | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/fs/squashfs/block.c b/fs/squashfs/block.c index 622c844f6d118..4311a32218928 100644 --- a/fs/squashfs/block.c +++ b/fs/squashfs/block.c @@ -86,16 +86,11 @@ static int squashfs_bio_read(struct super_block *sb, u64 index, int length, int error, i; struct bio *bio; - if (page_count <= BIO_MAX_VECS) { - bio = bio_alloc(sb->s_bdev, page_count, REQ_OP_READ, GFP_NOIO); - } else { - bio = bio_kmalloc(GFP_NOIO, page_count); - bio_set_dev(bio, sb->s_bdev); - bio->bi_opf = REQ_OP_READ; - } - + bio = bio_kmalloc(GFP_NOIO, page_count); if (!bio) return -ENOMEM; + bio_set_dev(bio, sb->s_bdev); + bio->bi_opf = REQ_OP_READ; bio->bi_iter.bi_sector = block * (msblk->devblksize >> SECTOR_SHIFT); -- 2.30.2