Lines Matching +full:scan +full:- +full:count
1 // SPDX-License-Identifier: GPL-2.0
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()
51 /* scan the first partial u32 for zero bits */ in hfsplus_block_allocate()
63 /* scan complete u32s for the first zero bit */ 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()
127 len -= 32; 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()
164 int hfsplus_block_free(struct super_block *sb, u32 offset, u32 count) in hfsplus_block_free() argument
174 if (!count) in hfsplus_block_free()
177 hfs_dbg(BITMAP, "block_free: %u,%u\n", offset, count); in hfsplus_block_free()
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()
198 if (j > count) { in hfsplus_block_free()
199 mask |= 0xffffffffU >> (i + count); in hfsplus_block_free()
204 count -= j; in hfsplus_block_free()
210 if (count < 32) in hfsplus_block_free()
213 count -= 32; in hfsplus_block_free()
215 if (!count) in hfsplus_block_free()
228 if (count) { in hfsplus_block_free()
229 mask = 0xffffffffU >> count; 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()