blob: 9236e7d45eb32771064153d4f63178bfb12417c6 [file] [log] [blame]
Phillip Lougher1701aec2009-01-05 08:46:24 +00001/*
2 * Squashfs - a compressed read only filesystem for Linux
3 *
4 * Copyright (c) 2002, 2003, 2004, 2005, 2006, 2007, 2008
Phillip Lougherd7f2ff62011-05-26 10:39:56 +01005 * Phillip Lougher <phillip@squashfs.org.uk>
Phillip Lougher1701aec2009-01-05 08:46:24 +00006 *
7 * This program is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU General Public License
9 * as published by the Free Software Foundation; either version 2,
10 * or (at your option) any later version.
11 *
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
16 *
17 * You should have received a copy of the GNU General Public License
18 * along with this program; if not, write to the Free Software
19 * Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
20 *
21 * file.c
22 */
23
24/*
25 * This file contains code for handling regular files. A regular file
26 * consists of a sequence of contiguous compressed blocks, and/or a
27 * compressed fragment block (tail-end packed block). The compressed size
28 * of each datablock is stored in a block list contained within the
29 * file inode (itself stored in one or more compressed metadata blocks).
30 *
31 * To speed up access to datablocks when reading 'large' files (256 Mbytes or
32 * larger), the code implements an index cache that caches the mapping from
33 * block index to datablock location on disk.
34 *
35 * The index cache allows Squashfs to handle large files (up to 1.75 TiB) while
36 * retaining a simple and space-efficient block list on disk. The cache
37 * is split into slots, caching up to eight 224 GiB files (128 KiB blocks).
38 * Larger files use multiple slots, with 1.75 TiB files using all 8 slots.
39 * The index cache is designed to be memory efficient, and by default uses
40 * 16 KiB.
41 */
42
43#include <linux/fs.h>
44#include <linux/vfs.h>
45#include <linux/kernel.h>
46#include <linux/slab.h>
47#include <linux/string.h>
48#include <linux/pagemap.h>
49#include <linux/mutex.h>
Adrien Schildknechtd840c1d2016-10-14 21:03:54 -070050#include <linux/mm_inline.h>
Phillip Lougher1701aec2009-01-05 08:46:24 +000051
52#include "squashfs_fs.h"
53#include "squashfs_fs_sb.h"
54#include "squashfs_fs_i.h"
55#include "squashfs.h"
56
57/*
58 * Locate cache slot in range [offset, index] for specified inode. If
59 * there's more than one return the slot closest to index.
60 */
61static struct meta_index *locate_meta_index(struct inode *inode, int offset,
62 int index)
63{
64 struct meta_index *meta = NULL;
65 struct squashfs_sb_info *msblk = inode->i_sb->s_fs_info;
66 int i;
67
68 mutex_lock(&msblk->meta_index_mutex);
69
70 TRACE("locate_meta_index: index %d, offset %d\n", index, offset);
71
72 if (msblk->meta_index == NULL)
73 goto not_allocated;
74
75 for (i = 0; i < SQUASHFS_META_SLOTS; i++) {
76 if (msblk->meta_index[i].inode_number == inode->i_ino &&
77 msblk->meta_index[i].offset >= offset &&
78 msblk->meta_index[i].offset <= index &&
79 msblk->meta_index[i].locked == 0) {
80 TRACE("locate_meta_index: entry %d, offset %d\n", i,
81 msblk->meta_index[i].offset);
82 meta = &msblk->meta_index[i];
83 offset = meta->offset;
84 }
85 }
86
87 if (meta)
88 meta->locked = 1;
89
90not_allocated:
91 mutex_unlock(&msblk->meta_index_mutex);
92
93 return meta;
94}
95
96
97/*
98 * Find and initialise an empty cache slot for index offset.
99 */
100static struct meta_index *empty_meta_index(struct inode *inode, int offset,
101 int skip)
102{
103 struct squashfs_sb_info *msblk = inode->i_sb->s_fs_info;
104 struct meta_index *meta = NULL;
105 int i;
106
107 mutex_lock(&msblk->meta_index_mutex);
108
109 TRACE("empty_meta_index: offset %d, skip %d\n", offset, skip);
110
111 if (msblk->meta_index == NULL) {
112 /*
113 * First time cache index has been used, allocate and
114 * initialise. The cache index could be allocated at
115 * mount time but doing it here means it is allocated only
116 * if a 'large' file is read.
117 */
118 msblk->meta_index = kcalloc(SQUASHFS_META_SLOTS,
119 sizeof(*(msblk->meta_index)), GFP_KERNEL);
120 if (msblk->meta_index == NULL) {
121 ERROR("Failed to allocate meta_index\n");
122 goto failed;
123 }
124 for (i = 0; i < SQUASHFS_META_SLOTS; i++) {
125 msblk->meta_index[i].inode_number = 0;
126 msblk->meta_index[i].locked = 0;
127 }
128 msblk->next_meta_index = 0;
129 }
130
131 for (i = SQUASHFS_META_SLOTS; i &&
132 msblk->meta_index[msblk->next_meta_index].locked; i--)
133 msblk->next_meta_index = (msblk->next_meta_index + 1) %
134 SQUASHFS_META_SLOTS;
135
136 if (i == 0) {
137 TRACE("empty_meta_index: failed!\n");
138 goto failed;
139 }
140
141 TRACE("empty_meta_index: returned meta entry %d, %p\n",
142 msblk->next_meta_index,
143 &msblk->meta_index[msblk->next_meta_index]);
144
145 meta = &msblk->meta_index[msblk->next_meta_index];
146 msblk->next_meta_index = (msblk->next_meta_index + 1) %
147 SQUASHFS_META_SLOTS;
148
149 meta->inode_number = inode->i_ino;
150 meta->offset = offset;
151 meta->skip = skip;
152 meta->entries = 0;
153 meta->locked = 1;
154
155failed:
156 mutex_unlock(&msblk->meta_index_mutex);
157 return meta;
158}
159
160
161static void release_meta_index(struct inode *inode, struct meta_index *meta)
162{
163 struct squashfs_sb_info *msblk = inode->i_sb->s_fs_info;
164 mutex_lock(&msblk->meta_index_mutex);
165 meta->locked = 0;
166 mutex_unlock(&msblk->meta_index_mutex);
167}
168
169
170/*
171 * Read the next n blocks from the block list, starting from
172 * metadata block <start_block, offset>.
173 */
174static long long read_indexes(struct super_block *sb, int n,
175 u64 *start_block, int *offset)
176{
177 int err, i;
178 long long block = 0;
Kirill A. Shutemov09cbfea2016-04-01 15:29:47 +0300179 __le32 *blist = kmalloc(PAGE_SIZE, GFP_KERNEL);
Phillip Lougher1701aec2009-01-05 08:46:24 +0000180
181 if (blist == NULL) {
182 ERROR("read_indexes: Failed to allocate block_list\n");
183 return -ENOMEM;
184 }
185
186 while (n) {
Kirill A. Shutemov09cbfea2016-04-01 15:29:47 +0300187 int blocks = min_t(int, n, PAGE_SIZE >> 2);
Phillip Lougher1701aec2009-01-05 08:46:24 +0000188
189 err = squashfs_read_metadata(sb, blist, start_block,
190 offset, blocks << 2);
191 if (err < 0) {
192 ERROR("read_indexes: reading block [%llx:%x]\n",
193 *start_block, *offset);
194 goto failure;
195 }
196
197 for (i = 0; i < blocks; i++) {
Linus Torvalds1aecbe42018-07-29 12:44:46 -0700198 int size = squashfs_block_size(blist[i]);
199 if (size < 0) {
200 err = size;
201 goto failure;
202 }
Phillip Lougher1701aec2009-01-05 08:46:24 +0000203 block += SQUASHFS_COMPRESSED_SIZE_BLOCK(size);
204 }
205 n -= blocks;
206 }
207
208 kfree(blist);
209 return block;
210
211failure:
212 kfree(blist);
213 return err;
214}
215
216
217/*
218 * Each cache index slot has SQUASHFS_META_ENTRIES, each of which
219 * can cache one index -> datablock/blocklist-block mapping. We wish
220 * to distribute these over the length of the file, entry[0] maps index x,
221 * entry[1] maps index x + skip, entry[2] maps index x + 2 * skip, and so on.
222 * The larger the file, the greater the skip factor. The skip factor is
223 * limited to the size of the metadata cache (SQUASHFS_CACHED_BLKS) to ensure
224 * the number of metadata blocks that need to be read fits into the cache.
225 * If the skip factor is limited in this way then the file will use multiple
226 * slots.
227 */
228static inline int calculate_skip(int blocks)
229{
230 int skip = blocks / ((SQUASHFS_META_ENTRIES + 1)
231 * SQUASHFS_META_INDEXES);
232 return min(SQUASHFS_CACHED_BLKS - 1, skip + 1);
233}
234
235
236/*
237 * Search and grow the index cache for the specified inode, returning the
238 * on-disk locations of the datablock and block list metadata block
239 * <index_block, index_offset> for index (scaled to nearest cache index).
240 */
241static int fill_meta_index(struct inode *inode, int index,
242 u64 *index_block, int *index_offset, u64 *data_block)
243{
244 struct squashfs_sb_info *msblk = inode->i_sb->s_fs_info;
245 int skip = calculate_skip(i_size_read(inode) >> msblk->block_log);
246 int offset = 0;
247 struct meta_index *meta;
248 struct meta_entry *meta_entry;
249 u64 cur_index_block = squashfs_i(inode)->block_list_start;
250 int cur_offset = squashfs_i(inode)->offset;
251 u64 cur_data_block = squashfs_i(inode)->start;
252 int err, i;
253
254 /*
255 * Scale index to cache index (cache slot entry)
256 */
257 index /= SQUASHFS_META_INDEXES * skip;
258
259 while (offset < index) {
260 meta = locate_meta_index(inode, offset + 1, index);
261
262 if (meta == NULL) {
263 meta = empty_meta_index(inode, offset + 1, skip);
264 if (meta == NULL)
265 goto all_done;
266 } else {
267 offset = index < meta->offset + meta->entries ? index :
268 meta->offset + meta->entries - 1;
269 meta_entry = &meta->meta_entry[offset - meta->offset];
270 cur_index_block = meta_entry->index_block +
271 msblk->inode_table;
272 cur_offset = meta_entry->offset;
273 cur_data_block = meta_entry->data_block;
274 TRACE("get_meta_index: offset %d, meta->offset %d, "
275 "meta->entries %d\n", offset, meta->offset,
276 meta->entries);
277 TRACE("get_meta_index: index_block 0x%llx, offset 0x%x"
278 " data_block 0x%llx\n", cur_index_block,
279 cur_offset, cur_data_block);
280 }
281
282 /*
283 * If necessary grow cache slot by reading block list. Cache
284 * slot is extended up to index or to the end of the slot, in
285 * which case further slots will be used.
286 */
287 for (i = meta->offset + meta->entries; i <= index &&
288 i < meta->offset + SQUASHFS_META_ENTRIES; i++) {
289 int blocks = skip * SQUASHFS_META_INDEXES;
290 long long res = read_indexes(inode->i_sb, blocks,
291 &cur_index_block, &cur_offset);
292
293 if (res < 0) {
294 if (meta->entries == 0)
295 /*
296 * Don't leave an empty slot on read
297 * error allocated to this inode...
298 */
299 meta->inode_number = 0;
300 err = res;
301 goto failed;
302 }
303
304 cur_data_block += res;
305 meta_entry = &meta->meta_entry[i - meta->offset];
306 meta_entry->index_block = cur_index_block -
307 msblk->inode_table;
308 meta_entry->offset = cur_offset;
309 meta_entry->data_block = cur_data_block;
310 meta->entries++;
311 offset++;
312 }
313
314 TRACE("get_meta_index: meta->offset %d, meta->entries %d\n",
315 meta->offset, meta->entries);
316
317 release_meta_index(inode, meta);
318 }
319
320all_done:
321 *index_block = cur_index_block;
322 *index_offset = cur_offset;
323 *data_block = cur_data_block;
324
325 /*
326 * Scale cache index (cache slot entry) to index
327 */
328 return offset * SQUASHFS_META_INDEXES * skip;
329
330failed:
331 release_meta_index(inode, meta);
332 return err;
333}
334
335
336/*
337 * Get the on-disk location and compressed size of the datablock
338 * specified by index. Fill_meta_index() does most of the work.
339 */
340static int read_blocklist(struct inode *inode, int index, u64 *block)
341{
342 u64 start;
343 long long blks;
344 int offset;
345 __le32 size;
346 int res = fill_meta_index(inode, index, &start, &offset, block);
347
348 TRACE("read_blocklist: res %d, index %d, start 0x%llx, offset"
349 " 0x%x, block 0x%llx\n", res, index, start, offset,
350 *block);
351
352 if (res < 0)
353 return res;
354
355 /*
356 * res contains the index of the mapping returned by fill_meta_index(),
357 * this will likely be less than the desired index (because the
358 * meta_index cache works at a higher granularity). Read any
359 * extra block indexes needed.
360 */
361 if (res < index) {
362 blks = read_indexes(inode->i_sb, index - res, &start, &offset);
363 if (blks < 0)
364 return (int) blks;
365 *block += blks;
366 }
367
368 /*
369 * Read length of block specified by index.
370 */
371 res = squashfs_read_metadata(inode->i_sb, &size, &start, &offset,
372 sizeof(size));
373 if (res < 0)
374 return res;
Linus Torvalds1aecbe42018-07-29 12:44:46 -0700375 return squashfs_block_size(size);
Phillip Lougher1701aec2009-01-05 08:46:24 +0000376}
377
Linus Torvaldsab99a2b2018-08-01 10:38:43 -0700378void squashfs_fill_page(struct page *page, struct squashfs_cache_entry *buffer, int offset, int avail)
379{
380 int copied;
381 void *pageaddr;
382
383 pageaddr = kmap_atomic(page);
384 copied = squashfs_copy_data(pageaddr, buffer, offset, avail);
385 memset(pageaddr + copied, 0, PAGE_SIZE - copied);
386 kunmap_atomic(pageaddr);
387
388 flush_dcache_page(page);
389 if (copied == avail)
390 SetPageUptodate(page);
391 else
392 SetPageError(page);
393}
394
Phillip Lougher5f55dbc2013-10-31 19:24:27 +0000395/* Copy data into page cache */
396void squashfs_copy_cache(struct page *page, struct squashfs_cache_entry *buffer,
397 int bytes, int offset)
Phillip Lougher1701aec2009-01-05 08:46:24 +0000398{
399 struct inode *inode = page->mapping->host;
400 struct squashfs_sb_info *msblk = inode->i_sb->s_fs_info;
Kirill A. Shutemov09cbfea2016-04-01 15:29:47 +0300401 int i, mask = (1 << (msblk->block_log - PAGE_SHIFT)) - 1;
Phillip Lougher5f55dbc2013-10-31 19:24:27 +0000402 int start_index = page->index & ~mask, end_index = start_index | mask;
Phillip Lougher1701aec2009-01-05 08:46:24 +0000403
404 /*
405 * Loop copying datablock into pages. As the datablock likely covers
Kirill A. Shutemovea1754a2016-04-01 15:29:48 +0300406 * many PAGE_SIZE pages (default block size is 128 KiB) explicitly
Phillip Lougher1701aec2009-01-05 08:46:24 +0000407 * grab the pages from the page cache, except for the page that we've
408 * been called to fill.
409 */
410 for (i = start_index; i <= end_index && bytes > 0; i++,
Kirill A. Shutemov09cbfea2016-04-01 15:29:47 +0300411 bytes -= PAGE_SIZE, offset += PAGE_SIZE) {
Phillip Lougher1701aec2009-01-05 08:46:24 +0000412 struct page *push_page;
Kirill A. Shutemov09cbfea2016-04-01 15:29:47 +0300413 int avail = buffer ? min_t(int, bytes, PAGE_SIZE) : 0;
Phillip Lougher1701aec2009-01-05 08:46:24 +0000414
415 TRACE("bytes %d, i %d, available_bytes %d\n", bytes, i, avail);
416
417 push_page = (i == page->index) ? page :
418 grab_cache_page_nowait(page->mapping, i);
419
420 if (!push_page)
421 continue;
422
423 if (PageUptodate(push_page))
424 goto skip_page;
425
Linus Torvaldsab99a2b2018-08-01 10:38:43 -0700426 squashfs_fill_page(push_page, buffer, offset, avail);
Phillip Lougher1701aec2009-01-05 08:46:24 +0000427skip_page:
428 unlock_page(push_page);
429 if (i != page->index)
Kirill A. Shutemov09cbfea2016-04-01 15:29:47 +0300430 put_page(push_page);
Phillip Lougher1701aec2009-01-05 08:46:24 +0000431 }
Phillip Lougher5f55dbc2013-10-31 19:24:27 +0000432}
Phillip Lougher1701aec2009-01-05 08:46:24 +0000433
Phillip Lougher5f55dbc2013-10-31 19:24:27 +0000434/* Read datablock stored packed inside a fragment (tail-end packed block) */
Phillip Lougher6b9882c2018-08-02 16:45:15 +0100435static int squashfs_readpage_fragment(struct page *page, int expected)
Phillip Lougher5f55dbc2013-10-31 19:24:27 +0000436{
437 struct inode *inode = page->mapping->host;
Phillip Lougher5f55dbc2013-10-31 19:24:27 +0000438 struct squashfs_cache_entry *buffer = squashfs_get_fragment(inode->i_sb,
439 squashfs_i(inode)->fragment_block,
440 squashfs_i(inode)->fragment_size);
441 int res = buffer->error;
Phillip Lougher1701aec2009-01-05 08:46:24 +0000442
Phillip Lougher5f55dbc2013-10-31 19:24:27 +0000443 if (res)
444 ERROR("Unable to read page, block %llx, size %x\n",
445 squashfs_i(inode)->fragment_block,
446 squashfs_i(inode)->fragment_size);
447 else
Phillip Lougher6b9882c2018-08-02 16:45:15 +0100448 squashfs_copy_cache(page, buffer, expected,
Phillip Lougher5f55dbc2013-10-31 19:24:27 +0000449 squashfs_i(inode)->fragment_offset);
450
451 squashfs_cache_put(buffer);
452 return res;
453}
454
Adrien Schildknechtd840c1d2016-10-14 21:03:54 -0700455static int squashfs_readpages_fragment(struct page *page,
Sumit Semwaldcae9fa2018-09-05 20:48:15 +0530456 struct list_head *readahead_pages, struct address_space *mapping,
457 int expected)
Adrien Schildknechtd840c1d2016-10-14 21:03:54 -0700458{
459 if (!page) {
460 page = lru_to_page(readahead_pages);
461 list_del(&page->lru);
462 if (add_to_page_cache_lru(page, mapping, page->index,
463 mapping_gfp_constraint(mapping, GFP_KERNEL))) {
464 put_page(page);
465 return 0;
466 }
467 }
Sumit Semwaldcae9fa2018-09-05 20:48:15 +0530468 return squashfs_readpage_fragment(page, expected);
Adrien Schildknechtd840c1d2016-10-14 21:03:54 -0700469}
470
Sumit Semwaldcae9fa2018-09-05 20:48:15 +0530471static int squashfs_readpage_sparse(struct page *page, int expected)
Phillip Lougher5f55dbc2013-10-31 19:24:27 +0000472{
Phillip Lougher6b9882c2018-08-02 16:45:15 +0100473 squashfs_copy_cache(page, NULL, expected, 0);
Phillip Lougher1701aec2009-01-05 08:46:24 +0000474 return 0;
Phillip Lougher5f55dbc2013-10-31 19:24:27 +0000475}
476
Adrien Schildknechtd840c1d2016-10-14 21:03:54 -0700477static int squashfs_readpages_sparse(struct page *page,
Sumit Semwaldcae9fa2018-09-05 20:48:15 +0530478 struct list_head *readahead_pages, struct address_space *mapping,
479 int expected)
Phillip Lougher5f55dbc2013-10-31 19:24:27 +0000480{
Adrien Schildknechtd840c1d2016-10-14 21:03:54 -0700481 if (!page) {
482 page = lru_to_page(readahead_pages);
483 list_del(&page->lru);
484 if (add_to_page_cache_lru(page, mapping, page->index,
485 mapping_gfp_constraint(mapping, GFP_KERNEL))) {
486 put_page(page);
487 return 0;
488 }
489 }
Sumit Semwaldcae9fa2018-09-05 20:48:15 +0530490 return squashfs_readpage_sparse(page, expected);
Adrien Schildknechtd840c1d2016-10-14 21:03:54 -0700491}
492
493static int __squashfs_readpages(struct file *file, struct page *page,
494 struct list_head *readahead_pages, unsigned int nr_pages,
495 struct address_space *mapping)
496{
497 struct inode *inode = mapping->host;
Phillip Lougher5f55dbc2013-10-31 19:24:27 +0000498 struct squashfs_sb_info *msblk = inode->i_sb->s_fs_info;
Phillip Lougher5f55dbc2013-10-31 19:24:27 +0000499 int file_end = i_size_read(inode) >> msblk->block_log;
500 int res;
Adrien Schildknechtd840c1d2016-10-14 21:03:54 -0700501
502 do {
503 struct page *cur_page = page ? page
504 : lru_to_page(readahead_pages);
505 int page_index = cur_page->index;
506 int index = page_index >> (msblk->block_log - PAGE_SHIFT);
Sumit Semwaldcae9fa2018-09-05 20:48:15 +0530507 int expected = index == file_end ?
508 (i_size_read(inode) & (msblk->block_size - 1)) :
509 msblk->block_size;
Adrien Schildknechtd840c1d2016-10-14 21:03:54 -0700510
511 if (page_index >= ((i_size_read(inode) + PAGE_SIZE - 1) >>
512 PAGE_SHIFT))
513 return 1;
514
515 if (index < file_end || squashfs_i(inode)->fragment_block ==
516 SQUASHFS_INVALID_BLK) {
517 u64 block = 0;
518 int bsize = read_blocklist(inode, index, &block);
519
520 if (bsize < 0)
521 return -1;
522
523 if (bsize == 0) {
524 res = squashfs_readpages_sparse(page,
Sumit Semwaldcae9fa2018-09-05 20:48:15 +0530525 readahead_pages, mapping, expected);
Adrien Schildknechtd840c1d2016-10-14 21:03:54 -0700526 } else {
527 res = squashfs_readpages_block(page,
528 readahead_pages, &nr_pages, mapping,
529 page_index, block, bsize);
530 }
531 } else {
532 res = squashfs_readpages_fragment(page,
Sumit Semwaldcae9fa2018-09-05 20:48:15 +0530533 readahead_pages, mapping, expected);
Adrien Schildknechtd840c1d2016-10-14 21:03:54 -0700534 }
535 if (res)
536 return 0;
537 page = NULL;
538 } while (readahead_pages && !list_empty(readahead_pages));
539
540 return 0;
541}
542
543static int squashfs_readpage(struct file *file, struct page *page)
544{
545 int ret;
Phillip Lougher5f55dbc2013-10-31 19:24:27 +0000546
547 TRACE("Entered squashfs_readpage, page index %lx, start block %llx\n",
Adrien Schildknechtd840c1d2016-10-14 21:03:54 -0700548 page->index, squashfs_i(page->mapping->host)->start);
Phillip Lougher5f55dbc2013-10-31 19:24:27 +0000549
Adrien Schildknechtd840c1d2016-10-14 21:03:54 -0700550 get_page(page);
Phillip Lougher5f55dbc2013-10-31 19:24:27 +0000551
Adrien Schildknechtd840c1d2016-10-14 21:03:54 -0700552 ret = __squashfs_readpages(file, page, NULL, 1, page->mapping);
553 if (ret) {
554 flush_dcache_page(page);
555 if (ret < 0)
556 SetPageError(page);
Phillip Lougher5f55dbc2013-10-31 19:24:27 +0000557 else
Adrien Schildknechtd840c1d2016-10-14 21:03:54 -0700558 SetPageUptodate(page);
559 zero_user_segment(page, 0, PAGE_SIZE);
560 unlock_page(page);
561 put_page(page);
562 }
Phillip Lougher5f55dbc2013-10-31 19:24:27 +0000563
Adrien Schildknechtd840c1d2016-10-14 21:03:54 -0700564 return 0;
565}
Phillip Lougher1701aec2009-01-05 08:46:24 +0000566
Adrien Schildknechtd840c1d2016-10-14 21:03:54 -0700567static int squashfs_readpages(struct file *file, struct address_space *mapping,
568 struct list_head *pages, unsigned int nr_pages)
569{
570 TRACE("Entered squashfs_readpages, %u pages, first page index %lx\n",
571 nr_pages, lru_to_page(pages)->index);
572 __squashfs_readpages(file, NULL, pages, nr_pages, mapping);
Phillip Lougher1701aec2009-01-05 08:46:24 +0000573 return 0;
574}
575
576
577const struct address_space_operations squashfs_aops = {
Adrien Schildknechtd840c1d2016-10-14 21:03:54 -0700578 .readpage = squashfs_readpage,
579 .readpages = squashfs_readpages,
Phillip Lougher1701aec2009-01-05 08:46:24 +0000580};