aboutsummaryrefslogtreecommitdiff
path: root/kernel/fs/squashfs/super.c
diff options
context:
space:
mode:
authorplougher <plougher>2009-01-31 07:29:10 +0000
committerMohamad Ayyash <mkayyash@google.com>2015-02-23 12:34:11 -0800
commit93911cbac69fbc999c52939d8d8b10698cb14051 (patch)
tree3d71bec78c09956871130377627ccdde12c0d3c3 /kernel/fs/squashfs/super.c
parenta96ba00226795862b5e1cb7d8242d4576c374ada (diff)
downloadsquashfs-tools-93911cbac69fbc999c52939d8d8b10698cb14051.tar.gz
Use the squashfs cache to read datablocks, rather than directly call
squashfs_read_data(). This improves performance in race conditions where squashfs_readpage is called simultaneously to read pages in the same datablock. Also when vmalloc is replaced with multiple PAGE_CACHE_SIZEd pages, it centralises necessary support to the squashfs cache code. Signed-off-by: Phillip Lougher <phillip@lougher.demon.co.uk>
Diffstat (limited to 'kernel/fs/squashfs/super.c')
-rw-r--r--kernel/fs/squashfs/super.c9
1 files changed, 4 insertions, 5 deletions
diff --git a/kernel/fs/squashfs/super.c b/kernel/fs/squashfs/super.c
index 65a5fbd..44f94aa 100644
--- a/kernel/fs/squashfs/super.c
+++ b/kernel/fs/squashfs/super.c
@@ -102,7 +102,6 @@ static int squashfs_fill_super(struct super_block *sb, void *data, int silent)
msblk->devblksize_log2 = ffz(~msblk->devblksize);
mutex_init(&msblk->read_data_mutex);
- mutex_init(&msblk->read_page_mutex);
mutex_init(&msblk->meta_index_mutex);
/*
@@ -201,7 +200,7 @@ static int squashfs_fill_super(struct super_block *sb, void *data, int silent)
goto failed_mount;
/* Allocate read_page block */
- msblk->read_page = vmalloc(msblk->block_size);
+ msblk->read_page = squashfs_cache_init("datablock", 1, msblk->block_size, 1);
if (msblk->read_page == NULL) {
ERROR("Failed to allocate read_page block\n");
goto failed_mount;
@@ -281,10 +280,10 @@ allocate_root:
failed_mount:
squashfs_cache_delete(msblk->block_cache);
squashfs_cache_delete(msblk->fragment_cache);
+ squashfs_cache_delete(msblk->read_page);
kfree(msblk->inode_lookup_table);
kfree(msblk->fragment_index);
kfree(msblk->id_table);
- vfree(msblk->read_page);
vfree(msblk->stream.workspace);
kfree(sb->s_fs_info);
sb->s_fs_info = NULL;
@@ -330,7 +329,7 @@ static void squashfs_put_super(struct super_block *sb)
struct squashfs_sb_info *sbi = sb->s_fs_info;
squashfs_cache_delete(sbi->block_cache);
squashfs_cache_delete(sbi->fragment_cache);
- vfree(sbi->read_page);
+ squashfs_cache_delete(sbi->read_page);
kfree(sbi->id_table);
kfree(sbi->fragment_index);
kfree(sbi->meta_index);
@@ -390,7 +389,7 @@ static int __init init_squashfs_fs(void)
return err;
}
- printk(KERN_INFO "squashfs: version 4.0 (2008/10/28) "
+ printk(KERN_INFO "squashfs: version 4.0 (2008/11/14) "
"Phillip Lougher\n");
return 0;