Lines Matching refs:msblk
91 struct squashfs_sb_info *msblk = &s->u.squashfs_sb; in get_block_length() local
98 if (msblk->devblksize - *offset == 1) { in get_block_length()
99 if (msblk->swap) in get_block_length()
108 if (msblk->swap) in get_block_length()
117 if (msblk->swap) { in get_block_length()
132 if (SQUASHFS_CHECK_DATA(msblk->sblk.flags)) { in get_block_length()
133 if (*offset == msblk->devblksize) { in get_block_length()
159 struct squashfs_sb_info *msblk = &s->u.squashfs_sb; in squashfs_read_data() local
161 msblk->devblksize_log2) + 2]; in squashfs_read_data()
162 unsigned int offset = index & ((1 << msblk->devblksize_log2) - 1); in squashfs_read_data()
163 unsigned int cur_index = index >> msblk->devblksize_log2; in squashfs_read_data()
170 bytes = msblk->devblksize - offset; in squashfs_read_data()
172 c_buffer = compressed ? msblk->read_data : buffer; in squashfs_read_data()
184 bytes += msblk->devblksize; in squashfs_read_data()
192 bytes = msblk->devblksize - offset; in squashfs_read_data()
194 c_buffer = compressed ? msblk->read_data : buffer; in squashfs_read_data()
203 bytes += msblk->devblksize; in squashfs_read_data()
209 down(&msblk->read_data_mutex); in squashfs_read_data()
212 avail_bytes = (c_byte - bytes) > (msblk->devblksize - offset) ? in squashfs_read_data()
213 msblk->devblksize - offset : in squashfs_read_data()
230 msblk->stream.next_in = c_buffer; in squashfs_read_data()
231 msblk->stream.avail_in = c_byte; in squashfs_read_data()
232 msblk->stream.next_out = buffer; in squashfs_read_data()
233 msblk->stream.avail_out = msblk->read_size; in squashfs_read_data()
235 if (((zlib_err = zlib_inflateInit(&msblk->stream)) != Z_OK) || in squashfs_read_data()
236 ((zlib_err = zlib_inflate(&msblk->stream, Z_FINISH)) in squashfs_read_data()
238 zlib_inflateEnd(&msblk->stream)) != Z_OK)) { in squashfs_read_data()
243 bytes = msblk->stream.total_out; in squashfs_read_data()
245 up(&msblk->read_data_mutex); in squashfs_read_data()
250 (SQUASHFS_CHECK_DATA(msblk->sblk.flags) in squashfs_read_data()
269 struct squashfs_sb_info *msblk = &s->u.squashfs_sb; in squashfs_get_cached_block() local
277 if (msblk->block_cache[i].block == block) in squashfs_get_cached_block()
280 down(&msblk->block_cache_mutex); in squashfs_get_cached_block()
284 for (i = msblk->next_cache, n = SQUASHFS_CACHED_BLKS; in squashfs_get_cached_block()
287 if (msblk->block_cache[i].block != in squashfs_get_cached_block()
295 add_wait_queue(&msblk->waitq, &wait); in squashfs_get_cached_block()
297 up(&msblk->block_cache_mutex); in squashfs_get_cached_block()
300 remove_wait_queue(&msblk->waitq, &wait); in squashfs_get_cached_block()
303 msblk->next_cache = (i + 1) % SQUASHFS_CACHED_BLKS; in squashfs_get_cached_block()
305 if (msblk->block_cache[i].block == in squashfs_get_cached_block()
307 if (!(msblk->block_cache[i].data = in squashfs_get_cached_block()
312 up(&msblk->block_cache_mutex); in squashfs_get_cached_block()
317 msblk->block_cache[i].block = SQUASHFS_USED_BLK; in squashfs_get_cached_block()
318 up(&msblk->block_cache_mutex); in squashfs_get_cached_block()
320 if (!(msblk->block_cache[i].length = in squashfs_get_cached_block()
322 msblk->block_cache[i].data, in squashfs_get_cached_block()
329 down(&msblk->block_cache_mutex); in squashfs_get_cached_block()
330 wake_up(&msblk->waitq); in squashfs_get_cached_block()
331 msblk->block_cache[i].block = block; in squashfs_get_cached_block()
332 msblk->block_cache[i].next_index = next_index; in squashfs_get_cached_block()
336 if (msblk->block_cache[i].block != block) { in squashfs_get_cached_block()
337 up(&msblk->block_cache_mutex); in squashfs_get_cached_block()
341 if ((bytes = msblk->block_cache[i].length - offset) >= length) { in squashfs_get_cached_block()
343 memcpy(buffer, msblk->block_cache[i].data + in squashfs_get_cached_block()
345 if (msblk->block_cache[i].length - offset == length) { in squashfs_get_cached_block()
346 *next_block = msblk->block_cache[i].next_index; in squashfs_get_cached_block()
352 up(&msblk->block_cache_mutex); in squashfs_get_cached_block()
356 memcpy(buffer, msblk->block_cache[i].data + in squashfs_get_cached_block()
360 block = msblk->block_cache[i].next_index; in squashfs_get_cached_block()
361 up(&msblk->block_cache_mutex); in squashfs_get_cached_block()
378 struct squashfs_sb_info *msblk = &s->u.squashfs_sb; in get_fragment_location() local
380 msblk->fragment_index[SQUASHFS_FRAGMENT_INDEX(fragment)]; in get_fragment_location()
384 if (msblk->swap) { in get_fragment_location()
410 SQSH_EXTERN void release_cached_fragment(struct squashfs_sb_info *msblk, struct in release_cached_fragment() argument
413 down(&msblk->fragment_mutex); in release_cached_fragment()
415 wake_up(&msblk->fragment_wait_queue); in release_cached_fragment()
416 up(&msblk->fragment_mutex); in release_cached_fragment()
425 struct squashfs_sb_info *msblk = &s->u.squashfs_sb; in get_cached_fragment() local
428 down(&msblk->fragment_mutex); in get_cached_fragment()
431 msblk->fragment[i].block != start_block; i++); in get_cached_fragment()
434 for (i = msblk->next_fragment, n = in get_cached_fragment()
436 msblk->fragment[i].locked; n--, i = (i + 1) % in get_cached_fragment()
443 add_wait_queue(&msblk->fragment_wait_queue, in get_cached_fragment()
446 up(&msblk->fragment_mutex); in get_cached_fragment()
449 remove_wait_queue(&msblk->fragment_wait_queue, in get_cached_fragment()
453 msblk->next_fragment = (msblk->next_fragment + 1) % in get_cached_fragment()
456 if (msblk->fragment[i].data == NULL) in get_cached_fragment()
457 if (!(msblk->fragment[i].data = SQUASHFS_ALLOC in get_cached_fragment()
461 up(&msblk->fragment_mutex); in get_cached_fragment()
465 msblk->fragment[i].block = SQUASHFS_INVALID_BLK; in get_cached_fragment()
466 msblk->fragment[i].locked = 1; in get_cached_fragment()
467 up(&msblk->fragment_mutex); in get_cached_fragment()
469 if (!(msblk->fragment[i].length = squashfs_read_data(s, in get_cached_fragment()
470 msblk->fragment[i].data, in get_cached_fragment()
474 msblk->fragment[i].locked = 0; in get_cached_fragment()
478 msblk->fragment[i].block = start_block; in get_cached_fragment()
480 i, msblk->fragment[i].block, in get_cached_fragment()
481 msblk->fragment[i].locked); in get_cached_fragment()
485 msblk->fragment[i].locked++; in get_cached_fragment()
486 up(&msblk->fragment_mutex); in get_cached_fragment()
488 msblk->fragment[i].block, in get_cached_fragment()
489 msblk->fragment[i].locked); in get_cached_fragment()
493 return &msblk->fragment[i]; in get_cached_fragment()
503 struct squashfs_sb_info *msblk = &s->u.squashfs_sb; in squashfs_new_inode() local
511 i->i_uid = msblk->uid[inodeb->uid]; in squashfs_new_inode()
517 i->i_gid = msblk->guid[inodeb->guid]; in squashfs_new_inode()
527 struct squashfs_sb_info *msblk = &s->u.squashfs_sb; in squashfs_iget() local
528 struct squashfs_super_block *sblk = &msblk->sblk; in squashfs_iget()
540 if (msblk->swap) { in squashfs_iget()
560 if (msblk->swap) { in squashfs_iget()
613 if (msblk->swap) { in squashfs_iget()
664 if (msblk->swap) { in squashfs_iget()
701 if (msblk->swap) { in squashfs_iget()
745 if (msblk->swap) { in squashfs_iget()
782 if (msblk->swap) { in squashfs_iget()
815 if (msblk->swap) { in squashfs_iget()
857 struct squashfs_sb_info *msblk = &s->u.squashfs_sb; in read_fragment_index_table() local
858 struct squashfs_super_block *sblk = &msblk->sblk; in read_fragment_index_table()
860 if (!(msblk->fragment_index = kmalloc(SQUASHFS_FRAGMENT_INDEX_BYTES in read_fragment_index_table()
868 msblk->fragment_index, in read_fragment_index_table()
877 if (msblk->swap) { in read_fragment_index_table()
884 &msblk->fragment_index[i], 1); in read_fragment_index_table()
885 msblk->fragment_index[i] = fragment; in read_fragment_index_table()
893 static int supported_squashfs_filesystem(struct squashfs_sb_info *msblk, int silent) in supported_squashfs_filesystem() argument
895 struct squashfs_super_block *sblk = &msblk->sblk; in supported_squashfs_filesystem()
897 msblk->iget = squashfs_iget; in supported_squashfs_filesystem()
898 msblk->read_blocklist = read_blocklist; in supported_squashfs_filesystem()
899 msblk->read_fragment_index_table = read_fragment_index_table; in supported_squashfs_filesystem()
902 if (!squashfs_1_0_supported(msblk)) { in supported_squashfs_filesystem()
910 if (!squashfs_2_0_supported(msblk)) { in supported_squashfs_filesystem()
933 struct squashfs_sb_info *msblk = &s->u.squashfs_sb; in squashfs_read_super() local
934 struct squashfs_super_block *sblk = &msblk->sblk; in squashfs_read_super()
938 if (!(msblk->stream.workspace = vmalloc(zlib_inflate_workspacesize()))) { in squashfs_read_super()
943 msblk->devblksize = get_hardsect_size(dev); in squashfs_read_super()
944 if(msblk->devblksize < BLOCK_SIZE) in squashfs_read_super()
945 msblk->devblksize = BLOCK_SIZE; in squashfs_read_super()
946 msblk->devblksize_log2 = ffz(~msblk->devblksize); in squashfs_read_super()
947 set_blocksize(dev, msblk->devblksize); in squashfs_read_super()
948 s->s_blocksize = msblk->devblksize; in squashfs_read_super()
949 s->s_blocksize_bits = msblk->devblksize_log2; in squashfs_read_super()
951 init_MUTEX(&msblk->read_data_mutex); in squashfs_read_super()
952 init_MUTEX(&msblk->read_page_mutex); in squashfs_read_super()
953 init_MUTEX(&msblk->block_cache_mutex); in squashfs_read_super()
954 init_MUTEX(&msblk->fragment_mutex); in squashfs_read_super()
956 init_waitqueue_head(&msblk->waitq); in squashfs_read_super()
957 init_waitqueue_head(&msblk->fragment_wait_queue); in squashfs_read_super()
967 msblk->swap = 0; in squashfs_read_super()
977 msblk->swap = 1; in squashfs_read_super()
986 if(!supported_squashfs_filesystem(msblk, silent)) in squashfs_read_super()
1017 if (!(msblk->block_cache = kmalloc(sizeof(struct squashfs_cache) * in squashfs_read_super()
1024 msblk->block_cache[i].block = SQUASHFS_INVALID_BLK; in squashfs_read_super()
1026 msblk->next_cache = 0; in squashfs_read_super()
1029 msblk->read_size = (sblk->block_size < SQUASHFS_METADATA_SIZE) ? in squashfs_read_super()
1033 if (!(msblk->read_data = kmalloc(msblk->read_size, GFP_KERNEL))) { in squashfs_read_super()
1039 if (!(msblk->read_page = kmalloc(sblk->block_size, GFP_KERNEL))) { in squashfs_read_super()
1045 if (!(msblk->uid = kmalloc((sblk->no_uids + sblk->no_guids) * in squashfs_read_super()
1050 msblk->guid = msblk->uid + sblk->no_uids; in squashfs_read_super()
1052 if (msblk->swap) { in squashfs_read_super()
1063 SQUASHFS_SWAP_DATA(msblk->uid, suid, (sblk->no_uids + in squashfs_read_super()
1066 if (!squashfs_read_data(s, (char *) msblk->uid, sblk->uid_start, in squashfs_read_super()
1075 if (sblk->s_major == 1 && squashfs_1_0_supported(msblk)) in squashfs_read_super()
1078 if (!(msblk->fragment = kmalloc(sizeof(struct squashfs_fragment_cache) * in squashfs_read_super()
1085 msblk->fragment[i].locked = 0; in squashfs_read_super()
1086 msblk->fragment[i].block = SQUASHFS_INVALID_BLK; in squashfs_read_super()
1087 msblk->fragment[i].data = NULL; in squashfs_read_super()
1090 msblk->next_fragment = 0; in squashfs_read_super()
1093 if(msblk->read_fragment_index_table(s) == 0) in squashfs_read_super()
1097 if ((root = (msblk->iget)(s, sblk->root_inode)) == NULL) in squashfs_read_super()
1110 kfree(msblk->fragment_index); in squashfs_read_super()
1111 kfree(msblk->fragment); in squashfs_read_super()
1112 kfree(msblk->uid); in squashfs_read_super()
1113 kfree(msblk->read_page); in squashfs_read_super()
1114 kfree(msblk->read_data); in squashfs_read_super()
1115 kfree(msblk->block_cache); in squashfs_read_super()
1116 kfree(msblk->fragment_index_2); in squashfs_read_super()
1117 vfree(msblk->stream.workspace); in squashfs_read_super()
1124 struct squashfs_sb_info *msblk = &s->u.squashfs_sb; in squashfs_statfs() local
1125 struct squashfs_super_block *sblk = &msblk->sblk; in squashfs_statfs()
1190 struct squashfs_sb_info *msblk = &inode->i_sb->u.squashfs_sb; in locate_meta_index() local
1193 down(&msblk->meta_index_mutex); in locate_meta_index()
1197 if(msblk->meta_index == NULL) in locate_meta_index()
1201 if (msblk->meta_index[i].inode_number == inode->i_ino && in locate_meta_index()
1202 msblk->meta_index[i].offset >= offset && in locate_meta_index()
1203 msblk->meta_index[i].offset <= index && in locate_meta_index()
1204 msblk->meta_index[i].locked == 0) { in locate_meta_index()
1206 msblk->meta_index[i].offset); in locate_meta_index()
1207 meta = &msblk->meta_index[i]; in locate_meta_index()
1215 up(&msblk->meta_index_mutex); in locate_meta_index()
1223 struct squashfs_sb_info *msblk = &inode->i_sb->u.squashfs_sb; in empty_meta_index() local
1227 down(&msblk->meta_index_mutex); in empty_meta_index()
1231 if(msblk->meta_index == NULL) { in empty_meta_index()
1232 if (!(msblk->meta_index = kmalloc(sizeof(struct meta_index) * in empty_meta_index()
1238 msblk->meta_index[i].inode_number = 0; in empty_meta_index()
1239 msblk->meta_index[i].locked = 0; in empty_meta_index()
1241 msblk->next_meta_index = 0; in empty_meta_index()
1245 msblk->meta_index[msblk->next_meta_index].locked; i --) in empty_meta_index()
1246 msblk->next_meta_index = (msblk->next_meta_index + 1) % in empty_meta_index()
1255 msblk->next_meta_index, in empty_meta_index()
1256 &msblk->meta_index[msblk->next_meta_index]); in empty_meta_index()
1258 meta = &msblk->meta_index[msblk->next_meta_index]; in empty_meta_index()
1259 msblk->next_meta_index = (msblk->next_meta_index + 1) % in empty_meta_index()
1269 up(&msblk->meta_index_mutex); in empty_meta_index()
1283 struct squashfs_sb_info *msblk = &s->u.squashfs_sb; in read_block_index() local
1287 if (msblk->swap) { in read_block_index()
1329 struct squashfs_sb_info *msblk = &inode->i_sb->u.squashfs_sb; in get_meta_index() local
1330 struct squashfs_super_block *sblk = &msblk->sblk; in get_meta_index()
1453 struct squashfs_sb_info *msblk = &inode->i_sb->u.squashfs_sb; in squashfs_readpage() local
1454 struct squashfs_super_block *sblk = &msblk->sblk; in squashfs_readpage()
1461 char *data_ptr = msblk->read_page; in squashfs_readpage()
1478 if ((block = (msblk->read_blocklist)(inode, index, 1, in squashfs_readpage()
1482 down(&msblk->read_page_mutex); in squashfs_readpage()
1484 if (!(bytes = squashfs_read_data(inode->i_sb, msblk->read_page, in squashfs_readpage()
1488 up(&msblk->read_page_mutex); in squashfs_readpage()
1549 up(&msblk->read_page_mutex); in squashfs_readpage()
1551 release_cached_fragment(msblk, fragment); in squashfs_readpage()
1570 struct squashfs_sb_info *msblk = &inode->i_sb->u.squashfs_sb; in squashfs_readpage4K() local
1571 struct squashfs_super_block *sblk = &msblk->sblk; in squashfs_readpage4K()
1590 block = (msblk->read_blocklist)(inode, page->index, 1, in squashfs_readpage4K()
1593 down(&msblk->read_page_mutex); in squashfs_readpage4K()
1594 bytes = squashfs_read_data(inode->i_sb, msblk->read_page, block, in squashfs_readpage4K()
1598 memcpy(pageaddr, msblk->read_page, bytes); in squashfs_readpage4K()
1602 up(&msblk->read_page_mutex); in squashfs_readpage4K()
1614 release_cached_fragment(msblk, fragment); in squashfs_readpage4K()
1639 struct squashfs_sb_info *msblk = &s->u.squashfs_sb; in get_dir_index_using_offset() local
1640 struct squashfs_super_block *sblk = &msblk->sblk; in get_dir_index_using_offset()
1652 if (msblk->swap) { in get_dir_index_using_offset()
1689 struct squashfs_sb_info *msblk = &s->u.squashfs_sb; in get_dir_index_using_name() local
1690 struct squashfs_super_block *sblk = &msblk->sblk; in get_dir_index_using_name()
1702 if (msblk->swap) { in get_dir_index_using_name()
1736 struct squashfs_sb_info *msblk = &i->i_sb->u.squashfs_sb; in squashfs_readdir() local
1737 struct squashfs_super_block *sblk = &msblk->sblk; in squashfs_readdir()
1783 if (msblk->swap) { in squashfs_readdir()
1804 if (msblk->swap) { in squashfs_readdir()
1871 struct squashfs_sb_info *msblk = &i->i_sb->u.squashfs_sb; in squashfs_lookup() local
1872 struct squashfs_super_block *sblk = &msblk->sblk; in squashfs_lookup()
1894 if (msblk->swap) { in squashfs_lookup()
1914 if (msblk->swap) { in squashfs_lookup()
1955 inode = (msblk->iget)(i->i_sb, ino); in squashfs_lookup()