Received: by 2002:a05:6a10:2726:0:0:0:0 with SMTP id ib38csp1032903pxb; Wed, 6 Apr 2022 07:09:44 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzrRAvzmMeYJuVt9AHQqEGqrENwikLzsjFieko/yEqNIQITEcIntw6JfI9680H3jrMT0K7R X-Received: by 2002:a17:90b:3447:b0:1c6:fe01:675c with SMTP id lj7-20020a17090b344700b001c6fe01675cmr9913728pjb.59.1649254183700; Wed, 06 Apr 2022 07:09:43 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1649254183; cv=none; d=google.com; s=arc-20160816; b=R4bPLcxZu4DVIvUlEPAlRLZVFXx0dHTo2CZWxPb0c6NiF9j//OkAPFKBFPz/vUcWSp rkIKFwsVBdEZCLG0BKNvzHMZx49sloq1zu46VwSEo5SF7l5J8/fu9x/uaqj0MZhYckU7 M9S5GFtmfRuN9jEQ+Sf/Opg3bKJks+ESCPGWTfupMUBjNEjrM9AEIBYs94+tPCM/LiLX eLpMZX5kjiB4wtEo3aQddKSElRx/OHm1TWOr/5MUpssX0yH9L8/SaQLExX8b+1tA70I8 TXkDXmemcoezC8PDUjVRdIlmX9hdfYiGK1+sODBF4qi8iI8d8xBNK7iuTnjOZjhrFmGe ci1g== 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=VAc1SDe4gjp1IeSSzcV0Im0HYJaPZbBGhfAm1TWpBFw=; b=0/zLkgm40IlD7q7YEvPW58BXMLziZbeNsYr393BPv8pPaVRjNGmPTe46Qp2SSuPQA4 wNXXy00YVHx9h/WOk7zOIPONe1HKlCvlo2mlkSBefnyYoq1fSijPUgmqOySj/Oz7vXM2 gdimCp2fzCxx+fq9WmnZ/h5gfVkRLhs4NIePCAPDLxsNNre/q7Ge9VodcS6HfexgKj8f Vr1eDhHllRzhBjuCZx1m1zF2XfYBtZl/epoYX+mZvQogDTOC/ffDHEUfu6YTR44s8KSL 6UYi97+5V/1K6ox2ECMUgqAyxAOW1nu5iP0E5AKfWF0KWLsgSf9NHNQHgWuvNlfr9Dgv q52A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@infradead.org header.s=bombadil.20210309 header.b=Vx9zBRc9; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [2620:137:e000::1:18]) by mx.google.com with ESMTPS id y5-20020a655b05000000b0038182140602si16320419pgq.283.2022.04.06.07.09.42 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 06 Apr 2022 07:09:43 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) client-ip=2620:137:e000::1:18; Authentication-Results: mx.google.com; dkim=pass header.i=@infradead.org header.s=bombadil.20210309 header.b=Vx9zBRc9; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 1E4B62AE714; Wed, 6 Apr 2022 04:56:45 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1387562AbiDFJdn (ORCPT + 99 others); Wed, 6 Apr 2022 05:33:43 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57888 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1579875AbiDFJUm (ORCPT ); Wed, 6 Apr 2022 05:20:42 -0400 Received: from bombadil.infradead.org (bombadil.infradead.org [IPv6:2607:7c80:54:e::133]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4228F493CF6; Tue, 5 Apr 2022 23:12:48 -0700 (PDT) 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=VAc1SDe4gjp1IeSSzcV0Im0HYJaPZbBGhfAm1TWpBFw=; b=Vx9zBRc9mFA8+LncYvFBjDM/Zb pbcSroZVNHizo8ag1zgWczJkPwKyKrQV0Ddx6EtdqvoGmN3ZLUsdLKTvi8QUvBrGPji55y+TUibqi zyo3CCB6cpnNSwb7pmnPjpZLbfI+B4eUtQGJWZq/5pEMe3rKUBPsxd5x/+cxg3WaQbqwyNjJEdwOv wwzXFbniePin6IMVNBsd2AtdfZYr63VsrGFltkW81NlLLVM1vcyriYiHfwMSFTiiKxwjpPqx/tka1 AeQtcSuZloD2zhVzVK5deQgejH67DXoe5LPb6Dlnskg8Cwr4FIv0XDPOAN09vQpBnQ8QmlfUg1UAv 3CHBg+qg==; Received: from 213-225-3-188.nat.highway.a1.net ([213.225.3.188] helo=localhost) by bombadil.infradead.org with esmtpsa (Exim 4.94.2 #2 (Red Hat Linux)) id 1nbyuE-003zKG-M9; Wed, 06 Apr 2022 06:12:39 +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: Wed, 6 Apr 2022 08:12:25 +0200 Message-Id: <20220406061228.410163-3-hch@lst.de> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20220406061228.410163-1-hch@lst.de> References: <20220406061228.410163-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=-1.9 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,RDNS_NONE, SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE autolearn=no 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 Acked-by: Phillip Lougher --- 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