Lines Matching +full:full +full:- +full:size
1 // SPDX-License-Identifier: GPL-2.0
19 int hfsplus_block_allocate(struct super_block *sb, u32 size, in hfsplus_block_allocate() argument
32 return size; 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()
39 start = size; 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()
46 if ((size ^ offset) / PAGE_CACHE_BITS) in hfsplus_block_allocate()
49 end = pptr + ((size + 31) & (PAGE_CACHE_BITS - 1)) / 32; in hfsplus_block_allocate()
79 if (offset >= size) in hfsplus_block_allocate()
84 start = size; in hfsplus_block_allocate()
88 if ((size ^ offset) / PAGE_CACHE_BITS) in hfsplus_block_allocate()
91 end = pptr + ((size + 31) & (PAGE_CACHE_BITS - 1)) / 32; in hfsplus_block_allocate()
93 hfs_dbg(BITMAP, "bitmap full\n"); in hfsplus_block_allocate()
94 start = size; in hfsplus_block_allocate()
98 start = offset + (curr - pptr) * 32 + i; in hfsplus_block_allocate()
99 if (start >= size) { in hfsplus_block_allocate()
100 hfs_dbg(BITMAP, "bitmap full\n"); 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()
116 /* do full u32s */ in hfsplus_block_allocate()
127 len -= 32; in hfsplus_block_allocate()
135 start = size; 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()
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()
196 int j = 32 - i; in hfsplus_block_free()
204 count -= j; in hfsplus_block_free()
207 /* do full u32s */ 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()