1 /* SPDX-License-Identifier: GPL-2.0-or-later */ 2 #ifndef SQUASHFS_FS_SB 3 #define SQUASHFS_FS_SB 4 /* 5 * Squashfs 6 * 7 * Copyright (c) 2002, 2003, 2004, 2005, 2006, 2007, 2008 8 * Phillip Lougher <phillip@squashfs.org.uk> 9 * 10 * squashfs_fs_sb.h 11 */ 12 13 #include "squashfs_fs.h" 14 15 /* 16 * Waiters for a cache entry sleep on wait_queue as exclusive waiters, so 17 * freeing one entry wakes one task. See squashfs_cache_get(). 18 * 19 * num_waiters is only a hint used to skip pointless wakeups: it is 20 * incremented before a task queues itself and decremented after it is woken, 21 * so it can transiently exceed the number of queued tasks. It never 22 * undercounts them, which is what the wakeup paths rely on. 23 */ 24 struct squashfs_cache { 25 char *name; 26 int entries; 27 int curr_blk; 28 int next_blk; 29 int num_waiters; 30 int unused; 31 int block_size; 32 int pages; 33 spinlock_t lock; 34 wait_queue_head_t wait_queue; 35 struct squashfs_cache_entry *entry; 36 }; 37 38 struct squashfs_cache_entry { 39 u64 block; 40 int length; 41 int refcount; 42 u64 next_index; 43 int pending; 44 int error; 45 int num_waiters; 46 wait_queue_head_t wait_queue; 47 struct squashfs_cache *cache; 48 void **data; 49 struct squashfs_page_actor *actor; 50 }; 51 52 struct squashfs_sb_info { 53 const struct squashfs_decompressor *decompressor; 54 int devblksize; 55 int devblksize_log2; 56 struct squashfs_cache *block_cache; 57 struct squashfs_cache *fragment_cache; 58 struct squashfs_cache *read_page; 59 struct address_space *cache_mapping; 60 int next_meta_index; 61 __le64 *id_table; 62 __le64 *fragment_index; 63 __le64 *xattr_id_table; 64 struct mutex meta_index_mutex; 65 struct meta_index *meta_index; 66 void *stream; 67 __le64 *inode_lookup_table; 68 u64 inode_table; 69 u64 directory_table; 70 u64 xattr_table; 71 unsigned int block_size; 72 unsigned short block_log; 73 long long bytes_used; 74 unsigned int inodes; 75 unsigned int fragments; 76 unsigned int xattr_ids; 77 unsigned int ids; 78 bool panic_on_errors; 79 const struct squashfs_decompressor_thread_ops *thread_ops; 80 int max_thread_num; 81 }; 82 #endif 83