From mboxrd@z Thu Jan 1 00:00:00 1970 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 kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 2FACDC433F5 for ; Tue, 31 May 2022 20:56:56 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id B5A426B0071; Tue, 31 May 2022 16:56:55 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id B09356B0073; Tue, 31 May 2022 16:56:55 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 9F6856B0074; Tue, 31 May 2022 16:56:55 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0013.hostedemail.com [216.40.44.13]) by kanga.kvack.org (Postfix) with ESMTP id 8D16A6B0071 for ; Tue, 31 May 2022 16:56:55 -0400 (EDT) Received: from smtpin04.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay07.hostedemail.com (Postfix) with ESMTP id 5426821429 for ; Tue, 31 May 2022 20:56:55 +0000 (UTC) X-FDA: 79527247590.04.F606367 Received: from casper.infradead.org (casper.infradead.org [90.155.50.34]) by imf20.hostedemail.com (Postfix) with ESMTP id 8BB451C005A for ; Tue, 31 May 2022 20:56:36 +0000 (UTC) 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-Rspam-User: X-Rspamd-Server: rspam02 X-Rspamd-Queue-Id: 8BB451C005A X-Stat-Signature: mj8e8ae6x41uec64theihtznushkejgn Authentication-Results: imf20.hostedemail.com; dkim=pass header.d=infradead.org header.s=casper.20170209 header.b=ql3efslw; dmarc=none; spf=none (imf20.hostedemail.com: domain of willy@infradead.org has no SPF policy when checking 90.155.50.34) smtp.mailfrom=willy@infradead.org X-HE-Tag: 1654030596-830882 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: 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.