Lines Matching refs:hip

90 	struct hfsplus_inode_info *hip = HFSPLUS_I(inode);  in __hfsplus_ext_write_extent()  local
93 WARN_ON(!mutex_is_locked(&hip->extents_lock)); in __hfsplus_ext_write_extent()
95 hfsplus_ext_build_key(fd->search_key, inode->i_ino, hip->cached_start, in __hfsplus_ext_write_extent()
100 if (hip->extent_state & HFSPLUS_EXT_NEW) { in __hfsplus_ext_write_extent()
103 hfs_brec_insert(fd, hip->cached_extents, in __hfsplus_ext_write_extent()
105 hip->extent_state &= ~(HFSPLUS_EXT_DIRTY | HFSPLUS_EXT_NEW); in __hfsplus_ext_write_extent()
109 hfs_bnode_write(fd->bnode, hip->cached_extents, in __hfsplus_ext_write_extent()
111 hip->extent_state &= ~HFSPLUS_EXT_DIRTY; in __hfsplus_ext_write_extent()
120 set_bit(HFSPLUS_I_EXT_DIRTY, &hip->flags); in __hfsplus_ext_write_extent()
176 struct hfsplus_inode_info *hip = HFSPLUS_I(inode); in __hfsplus_ext_cache_extent() local
179 WARN_ON(!mutex_is_locked(&hip->extents_lock)); in __hfsplus_ext_cache_extent()
181 if (hip->extent_state & HFSPLUS_EXT_DIRTY) { in __hfsplus_ext_cache_extent()
187 res = __hfsplus_ext_read_extent(fd, hip->cached_extents, inode->i_ino, in __hfsplus_ext_cache_extent()
192 hip->cached_start = be32_to_cpu(fd->key->ext.start_block); in __hfsplus_ext_cache_extent()
193 hip->cached_blocks = in __hfsplus_ext_cache_extent()
194 hfsplus_ext_block_count(hip->cached_extents); in __hfsplus_ext_cache_extent()
196 hip->cached_start = hip->cached_blocks = 0; in __hfsplus_ext_cache_extent()
197 hip->extent_state &= ~(HFSPLUS_EXT_DIRTY | HFSPLUS_EXT_NEW); in __hfsplus_ext_cache_extent()
204 struct hfsplus_inode_info *hip = HFSPLUS_I(inode); in hfsplus_ext_read_extent() local
208 if (block >= hip->cached_start && in hfsplus_ext_read_extent()
209 block < hip->cached_start + hip->cached_blocks) in hfsplus_ext_read_extent()
226 struct hfsplus_inode_info *hip = HFSPLUS_I(inode); in hfsplus_get_block() local
235 if (iblock >= hip->fs_blocks) { in hfsplus_get_block()
236 if (iblock > hip->fs_blocks || !create) in hfsplus_get_block()
238 if (ablock >= hip->alloc_blocks) { in hfsplus_get_block()
246 if (ablock < hip->first_blocks) { in hfsplus_get_block()
247 dblock = hfsplus_ext_find_block(hip->first_extents, ablock); in hfsplus_get_block()
254 mutex_lock(&hip->extents_lock); in hfsplus_get_block()
261 was_dirty = (hip->extent_state & HFSPLUS_EXT_DIRTY); in hfsplus_get_block()
264 mutex_unlock(&hip->extents_lock); in hfsplus_get_block()
267 dblock = hfsplus_ext_find_block(hip->cached_extents, in hfsplus_get_block()
268 ablock - hip->cached_start); in hfsplus_get_block()
269 mutex_unlock(&hip->extents_lock); in hfsplus_get_block()
282 hip->phys_size += sb->s_blocksize; in hfsplus_get_block()
283 hip->fs_blocks++; in hfsplus_get_block()
438 struct hfsplus_inode_info *hip = HFSPLUS_I(inode); in hfsplus_file_extend() local
451 mutex_lock(&hip->extents_lock); in hfsplus_file_extend()
452 if (hip->alloc_blocks == hip->first_blocks) in hfsplus_file_extend()
453 goal = hfsplus_ext_lastblock(hip->first_extents); in hfsplus_file_extend()
455 res = hfsplus_ext_read_extent(inode, hip->alloc_blocks); in hfsplus_file_extend()
458 goal = hfsplus_ext_lastblock(hip->cached_extents); in hfsplus_file_extend()
461 len = hip->clump_blocks; in hfsplus_file_extend()
479 if (hip->alloc_blocks <= hip->first_blocks) { in hfsplus_file_extend()
480 if (!hip->first_blocks) { in hfsplus_file_extend()
483 hip->first_extents[0].start_block = cpu_to_be32(start); in hfsplus_file_extend()
484 hip->first_extents[0].block_count = cpu_to_be32(len); in hfsplus_file_extend()
488 res = hfsplus_add_extent(hip->first_extents, in hfsplus_file_extend()
489 hip->alloc_blocks, in hfsplus_file_extend()
495 hfsplus_dump_extent(hip->first_extents); in hfsplus_file_extend()
496 hip->first_blocks += len; in hfsplus_file_extend()
499 res = hfsplus_add_extent(hip->cached_extents, in hfsplus_file_extend()
500 hip->alloc_blocks - hip->cached_start, in hfsplus_file_extend()
503 hfsplus_dump_extent(hip->cached_extents); in hfsplus_file_extend()
504 hip->extent_state |= HFSPLUS_EXT_DIRTY; in hfsplus_file_extend()
505 hip->cached_blocks += len; in hfsplus_file_extend()
511 hip->alloc_blocks += len; in hfsplus_file_extend()
512 mutex_unlock(&hip->extents_lock); in hfsplus_file_extend()
516 mutex_unlock(&hip->extents_lock); in hfsplus_file_extend()
525 memset(hip->cached_extents, 0, sizeof(hfsplus_extent_rec)); in hfsplus_file_extend()
526 hip->cached_extents[0].start_block = cpu_to_be32(start); in hfsplus_file_extend()
527 hip->cached_extents[0].block_count = cpu_to_be32(len); in hfsplus_file_extend()
528 hfsplus_dump_extent(hip->cached_extents); in hfsplus_file_extend()
529 hip->extent_state |= HFSPLUS_EXT_DIRTY | HFSPLUS_EXT_NEW; in hfsplus_file_extend()
530 hip->cached_start = hip->alloc_blocks; in hfsplus_file_extend()
531 hip->cached_blocks = len; in hfsplus_file_extend()
540 struct hfsplus_inode_info *hip = HFSPLUS_I(inode); in hfsplus_file_truncate() local
546 inode->i_ino, (long long)hip->phys_size, inode->i_size); in hfsplus_file_truncate()
548 if (inode->i_size > hip->phys_size) { in hfsplus_file_truncate()
564 } else if (inode->i_size == hip->phys_size) in hfsplus_file_truncate()
570 mutex_lock(&hip->extents_lock); in hfsplus_file_truncate()
572 alloc_cnt = hip->alloc_blocks; in hfsplus_file_truncate()
578 mutex_unlock(&hip->extents_lock); in hfsplus_file_truncate()
583 if (alloc_cnt == hip->first_blocks) { in hfsplus_file_truncate()
585 hfsplus_free_extents(sb, hip->first_extents, in hfsplus_file_truncate()
587 hfsplus_dump_extent(hip->first_extents); in hfsplus_file_truncate()
588 hip->first_blocks = blk_cnt; in hfsplus_file_truncate()
598 start = hip->cached_start; in hfsplus_file_truncate()
599 hfsplus_free_extents(sb, hip->cached_extents, in hfsplus_file_truncate()
601 hfsplus_dump_extent(hip->cached_extents); in hfsplus_file_truncate()
603 hip->extent_state |= HFSPLUS_EXT_DIRTY; in hfsplus_file_truncate()
607 hip->cached_start = hip->cached_blocks = 0; in hfsplus_file_truncate()
608 hip->extent_state &= ~(HFSPLUS_EXT_DIRTY | HFSPLUS_EXT_NEW); in hfsplus_file_truncate()
613 hip->alloc_blocks = blk_cnt; in hfsplus_file_truncate()
615 mutex_unlock(&hip->extents_lock); in hfsplus_file_truncate()
616 hip->phys_size = inode->i_size; in hfsplus_file_truncate()
617 hip->fs_blocks = (inode->i_size + sb->s_blocksize - 1) >> in hfsplus_file_truncate()
619 inode_set_bytes(inode, hip->fs_blocks << sb->s_blocksize_bits); in hfsplus_file_truncate()