forked from torvalds/linux
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Squashfs: Restructure squashfs_readpage()
Restructure squashfs_readpage() splitting it into separate functions for datablocks, fragments and sparse blocks. Move the memcpying (from squashfs cache entry) implementation of squashfs_readpage_block into file_cache.c This allows different implementations to be supported. Signed-off-by: Phillip Lougher <[email protected]> Reviewed-by: Minchan Kim <[email protected]>
- Loading branch information
Showing
4 changed files
with
118 additions
and
71 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
/* | ||
* Copyright (c) 2013 | ||
* Phillip Lougher <[email protected]> | ||
* | ||
* This work is licensed under the terms of the GNU GPL, version 2. See | ||
* the COPYING file in the top-level directory. | ||
*/ | ||
|
||
#include <linux/fs.h> | ||
#include <linux/vfs.h> | ||
#include <linux/kernel.h> | ||
#include <linux/slab.h> | ||
#include <linux/string.h> | ||
#include <linux/pagemap.h> | ||
#include <linux/mutex.h> | ||
|
||
#include "squashfs_fs.h" | ||
#include "squashfs_fs_sb.h" | ||
#include "squashfs_fs_i.h" | ||
#include "squashfs.h" | ||
|
||
/* Read separately compressed datablock and memcopy into page cache */ | ||
int squashfs_readpage_block(struct page *page, u64 block, int bsize) | ||
{ | ||
struct inode *i = page->mapping->host; | ||
struct squashfs_cache_entry *buffer = squashfs_get_datablock(i->i_sb, | ||
block, bsize); | ||
int res = buffer->error; | ||
|
||
if (res) | ||
ERROR("Unable to read page, block %llx, size %x\n", block, | ||
bsize); | ||
else | ||
squashfs_copy_cache(page, buffer, buffer->length, 0); | ||
|
||
squashfs_cache_put(buffer); | ||
return res; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters