From nobody Thu May 7 17:42:16 2026 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 28186C41535 for ; Mon, 23 May 2022 07:24:25 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229796AbiEWHYE (ORCPT ); Mon, 23 May 2022 03:24:04 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59054 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229861AbiEWHWT (ORCPT ); Mon, 23 May 2022 03:22:19 -0400 Received: from mail-vk1-xa30.google.com (mail-vk1-xa30.google.com [IPv6:2607:f8b0:4864:20::a30]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 83C1610575 for ; Mon, 23 May 2022 00:14:03 -0700 (PDT) Received: by mail-vk1-xa30.google.com with SMTP id t12so6660749vkt.5 for ; Mon, 23 May 2022 00:14:03 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=HDi9xEtp8+cj5bsf5JN5+R5BFytv9jkvX5VZGd9dnU0=; b=UxqkeG4TS7Vls3G5OKJGYepxuYjCZ6IqBoXYMtw9AN7M89IC4p4tPHJspPyVwwNDPz bYcgjDax771MYz9EiTay7QZhCfg2Pvkqx1v/ArsV2Sxu74SUvjVz2R6Eo8P7Gd8o/X5d FpFXd96eS2on1YHqFDjZE6a9RnvvkboSSOBSo= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=HDi9xEtp8+cj5bsf5JN5+R5BFytv9jkvX5VZGd9dnU0=; b=FcBiM7bTgdjRDaYFlTXY2TuwgI9eVFhvTkTEmrRCJGqyPnnUkSV2dDSAX+5AtTmIWe k63tra1umI2weSfE8ZU/OHHW77WR36HJLyxACp5sZXR++LKodVFRjotfHr6odpTgWCUn X4/MJiZtOHE3KCufcAi8LJr+Lxr1B8fSpIgJ77QWvJ4Wny8hunM3h8vELIjfRTNUlR3Q 61xmtOMZhSJLmuoLGyFsn1SliqoL+QtU7yxjL/J+YzGTYVklFHIMsX5iQcfdSNy7l6LK 1AW/Akrt2839U/gMXFSe2UoJnsRuIkKAl+0jzH1E0ZogvyG/lEA2cupi8H7q29Cqg9+W hBeA== X-Gm-Message-State: AOAM533Y0wwFIHHg9xoHRg6QBJZjv/gDdrS+yTx4ZamXvhLHXHiY0qRd Qjo9esEHo3a+TpFZHUkWxDcbm2OWBB5XiQ== X-Google-Smtp-Source: ABdhPJxTXxgVtmCDvjsu+UF9iPAHjiAob+1BBg8pK++x+mFwZJSzqMQrBWqk7s5ILPFs5E8RXtjNgQ== X-Received: by 2002:a05:6a00:8cb:b0:510:9ec4:8f85 with SMTP id s11-20020a056a0008cb00b005109ec48f85mr22585467pfu.24.1653289191034; Sun, 22 May 2022 23:59:51 -0700 (PDT) Received: from hsinyi-z840.tpe.corp.google.com ([2401:fa00:1:10:76d5:494d:1690:d003]) by smtp.gmail.com with ESMTPSA id m2-20020a629402000000b005180f4733a8sm3099527pfe.106.2022.05.22.23.59.48 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 22 May 2022 23:59:50 -0700 (PDT) From: Hsin-Yi Wang To: Phillip Lougher , Matthew Wilcox , Xiongwei Song Cc: Zheng Liang , Zhang Yi , Hou Tao , Miao Xie , Andrew Morton , "linux-mm @ kvack . org" , "squashfs-devel @ lists . sourceforge . net" , linux-kernel@vger.kernel.org Subject: [PATCH v3 1/3] Revert "squashfs: provide backing_dev_info in order to disable read-ahead" Date: Mon, 23 May 2022 14:59:09 +0800 Message-Id: <20220523065909.883444-2-hsinyi@chromium.org> X-Mailer: git-send-email 2.36.1.124.g0e6072fb45-goog In-Reply-To: <20220523065909.883444-1-hsinyi@chromium.org> References: <20220523065909.883444-1-hsinyi@chromium.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" This reverts commit 9eec1d897139e5de287af5d559a02b811b844d82. Revert closing the readahead to squashfs since the readahead callback for squashfs is implemented. Suggested-by: Xiongwei Song Signed-off-by: Hsin-Yi Wang --- fs/squashfs/super.c | 33 --------------------------------- 1 file changed, 33 deletions(-) diff --git a/fs/squashfs/super.c b/fs/squashfs/super.c index 6d594ba2ed28..32565dafa7f3 100644 --- a/fs/squashfs/super.c +++ b/fs/squashfs/super.c @@ -29,7 +29,6 @@ #include #include #include -#include =20 #include "squashfs_fs.h" #include "squashfs_fs_sb.h" @@ -113,24 +112,6 @@ static const struct squashfs_decompressor *supported_s= quashfs_filesystem( return decompressor; } =20 -static int squashfs_bdi_init(struct super_block *sb) -{ - int err; - unsigned int major =3D MAJOR(sb->s_dev); - unsigned int minor =3D MINOR(sb->s_dev); - - bdi_put(sb->s_bdi); - sb->s_bdi =3D &noop_backing_dev_info; - - err =3D super_setup_bdi_name(sb, "squashfs_%u_%u", major, minor); - if (err) - return err; - - sb->s_bdi->ra_pages =3D 0; - sb->s_bdi->io_pages =3D 0; - - return 0; -} =20 static int squashfs_fill_super(struct super_block *sb, struct fs_context *= fc) { @@ -146,20 +127,6 @@ static int squashfs_fill_super(struct super_block *sb,= struct fs_context *fc) =20 TRACE("Entered squashfs_fill_superblock\n"); =20 - /* - * squashfs provides 'backing_dev_info' in order to disable read-ahead. F= or - * squashfs, I/O is not deferred, it is done immediately in read_folio, - * which means the user would always have to wait their own I/O. So the e= ffect - * of readahead is very weak for squashfs. squashfs_bdi_init will set - * sb->s_bdi->ra_pages and sb->s_bdi->io_pages to 0 and close readahead f= or - * squashfs. - */ - err =3D squashfs_bdi_init(sb); - if (err) { - errorf(fc, "squashfs init bdi failed"); - return err; - } - sb->s_fs_info =3D kzalloc(sizeof(*msblk), GFP_KERNEL); if (sb->s_fs_info =3D=3D NULL) { ERROR("Failed to allocate squashfs_sb_info\n"); --=20 2.36.1.124.g0e6072fb45-goog From nobody Thu May 7 17:42:16 2026 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 17CF2C4167B for ; Mon, 23 May 2022 07:24:25 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229720AbiEWHYA (ORCPT ); Mon, 23 May 2022 03:24:00 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59854 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229750AbiEWHWT (ORCPT ); Mon, 23 May 2022 03:22:19 -0400 Received: from mail-oi1-x233.google.com (mail-oi1-x233.google.com [IPv6:2607:f8b0:4864:20::233]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DC10110559 for ; Mon, 23 May 2022 00:13:57 -0700 (PDT) Received: by mail-oi1-x233.google.com with SMTP id r68so2602958oie.12 for ; Mon, 23 May 2022 00:13:57 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=l9zzjHGygGfmD2mjiCjABBiOJyHxbV3Xb2gkS3Lpi4w=; b=iQ6M1fZ5Q3+FC+7blG98I3zIIvX/yTF2CLpnO+Hh13i/JAHcQd87xBGJTrWupW27XH Sb1AwdIpu2meybIIwwOeh6fZAOUOQu5fRyD4FaoWpcCzLONtTAcyZs5cXuuRotq2WTUE 3xdrV3vWw3+v0DzRExLgBNJncwKj+Sm+Aj8vY= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=l9zzjHGygGfmD2mjiCjABBiOJyHxbV3Xb2gkS3Lpi4w=; b=KaS/+yFhXYyB5qFG6CbV5tEfpR07GO/PL3mjRcaZuaKZrF80D2PKK3WZSY/nexkGTz ufsuycEty7+QXI+yVhAPodLwGsCJKxn2u0ucyZB199oaGFWxlr5ajq7e4uFURJZdpK+8 luv/hZA9Ranwfs1d+tooVHZ+qcJ41JpKhltfQ48J9gpyAAEhQDFXoRcjl6IuBEir+rbM PFN2QD6tU86fsdW66rSUpUS5b/egdMZfKF+LBQvl5lb/awlARBJZIcEW0PVDfNXUm0Kq HWyNpMSWLcJMA5G14G5E7FAeRgwyACziIhFY0QrQZb4io/EMsu/dJA84mJgadv6vPmaU YdfQ== X-Gm-Message-State: AOAM533l0dkTccWA7FtjaVA3d3Ssqu+PSu9tQQHceXkKydZY7W6YnJBe WSwJh8/g80TzbaTiWv9Ms3Eppq8+qM895Q== X-Google-Smtp-Source: ABdhPJyuPsrnOB4bRdIX3zgGhGWxkP1cXNBva/WVX5JNyJKxhRqlesxK7b7121frjUkQT2vBRVSNVQ== X-Received: by 2002:a17:90a:1b6c:b0:1df:6940:e856 with SMTP id q99-20020a17090a1b6c00b001df6940e856mr25130152pjq.240.1653289201243; Mon, 23 May 2022 00:00:01 -0700 (PDT) Received: from hsinyi-z840.tpe.corp.google.com ([2401:fa00:1:10:76d5:494d:1690:d003]) by smtp.gmail.com with ESMTPSA id m2-20020a629402000000b005180f4733a8sm3099527pfe.106.2022.05.22.23.59.59 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 23 May 2022 00:00:00 -0700 (PDT) From: Hsin-Yi Wang To: Phillip Lougher , Matthew Wilcox , Xiongwei Song Cc: Zheng Liang , Zhang Yi , Hou Tao , Miao Xie , Andrew Morton , "linux-mm @ kvack . org" , "squashfs-devel @ lists . sourceforge . net" , linux-kernel@vger.kernel.org Subject: [PATCH v3 2/3] squashfs: always build "file direct" version of page actor Date: Mon, 23 May 2022 14:59:11 +0800 Message-Id: <20220523065909.883444-3-hsinyi@chromium.org> X-Mailer: git-send-email 2.36.1.124.g0e6072fb45-goog In-Reply-To: <20220523065909.883444-1-hsinyi@chromium.org> References: <20220523065909.883444-1-hsinyi@chromium.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Phillip Lougher Squashfs_readahead uses the "file direct" version of the page actor, and so build it unconditionally. Reported-by: kernel test robot Signed-off-by: Phillip Lougher Signed-off-by: Hsin-Yi Wang --- fs/squashfs/Makefile | 4 ++-- fs/squashfs/page_actor.h | 41 ---------------------------------------- 2 files changed, 2 insertions(+), 43 deletions(-) diff --git a/fs/squashfs/Makefile b/fs/squashfs/Makefile index 7bd9b8b856d0..477c89a519ee 100644 --- a/fs/squashfs/Makefile +++ b/fs/squashfs/Makefile @@ -5,9 +5,9 @@ =20 obj-$(CONFIG_SQUASHFS) +=3D squashfs.o squashfs-y +=3D block.o cache.o dir.o export.o file.o fragment.o id.o inod= e.o -squashfs-y +=3D namei.o super.o symlink.o decompressor.o +squashfs-y +=3D namei.o super.o symlink.o decompressor.o page_actor.o squashfs-$(CONFIG_SQUASHFS_FILE_CACHE) +=3D file_cache.o -squashfs-$(CONFIG_SQUASHFS_FILE_DIRECT) +=3D file_direct.o page_actor.o +squashfs-$(CONFIG_SQUASHFS_FILE_DIRECT) +=3D file_direct.o squashfs-$(CONFIG_SQUASHFS_DECOMP_SINGLE) +=3D decompressor_single.o squashfs-$(CONFIG_SQUASHFS_DECOMP_MULTI) +=3D decompressor_multi.o squashfs-$(CONFIG_SQUASHFS_DECOMP_MULTI_PERCPU) +=3D decompressor_multi_pe= rcpu.o diff --git a/fs/squashfs/page_actor.h b/fs/squashfs/page_actor.h index 2e3073ace009..26e07373af8a 100644 --- a/fs/squashfs/page_actor.h +++ b/fs/squashfs/page_actor.h @@ -6,46 +6,6 @@ * Phillip Lougher */ =20 -#ifndef CONFIG_SQUASHFS_FILE_DIRECT -struct squashfs_page_actor { - void **page; - int pages; - int length; - int next_page; -}; - -static inline struct squashfs_page_actor *squashfs_page_actor_init(void **= page, - int pages, int length) -{ - struct squashfs_page_actor *actor =3D kmalloc(sizeof(*actor), GFP_KERNEL); - - if (actor =3D=3D NULL) - return NULL; - - actor->length =3D length ? : pages * PAGE_SIZE; - actor->page =3D page; - actor->pages =3D pages; - actor->next_page =3D 0; - return actor; -} - -static inline void *squashfs_first_page(struct squashfs_page_actor *actor) -{ - actor->next_page =3D 1; - return actor->page[0]; -} - -static inline void *squashfs_next_page(struct squashfs_page_actor *actor) -{ - return actor->next_page =3D=3D actor->pages ? NULL : - actor->page[actor->next_page++]; -} - -static inline void squashfs_finish_page(struct squashfs_page_actor *actor) -{ - /* empty */ -} -#else struct squashfs_page_actor { union { void **buffer; @@ -76,4 +36,3 @@ static inline void squashfs_finish_page(struct squashfs_p= age_actor *actor) actor->squashfs_finish_page(actor); } #endif -#endif --=20 2.36.1.124.g0e6072fb45-goog From nobody Thu May 7 17:42:16 2026 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id DB3BAC433F5 for ; Mon, 23 May 2022 07:21:18 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229818AbiEWHVO (ORCPT ); Mon, 23 May 2022 03:21:14 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58936 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229982AbiEWHUa (ORCPT ); Mon, 23 May 2022 03:20:30 -0400 Received: from mail-pf1-x436.google.com (mail-pf1-x436.google.com [IPv6:2607:f8b0:4864:20::436]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id BB3BA7355A for ; Mon, 23 May 2022 00:12:24 -0700 (PDT) Received: by mail-pf1-x436.google.com with SMTP id p8so12875023pfh.8 for ; Mon, 23 May 2022 00:12:24 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=n/ak3fxbDlmFRvOmVIgctXK5enM9fzzhqOEs66o/WZM=; b=BJYsjmLTVsLt/DTcxdKUZlCPRaGxYqNgQ3iPjE0uaCVFHbQ5IfcSm2bRKpCOy1sKyB P8SRFu76e4eKYu2KV3zIGjFcZQz/o/iMiGBWw6KU64KmqHFC1s2lZDKrqqSxtW6As6L0 iXUZ6q4c8IEnzqZTeXStFgBDuLzkBwg/vZEYc= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=n/ak3fxbDlmFRvOmVIgctXK5enM9fzzhqOEs66o/WZM=; b=4qRhxMdCGFI3SOnHAWpd7O0lfYefwNganW1yPRMLl229Mqu4lMG575BpiOmra+41Om J7mFlv/mULcLhiR3DZPT7n/hw5JmMB9RpoRmxl2Gj80kuU5U3suyYU3k8fE/QZI1CKiT 6OAxoEzqn8xZK9I1e0URtz8BIGjQ8kFDulabT/YKEk3p3WRYaJiQZheplrf2lWOOiJqI pP1ntYwkLb+ufqrePbmMjI/QOlYBLIY7xciA2TXnITeaZKyejjUtQ7j8aS9euzdwH8lx Eijxfxk65RKeqVxDkmLCn8HhMJHjb3vy2qQgMJDPbNbRVEDsYYa5D2yzJqSnI3I1XqLg cb6w== X-Gm-Message-State: AOAM533k9oUMu16rNCffyd1z7FV3AqvpSDnk504aj5DBX40z4oqn+Hmz VNaJtIe31FEqbtVBUxKq3hM/JYd/nfZnFw== X-Google-Smtp-Source: ABdhPJwEV3eRY3ezvap02NItAMRg3nkr6LiufW/9apHU0swp7gID6uukw67Oyat2knY8vtCPnx9gMw== X-Received: by 2002:a05:6a00:a85:b0:506:b9e:7f43 with SMTP id b5-20020a056a000a8500b005060b9e7f43mr22302851pfl.5.1653289212266; Mon, 23 May 2022 00:00:12 -0700 (PDT) Received: from hsinyi-z840.tpe.corp.google.com ([2401:fa00:1:10:76d5:494d:1690:d003]) by smtp.gmail.com with ESMTPSA id m2-20020a629402000000b005180f4733a8sm3099527pfe.106.2022.05.23.00.00.10 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 23 May 2022 00:00:11 -0700 (PDT) From: Hsin-Yi Wang To: Phillip Lougher , Matthew Wilcox , Xiongwei Song Cc: Zheng Liang , Zhang Yi , Hou Tao , Miao Xie , Andrew Morton , "linux-mm @ kvack . org" , "squashfs-devel @ lists . sourceforge . net" , linux-kernel@vger.kernel.org Subject: [PATCH v3 3/3] squashfs: implement readahead Date: Mon, 23 May 2022 14:59:13 +0800 Message-Id: <20220523065909.883444-4-hsinyi@chromium.org> X-Mailer: git-send-email 2.36.1.124.g0e6072fb45-goog In-Reply-To: <20220523065909.883444-1-hsinyi@chromium.org> References: <20220523065909.883444-1-hsinyi@chromium.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" Implement readahead callback for squashfs. It will read datablocks which cover pages in readahead request. For a few cases it will not mark page as uptodate, including: - file end is 0. - zero filled blocks. - current batch of pages isn't in the same datablock or not enough in a datablock. - decompressor error. Otherwise pages will be marked as uptodate. The unhandled pages will be updated by readpage later. Suggested-by: Matthew Wilcox Signed-off-by: Hsin-Yi Wang Reported-by: Matthew Wilcox Reported-by: Phillip Lougher Reported-by: Xiongwei Song --- v2->v3: Add checks on - decompressed block size. - fill zeros if the last page is not a full page. v2: https://lore.kernel.org/lkml/20220517082650.2005840-4-hsinyi@chromium.o= rg/ v1: https://lore.kernel.org/lkml/20220516105100.1412740-3-hsinyi@chromium.o= rg/ --- fs/squashfs/file.c | 91 +++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 90 insertions(+), 1 deletion(-) diff --git a/fs/squashfs/file.c b/fs/squashfs/file.c index a8e495d8eb86..c311fc685fe4 100644 --- a/fs/squashfs/file.c +++ b/fs/squashfs/file.c @@ -39,6 +39,7 @@ #include "squashfs_fs_sb.h" #include "squashfs_fs_i.h" #include "squashfs.h" +#include "page_actor.h" =20 /* * Locate cache slot in range [offset, index] for specified inode. If @@ -495,7 +496,95 @@ static int squashfs_read_folio(struct file *file, stru= ct folio *folio) return 0; } =20 +static void squashfs_readahead(struct readahead_control *ractl) +{ + struct inode *inode =3D ractl->mapping->host; + struct squashfs_sb_info *msblk =3D inode->i_sb->s_fs_info; + size_t mask =3D (1UL << msblk->block_log) - 1; + size_t shift =3D msblk->block_log - PAGE_SHIFT; + loff_t start =3D readahead_pos(ractl) &~ mask; + size_t len =3D readahead_length(ractl) + readahead_pos(ractl) - start; + struct squashfs_page_actor *actor; + unsigned int nr_pages =3D 0; + struct page **pages; + u64 block =3D 0; + int bsize, res, i, index, bytes, expected; + int file_end =3D i_size_read(inode) >> msblk->block_log; + unsigned int max_pages =3D 1UL << shift; + void *pageaddr; + + readahead_expand(ractl, start, (len | mask) + 1); + + if (file_end =3D=3D 0) + return; + + pages =3D kmalloc_array(max_pages, sizeof(void *), GFP_KERNEL); + if (!pages) + return; + + actor =3D squashfs_page_actor_init_special(pages, max_pages, 0); + if (!actor) + goto out; + + for (;;) { + nr_pages =3D __readahead_batch(ractl, pages, max_pages); + if (!nr_pages) + break; + + if (readahead_pos(ractl) >=3D i_size_read(inode) || + nr_pages < max_pages) + goto skip_pages; + + index =3D pages[0]->index >> shift; + if ((pages[nr_pages - 1]->index >> shift) !=3D index) + goto skip_pages; + + expected =3D index =3D=3D file_end ? + (i_size_read(inode) & (msblk->block_size - 1)) : + msblk->block_size; + + bsize =3D read_blocklist(inode, index, &block); + if (bsize =3D=3D 0) + goto skip_pages; + + res =3D squashfs_read_data(inode->i_sb, block, bsize, NULL, + actor); + + if (res =3D=3D expected) { + /* Last page may have trailing bytes not filled */ + bytes =3D res % PAGE_SIZE; + if (bytes) { + pageaddr =3D kmap_atomic(pages[nr_pages - 1]); + memset(pageaddr + bytes, 0, PAGE_SIZE - bytes); + kunmap_atomic(pageaddr); + } + + for (i =3D 0; i < nr_pages; i++) + SetPageUptodate(pages[i]); + } + + for (i =3D 0; i < nr_pages; i++) { + unlock_page(pages[i]); + put_page(pages[i]); + } + } + + kfree(actor); + kfree(pages); + return; + +skip_pages: + for (i =3D 0; i < nr_pages; i++) { + unlock_page(pages[i]); + put_page(pages[i]); + } + + kfree(actor); +out: + kfree(pages); +} =20 const struct address_space_operations squashfs_aops =3D { - .read_folio =3D squashfs_read_folio + .read_folio =3D squashfs_read_folio, + .readahead =3D squashfs_readahead }; --=20 2.36.1.124.g0e6072fb45-goog