Lines Matching refs:hip

89 	struct hfsplus_inode_info *hip = HFSPLUS_I(inode);  in __hfsplus_ext_write_extent()  local
92 WARN_ON(!mutex_is_locked(&hip->extents_lock)); in __hfsplus_ext_write_extent()
94 hfsplus_ext_build_key(fd->search_key, inode->i_ino, hip->cached_start, in __hfsplus_ext_write_extent()
99 if (hip->extent_state & HFSPLUS_EXT_NEW) { in __hfsplus_ext_write_extent()
102 hfs_brec_insert(fd, hip->cached_extents, in __hfsplus_ext_write_extent()
104 hip->extent_state &= ~(HFSPLUS_EXT_DIRTY | HFSPLUS_EXT_NEW); in __hfsplus_ext_write_extent()
108 hfs_bnode_write(fd->bnode, hip->cached_extents, in __hfsplus_ext_write_extent()
110 hip->extent_state &= ~HFSPLUS_EXT_DIRTY; in __hfsplus_ext_write_extent()
119 set_bit(HFSPLUS_I_EXT_DIRTY, &hip->flags); in __hfsplus_ext_write_extent()
175 struct hfsplus_inode_info *hip = HFSPLUS_I(inode); in __hfsplus_ext_cache_extent() local
178 WARN_ON(!mutex_is_locked(&hip->extents_lock)); in __hfsplus_ext_cache_extent()
180 if (hip->extent_state & HFSPLUS_EXT_DIRTY) { in __hfsplus_ext_cache_extent()
186 res = __hfsplus_ext_read_extent(fd, hip->cached_extents, inode->i_ino, in __hfsplus_ext_cache_extent()
191 hip->cached_start = be32_to_cpu(fd->key->ext.start_block); in __hfsplus_ext_cache_extent()
192 hip->cached_blocks = in __hfsplus_ext_cache_extent()
193 hfsplus_ext_block_count(hip->cached_extents); in __hfsplus_ext_cache_extent()
195 hip->cached_start = hip->cached_blocks = 0; in __hfsplus_ext_cache_extent()
196 hip->extent_state &= ~(HFSPLUS_EXT_DIRTY | HFSPLUS_EXT_NEW); in __hfsplus_ext_cache_extent()
203 struct hfsplus_inode_info *hip = HFSPLUS_I(inode); in hfsplus_ext_read_extent() local
207 if (block >= hip->cached_start && in hfsplus_ext_read_extent()
208 block < hip->cached_start + hip->cached_blocks) in hfsplus_ext_read_extent()
225 struct hfsplus_inode_info *hip = HFSPLUS_I(inode); in hfsplus_get_block() local
234 if (iblock >= hip->fs_blocks) { in hfsplus_get_block()
235 if (iblock > hip->fs_blocks || !create) in hfsplus_get_block()
237 if (ablock >= hip->alloc_blocks) { in hfsplus_get_block()
245 if (ablock < hip->first_blocks) { in hfsplus_get_block()
246 dblock = hfsplus_ext_find_block(hip->first_extents, ablock); in hfsplus_get_block()
253 mutex_lock(&hip->extents_lock); in hfsplus_get_block()
260 was_dirty = (hip->extent_state & HFSPLUS_EXT_DIRTY); in hfsplus_get_block()
263 mutex_unlock(&hip->extents_lock); in hfsplus_get_block()
266 dblock = hfsplus_ext_find_block(hip->cached_extents, in hfsplus_get_block()
267 ablock - hip->cached_start); in hfsplus_get_block()
268 mutex_unlock(&hip->extents_lock); in hfsplus_get_block()
281 hip->phys_size += sb->s_blocksize; in hfsplus_get_block()
282 hip->fs_blocks++; in hfsplus_get_block()
432 struct hfsplus_inode_info *hip = HFSPLUS_I(inode); in hfsplus_file_extend() local
445 mutex_lock(&hip->extents_lock); in hfsplus_file_extend()
446 if (hip->alloc_blocks == hip->first_blocks) in hfsplus_file_extend()
447 goal = hfsplus_ext_lastblock(hip->first_extents); in hfsplus_file_extend()
449 res = hfsplus_ext_read_extent(inode, hip->alloc_blocks); in hfsplus_file_extend()
452 goal = hfsplus_ext_lastblock(hip->cached_extents); in hfsplus_file_extend()
455 len = hip->clump_blocks; in hfsplus_file_extend()
473 if (hip->alloc_blocks <= hip->first_blocks) { in hfsplus_file_extend()
474 if (!hip->first_blocks) { in hfsplus_file_extend()
477 hip->first_extents[0].start_block = cpu_to_be32(start); in hfsplus_file_extend()
478 hip->first_extents[0].block_count = cpu_to_be32(len); in hfsplus_file_extend()
482 res = hfsplus_add_extent(hip->first_extents, in hfsplus_file_extend()
483 hip->alloc_blocks, in hfsplus_file_extend()
489 hfsplus_dump_extent(hip->first_extents); in hfsplus_file_extend()
490 hip->first_blocks += len; in hfsplus_file_extend()
493 res = hfsplus_add_extent(hip->cached_extents, in hfsplus_file_extend()
494 hip->alloc_blocks - hip->cached_start, in hfsplus_file_extend()
497 hfsplus_dump_extent(hip->cached_extents); in hfsplus_file_extend()
498 hip->extent_state |= HFSPLUS_EXT_DIRTY; in hfsplus_file_extend()
499 hip->cached_blocks += len; in hfsplus_file_extend()
505 hip->alloc_blocks += len; in hfsplus_file_extend()
506 mutex_unlock(&hip->extents_lock); in hfsplus_file_extend()
510 mutex_unlock(&hip->extents_lock); in hfsplus_file_extend()
519 memset(hip->cached_extents, 0, sizeof(hfsplus_extent_rec)); in hfsplus_file_extend()
520 hip->cached_extents[0].start_block = cpu_to_be32(start); in hfsplus_file_extend()
521 hip->cached_extents[0].block_count = cpu_to_be32(len); in hfsplus_file_extend()
522 hfsplus_dump_extent(hip->cached_extents); in hfsplus_file_extend()
523 hip->extent_state |= HFSPLUS_EXT_DIRTY | HFSPLUS_EXT_NEW; in hfsplus_file_extend()
524 hip->cached_start = hip->alloc_blocks; in hfsplus_file_extend()
525 hip->cached_blocks = len; in hfsplus_file_extend()
534 struct hfsplus_inode_info *hip = HFSPLUS_I(inode); in hfsplus_file_truncate() local
540 inode->i_ino, (long long)hip->phys_size, inode->i_size); in hfsplus_file_truncate()
542 if (inode->i_size > hip->phys_size) { in hfsplus_file_truncate()
559 } else if (inode->i_size == hip->phys_size) in hfsplus_file_truncate()
565 mutex_lock(&hip->extents_lock); in hfsplus_file_truncate()
567 alloc_cnt = hip->alloc_blocks; in hfsplus_file_truncate()
573 mutex_unlock(&hip->extents_lock); in hfsplus_file_truncate()
578 if (alloc_cnt == hip->first_blocks) { in hfsplus_file_truncate()
579 hfsplus_free_extents(sb, hip->first_extents, in hfsplus_file_truncate()
581 hfsplus_dump_extent(hip->first_extents); in hfsplus_file_truncate()
582 hip->first_blocks = blk_cnt; in hfsplus_file_truncate()
588 start = hip->cached_start; in hfsplus_file_truncate()
589 hfsplus_free_extents(sb, hip->cached_extents, in hfsplus_file_truncate()
591 hfsplus_dump_extent(hip->cached_extents); in hfsplus_file_truncate()
593 hip->extent_state |= HFSPLUS_EXT_DIRTY; in hfsplus_file_truncate()
597 hip->cached_start = hip->cached_blocks = 0; in hfsplus_file_truncate()
598 hip->extent_state &= ~(HFSPLUS_EXT_DIRTY | HFSPLUS_EXT_NEW); in hfsplus_file_truncate()
603 hip->alloc_blocks = blk_cnt; in hfsplus_file_truncate()
605 mutex_unlock(&hip->extents_lock); in hfsplus_file_truncate()
606 hip->phys_size = inode->i_size; in hfsplus_file_truncate()
607 hip->fs_blocks = (inode->i_size + sb->s_blocksize - 1) >> in hfsplus_file_truncate()
609 inode_set_bytes(inode, hip->fs_blocks << sb->s_blocksize_bits); in hfsplus_file_truncate()