[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <YpaBBXEEtv4ZjFMA@casper.infradead.org>
Date: Tue, 31 May 2022 21:56:37 +0100
From: Matthew Wilcox <willy@...radead.org>
To: Andrew Morton <akpm@...ux-foundation.org>
Cc: Hsin-Yi Wang <hsinyi@...omium.org>,
Phillip Lougher <phillip@...ashfs.org.uk>,
Xiongwei Song <Xiongwei.Song@...driver.com>,
Zheng Liang <zhengliang6@...wei.com>,
Zhang Yi <yi.zhang@...wei.com>, Hou Tao <houtao1@...wei.com>,
Miao Xie <miaoxie@...wei.com>,
"linux-mm @ kvack . org" <linux-mm@...ck.org>,
"squashfs-devel @ lists . sourceforge . net"
<squashfs-devel@...ts.sourceforge.net>,
linux-kernel@...r.kernel.org
Subject: Re: [PATCH v3 3/3] squashfs: implement readahead
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.
Powered by blists - more mailing lists