Received: by 2002:a19:771d:0:0:0:0:0 with SMTP id s29csp1264147lfc; Wed, 1 Jun 2022 13:30:56 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxvIcHrxR5HYoWkSLCsNux6YNmLL300u55aFz2Hzm35C7a/tA29OXuHCi3sAFpTHSUMulrC X-Received: by 2002:a65:6751:0:b0:3c6:42ca:ceb8 with SMTP id c17-20020a656751000000b003c642caceb8mr979347pgu.565.1654115456607; Wed, 01 Jun 2022 13:30:56 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1654115456; cv=none; d=google.com; s=arc-20160816; b=i+6HXB3vYNZeDSzKa5lMz5eSwvl2jlB7vXluZUU8SW75CvwSkgkWVKLTZ2a1VBsW4p H1r/TL9aiy9OoRDNDYy4DCJXeENLneBDO78xmyL3ab0Q0ZHgOr/CWA16oLeq6vLO6CZX lFTCrmJ9/CLCHhC1SI24GXxiDwKGiRxGGMCyCsRcAXiNsY0vzTnCq4xEyyx3Q2XXYu9U Fyw0nJkmxvQYBx+X8mlRbznNEeHtT7d1c8xaqAEht1rOArOi+KKzmOHQcSqIHdVLITHA m3K/bC7ZZfNPOPMbKkmA9md+AHT56XBZkoPwZ+e5z1G61sR2WJ2LiTfZfah6zuEL6nwf vqbg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=jxv6pa/GQSvNspZCbrfqVAPKMjO/mPFnzXscylfgbAw=; b=f9+FPeQ2EPxXVpcT6i4Ck3LEVDj2W/MJ1ZZ0R7NhbDyWJuZ6qSCHg0oaDRpbbLuemy 9thVv25dis7ukuR3WzY8/vFSJiFyFCyRCSK0zjoADr2baKsjQftc0BD1P3Z/QvdqDwQB 4ydQm1SZQvMvvF1MW4gKP7CUH5IrT8N5oqQrzqxlTfCZVqB9QS/nfoZmxCvkVquGu07e 6ZGvFQGSRUdQPXR2XucpQZE+cy8f4+SwpnI28kXkcLnUE4Hx5WUBm2FQv0Pk7mntbyU+ mhgMLcw4aAeW5qQGfzug6xatERNZ0FHmLg8HsJl8guvu5VLhHLT6ZQHAa1w4ova9Peta BKIg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@infradead.org header.s=casper.20170209 header.b=ql3efslw; 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 g13-20020a056a000b8d00b0050e128eef5csi3631788pfj.154.2022.06.01.13.30.56 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 01 Jun 2022 13:30:56 -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=casper.20170209 header.b=ql3efslw; 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 06EF563EA; Wed, 1 Jun 2022 12:40:05 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1347739AbiEaU5L (ORCPT + 99 others); Tue, 31 May 2022 16:57:11 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56020 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S242689AbiEaU5K (ORCPT ); Tue, 31 May 2022 16:57:10 -0400 Received: from casper.infradead.org (casper.infradead.org [IPv6:2001:8b0:10b:1236::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DF29B17E2F for ; Tue, 31 May 2022 13:57:07 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.20170209; h=In-Reply-To:Content-Type:MIME-Version: References:Message-ID:Subject:Cc:To:From:Date:Sender:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description; bh=jxv6pa/GQSvNspZCbrfqVAPKMjO/mPFnzXscylfgbAw=; b=ql3efslw7Ia1xKIacf3yZct019 tWQSyiDcbYExYtkrvkvc9aYYRg5v0VA3S8Y6TekuIzYrdaezcfVYyEJb8x9W6pNfJHkVZfl0VnjWk 9v6xHV/KR70ot7xsv1H5ux0522tqTkf1CUeC78AC6gCeve5UCOJPK45R20TbKRzPuUY7kXKwhm5OZ AJF54GbokyCadkn51eHtPNU9/6AUG0DGthYpJWjce0bd36JujLU/KBRfbVptrC+L69zXZYPFrsYhG m4pJ9Dz0s+FVW8TokGQlsxLdsi2GFKaYAifNleEQnBAevnt7IE0ygpuOmdGVh7kJGyjn2Jw1csmfz +QRTApbA==; Received: from willy by casper.infradead.org with local (Exim 4.94.2 #2 (Red Hat Linux)) id 1nw8ur-005h3L-7m; Tue, 31 May 2022 20:56:37 +0000 Date: Tue, 31 May 2022 21:56:37 +0100 From: Matthew Wilcox To: Andrew Morton Cc: Hsin-Yi Wang , Phillip Lougher , Xiongwei Song , Zheng Liang , Zhang Yi , Hou Tao , Miao Xie , "linux-mm @ kvack . org" , "squashfs-devel @ lists . sourceforge . net" , linux-kernel@vger.kernel.org Subject: Re: [PATCH v3 3/3] squashfs: implement readahead Message-ID: References: <20220523065909.883444-1-hsinyi@chromium.org> <20220523065909.883444-4-hsinyi@chromium.org> <20220531134740.91ae4dcea1e06640ba1bfc12@linux-foundation.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20220531134740.91ae4dcea1e06640ba1bfc12@linux-foundation.org> X-Spam-Status: No, score=-2.0 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,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 On Tue, May 31, 2022 at 01:47:40PM -0700, Andrew Morton wrote: > > + for (;;) { > > + nr_pages = __readahead_batch(ractl, pages, max_pages); > > + if (!nr_pages) > > + break; > > + > > + if (readahead_pos(ractl) >= i_size_read(inode) || > > + nr_pages < max_pages) > > + goto skip_pages; > > + > > + index = pages[0]->index >> shift; > > + if ((pages[nr_pages - 1]->index >> shift) != index) > > + goto skip_pages; > > + > > + expected = index == file_end ? > > + (i_size_read(inode) & (msblk->block_size - 1)) : > > + msblk->block_size; > > + > > + bsize = read_blocklist(inode, index, &block); > > + if (bsize == 0) > > + goto skip_pages; > > + > > + res = squashfs_read_data(inode->i_sb, block, bsize, NULL, > > + actor); > > + > > + if (res == expected) { > > + /* Last page may have trailing bytes not filled */ > > + bytes = res % PAGE_SIZE; > > + if (bytes) { > > + pageaddr = kmap_atomic(pages[nr_pages - 1]); > > + memset(pageaddr + bytes, 0, PAGE_SIZE - bytes); > > + kunmap_atomic(pageaddr); > > + } > > + > > + for (i = 0; i < nr_pages; i++) > > + SetPageUptodate(pages[i]); > > + } > > res == -EIO is unhandled? No it isn't ... this is readahead, which means there's nobody to care about the error. The pages are left !Uptodate, which means that they'll be retried with a call to ->read_folio later. At that point, somebody actually wants the data in those pages, and they'll see the error.