Lines Matching +full:max +full:- +full:len

1 // SPDX-License-Identifier: GPL-2.0
20 u32 offset, u32 *max) in hfsplus_block_allocate() argument
26 u32 mask, start, len, n; in hfsplus_block_allocate() local
30 len = *max; in hfsplus_block_allocate()
31 if (!len) in hfsplus_block_allocate()
34 hfs_dbg(BITMAP, "block_allocate: %u,%u,%u\n", size, offset, len); in hfsplus_block_allocate()
35 mutex_lock(&sbi->alloc_mutex); in hfsplus_block_allocate()
36 mapping = sbi->alloc_file->i_mapping; in hfsplus_block_allocate()
43 curr = pptr + (offset & (PAGE_CACHE_BITS - 1)) / 32; in hfsplus_block_allocate()
45 offset &= ~(PAGE_CACHE_BITS - 1); in hfsplus_block_allocate()
49 end = pptr + ((size + 31) & (PAGE_CACHE_BITS - 1)) / 32; in hfsplus_block_allocate()
91 end = pptr + ((size + 31) & (PAGE_CACHE_BITS - 1)) / 32; in hfsplus_block_allocate()
98 start = offset + (curr - pptr) * 32 + i; in hfsplus_block_allocate()
104 len = min(size - start, len); in hfsplus_block_allocate()
110 if (!--len || n & mask) in hfsplus_block_allocate()
113 if (!--len) in hfsplus_block_allocate()
120 if (len < 32) in hfsplus_block_allocate()
123 len = 32; in hfsplus_block_allocate()
127 len -= 32; in hfsplus_block_allocate()
145 for (i = 0; i < len; i++) { in hfsplus_block_allocate()
155 *max = offset + (curr - pptr) * 32 + i - start; in hfsplus_block_allocate()
156 sbi->free_blocks -= *max; in hfsplus_block_allocate()
158 hfs_dbg(BITMAP, "-> %u,%u\n", start, *max); in hfsplus_block_allocate()
160 mutex_unlock(&sbi->alloc_mutex); in hfsplus_block_allocate()
170 u32 mask, len, pnr; in hfsplus_block_free() local
179 if ((offset + count) > sbi->total_blocks) in hfsplus_block_free()
180 return -ENOENT; in hfsplus_block_free()
182 mutex_lock(&sbi->alloc_mutex); in hfsplus_block_free()
183 mapping = sbi->alloc_file->i_mapping; in hfsplus_block_free()
189 curr = pptr + (offset & (PAGE_CACHE_BITS - 1)) / 32; in hfsplus_block_free()
191 len = count; in hfsplus_block_free()
196 int j = 32 - i; in hfsplus_block_free()
204 count -= j; in hfsplus_block_free()
213 count -= 32; in hfsplus_block_free()
235 sbi->free_blocks += len; in hfsplus_block_free()
237 mutex_unlock(&sbi->alloc_mutex); in hfsplus_block_free()
243 mutex_unlock(&sbi->alloc_mutex); in hfsplus_block_free()
245 return -EIO; in hfsplus_block_free()