From nobody Fri May 8 00:10:54 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 A0697C433EF for ; Mon, 16 May 2022 10:52:09 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S242827AbiEPKwH (ORCPT ); Mon, 16 May 2022 06:52:07 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38050 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S242997AbiEPKv2 (ORCPT ); Mon, 16 May 2022 06:51:28 -0400 Received: from mail-pg1-x536.google.com (mail-pg1-x536.google.com [IPv6:2607:f8b0:4864:20::536]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 82C1F5FA3 for ; Mon, 16 May 2022 03:51:27 -0700 (PDT) Received: by mail-pg1-x536.google.com with SMTP id v10so13703736pgl.11 for ; Mon, 16 May 2022 03:51:27 -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=5RbQ3j9RMbZ/D6MAR7ISAUvOQDvpOlhf1s/Zk6REvQs=; b=TZqROHTy4bHF74S5KUPgYAYiymslKKVBA7bRL3/HGi4JHQB8muBNwXApRa0cU+VWhS iDhqHMiS97n7lTt4aPXGafW1hSdMlSn0/MjzhUr5uDezSoKTsE2/fU3tuMWFAIQsDW57 VoEjrIWGFnek4FgPEBYZGiUVXkUJq4gERo+VQ= 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=5RbQ3j9RMbZ/D6MAR7ISAUvOQDvpOlhf1s/Zk6REvQs=; b=NY4D0S4P52g443q+yPJsifZfA7M3e/SORbkfxDTRpSZiDctDag4nmvlBf65KZKb2v5 wfCjw5CMYeH59CRpXamgEa4ybn+OvRstoQPkODG1PMNx77/E8fZUWtWOzSQnqhldOFb5 K4Agh1QeFTU13JQz1mlcCTDCaZMqgbpfMXVVgc8YkRr84ICWIZGkvGqyPbsOCFBYQaJb csEGBw2ay/XIFRPijO2b+NV+BY4IO4nHEA6XkpUKImLhcphi2Ywxp3hRiq6ntG0RQ+xV 5Su7USuQAloUpfUs75bdjpsIqmet+cDYuXaLeVzhPIohFaXM1h07AM3yrL4qFajH2WG6 p+0w== X-Gm-Message-State: AOAM530J2B7g9KPDA1sxztjcgzvDy0I+G85w6W/D5SsUjFy0V/UqXm4q 5w/PYgNcZsDNYSJbTEZuef7oetO7b5KfGw== X-Google-Smtp-Source: ABdhPJyQ5XmFT7yQ/quMHs3G1SNLRmrs0Q+kvbBJA9PMECYOuXFf5iA+2PsREWr5Wz+K7aTd/M7V3Q== X-Received: by 2002:a63:5522:0:b0:3c5:e4be:5a49 with SMTP id j34-20020a635522000000b003c5e4be5a49mr14595263pgb.26.1652698286995; Mon, 16 May 2022 03:51:26 -0700 (PDT) Received: from hsinyi-z840.tpe.corp.google.com ([2401:fa00:1:10:cdcb:c865:6f65:d875]) by smtp.gmail.com with ESMTPSA id o14-20020a655bce000000b003db8dd388afsm6332778pgr.10.2022.05.16.03.51.24 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 16 May 2022 03:51:26 -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 1/2] Revert "squashfs: provide backing_dev_info in order to disable read-ahead" Date: Mon, 16 May 2022 18:51:01 +0800 Message-Id: <20220516105100.1412740-2-hsinyi@chromium.org> X-Mailer: git-send-email 2.36.0.550.gb090851708-goog In-Reply-To: <20220516105100.1412740-1-hsinyi@chromium.org> References: <20220516105100.1412740-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.0.550.gb090851708-goog From nobody Fri May 8 00:10:54 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 E3C0DC433EF for ; Mon, 16 May 2022 10:52:19 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229651AbiEPKwR (ORCPT ); Mon, 16 May 2022 06:52:17 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38410 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S243023AbiEPKvl (ORCPT ); Mon, 16 May 2022 06:51:41 -0400 Received: from mail-pg1-x534.google.com (mail-pg1-x534.google.com [IPv6:2607:f8b0:4864:20::534]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DB9225FA3 for ; Mon, 16 May 2022 03:51:40 -0700 (PDT) Received: by mail-pg1-x534.google.com with SMTP id g184so13744687pgc.1 for ; Mon, 16 May 2022 03:51:40 -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=JMk8CHB5bcq3ReSzg2cgECR0dlKU/tAyeAvoi2QnfNE=; b=OKNynNPjFwGSD1DaPCEF49HEOaVfWkiddIt3TLXpzovZPm0w32mw1+sI5jGIZ53iqU DL9zHg/3+jPPwXL2vHoPtL1DSdVsyH7bZNV/hZuu9cmfO6L1xO1Gfss1yn77yPBo7s1z +wJTDMciFy2TsqHd/skAMTirRIHnkR7xPShJU= 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=JMk8CHB5bcq3ReSzg2cgECR0dlKU/tAyeAvoi2QnfNE=; b=s2jc0+6SdbVTQd3AMorUAjyOUl/OR6TwQ/K7VAdQYACRTZj5MIrM9tCXVd/IUwsDGe uncmftGCqdvEnRF2xjkGiZ6fc3qBA/MZFuxoi/KvgBV3mJU8DcaRG9Su14LAf/ZqQBS2 USXt7mmQVZJ0PHCFpFJDE2UYylnP26ajuz/2Emc4T0mAYtKKi3vvmq6g1tKQnyYi0TFB jOngHWknN+dpxwLh4BrFYqZiToqOnnw+MYT3rBc0Z9PPyGfeOx8t5wKhFdvQoPpyRBUr jHHORqsEX5/8eR4fOzv3ft70e9mK3eR6ruqdB9RohvBZ0cUVTmip11qWTpHbi4v82ALu YPsA== X-Gm-Message-State: AOAM530h8i/7yFJEr3Qs+LgWF03JYRizu/9b3KWPg2aQCXgsndaXjXRw Kb5hIEoGHYbHKwAgHiD85JJEng== X-Google-Smtp-Source: ABdhPJxLUCazJwseAQ0wLAS5elWc0Q0J8Q3r6TfTavcCh6mUPnQw7yZb7qUH+IJgOAbR/PLOnZFxKw== X-Received: by 2002:a05:6a00:10cc:b0:506:e0:d6c3 with SMTP id d12-20020a056a0010cc00b0050600e0d6c3mr17147886pfu.33.1652698300335; Mon, 16 May 2022 03:51:40 -0700 (PDT) Received: from hsinyi-z840.tpe.corp.google.com ([2401:fa00:1:10:cdcb:c865:6f65:d875]) by smtp.gmail.com with ESMTPSA id o14-20020a655bce000000b003db8dd388afsm6332778pgr.10.2022.05.16.03.51.38 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 16 May 2022 03:51:40 -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 2/2] squashfs: implement readahead Date: Mon, 16 May 2022 18:51:03 +0800 Message-Id: <20220516105100.1412740-3-hsinyi@chromium.org> X-Mailer: git-send-email 2.36.0.550.gb090851708-goog In-Reply-To: <20220516105100.1412740-1-hsinyi@chromium.org> References: <20220516105100.1412740-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. Otherwise pages will be marked as uptodate. The unhandled pages will be updated by readpage later. Signed-off-by: Hsin-Yi Wang Reported-by: kernel test robot Suggested-by: Matthew Wilcox --- Note that this patch was not formally sent to the list before. It's attached to email thread for discussion as it's still under development. - v1: The patch outline was suggested by Matthew. It went through a few reviews by Matthew offline. - v2: https://lore.kernel.org/linux-mm/Yn5Yij9pRPCzDozt@casper.infradead.org/t/#m= 442435c149d411c5c9d8019cff5915419b04bf10 This is a resend of v1. - v3: https://lore.kernel.org/linux-mm/Yn5Yij9pRPCzDozt@casper.infradead.org/t/#m= 55a709e6ba5ec59fe95323a67a7f3d6b1953e470 Fix page actor size to avoid a crash from squashfs_decompress(). Suggested by Phillip Lougher[1] [1] https://lore.kernel.org/linux-mm/Yn5Yij9pRPCzDozt@casper.infradead.org/= t/#m687f82debb7667ff31982a05aef3eba081eb5039 - v4: https://lore.kernel.org/linux-mm/Yn5Yij9pRPCzDozt@casper.infradead.org/t/#m= f93267690ec2e841dade6a494fe72c84b61328d9 Fix to free page after used. Suggested by Xiongwei Song[2] Refactor the skip page logic to possible improve the performance. Suggested by Phillip Lougher[3] [2] https://lore.kernel.org/linux-mm/Yn5Yij9pRPCzDozt@casper.infradead.org/= t/#m0e7b33d167b1ef0eb39b9f41c32ed3f80dfced18 [3] https://lore.kernel.org/linux-mm/Yn5Yij9pRPCzDozt@casper.infradead.org/= t/#m1e0a8f8e4a98d79d14c81b66e197b6dc0a3b77a1 --- fs/squashfs/file.c | 77 ++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 77 insertions(+) diff --git a/fs/squashfs/file.c b/fs/squashfs/file.c index a8e495d8eb86..91dfec792f4c 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,83 @@ 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 req_end =3D readahead_pos(ractl) + readahead_length(ractl); + 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; + int file_end =3D i_size_read(inode) >> msblk->block_log; + unsigned int max_pages =3D 1UL << shift; + + readahead_expand(ractl, start, (len | mask) + 1); + + if (readahead_pos(ractl) + readahead_length(ractl) < req_end || + 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; + + 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 0) + 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 + .readahead =3D squashfs_readahead }; --=20 2.36.0.550.gb090851708-goog From nobody Fri May 8 00:10:54 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 E568FC433F5 for ; Tue, 17 May 2022 03:39:36 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235607AbiEQDjf (ORCPT ); Mon, 16 May 2022 23:39:35 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36072 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230019AbiEQDjb (ORCPT ); Mon, 16 May 2022 23:39:31 -0400 X-Greylist: delayed 165 seconds by postgrey-1.37 at lindbergh.monkeyblade.net; Mon, 16 May 2022 20:39:28 PDT Received: from p3plwbeout12-01.prod.phx3.secureserver.net (p3plsmtp12-01-2.prod.phx3.secureserver.net [173.201.192.54]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6DC1B46667 for ; Mon, 16 May 2022 20:39:28 -0700 (PDT) Received: from mailex.mailcore.me ([94.136.40.141]) by :WBEOUT: with ESMTP id qo0onJ0i9sfAiqo0pnEve5; Mon, 16 May 2022 20:36:43 -0700 X-CMAE-Analysis: v=2.4 cv=ZYnYiuZA c=1 sm=1 tr=0 ts=6283184b a=bheWAUFm1xGnSTQFbH9Kqg==:117 a=84ok6UeoqCVsigPHarzEiQ==:17 a=ggZhUymU-5wA:10 a=oZkIemNP1mAA:10 a=QyXUC8HyAAAA:8 a=FXvPX3liAAAA:8 a=XPsDEoqG7ybQwvttNyoA:9 a=UObqyxdv-6Yh2QiB9mM_:22 X-SECURESERVER-ACCT: phillip@squashfs.org.uk X-SID: qo0onJ0i9sfAi Received: from 82-69-79-175.dsl.in-addr.zen.co.uk ([82.69.79.175] helo=localhost.localdomain) by smtp12.mailcore.me with esmtpa (Exim 4.94.2) (envelope-from ) id 1nqo0n-0004Sd-I9; Tue, 17 May 2022 04:36:41 +0100 From: Phillip Lougher To: hsinyi@chromium.org Cc: Xiongwei.Song@windriver.com, akpm@linux-foundation.org, houtao1@huawei.com, linux-kernel@vger.kernel.org, linux-mm@kvack.org, miaoxie@huawei.com, phillip@squashfs.org.uk, squashfs-devel@lists.sourceforge.net, willy@infradead.org, yi.zhang@huawei.com, zhengliang6@huawei.com, kernel test robot Subject: [PATCH 3/2] squashfs: always build "file direct" version of page actor Date: Tue, 17 May 2022 04:35:57 +0100 Message-Id: <20220517033557.3492-1-phillip@squashfs.org.uk> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220516105100.1412740-1-hsinyi@chromium.org> References: <20220516105100.1412740-1-hsinyi@chromium.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Mailcore-Auth: 439999529 X-Mailcore-Domain: 1394945 X-123-reg-Authenticated: phillip@squashfs.org.uk X-Originating-IP: 82.69.79.175 X-CMAE-Envelope: MS4xfLXFLpLlRfbfGXBeIXJRjWEIJMQTP/XFm/vMyPYOSe6SM0A23GT2mpoUz9+Zc8x4Soo2M0DUY2qw+DY5ySWQ8RAel8+bf53qo1n7d/9tJ6W91LlDDvtT Y8UxEsGHooRoeWuPtwlLz6hOpWq1+YSlAelThS/vS96T+KK8QGXT+t/ftHyKa32yaKlEY3Itg0zRamQ6MMvp7X3JM6O8MjXqb6I= Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" 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 Tested-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.34.1