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()
107 hfs_brec_insert(fd, hip->cached_extents, in __hfsplus_ext_write_extent()
109 hip->extent_state &= ~(HFSPLUS_EXT_DIRTY | HFSPLUS_EXT_NEW); in __hfsplus_ext_write_extent()
113 hfs_bnode_write(fd->bnode, hip->cached_extents, in __hfsplus_ext_write_extent()
115 hip->extent_state &= ~HFSPLUS_EXT_DIRTY; in __hfsplus_ext_write_extent()
124 set_bit(HFSPLUS_I_EXT_DIRTY, &hip->flags); in __hfsplus_ext_write_extent()
180 struct hfsplus_inode_info *hip = HFSPLUS_I(inode); in __hfsplus_ext_cache_extent() local
183 WARN_ON(!mutex_is_locked(&hip->extents_lock)); in __hfsplus_ext_cache_extent()
185 if (hip->extent_state & HFSPLUS_EXT_DIRTY) { in __hfsplus_ext_cache_extent()
191 res = __hfsplus_ext_read_extent(fd, hip->cached_extents, inode->i_ino, in __hfsplus_ext_cache_extent()
196 hip->cached_start = be32_to_cpu(fd->key->ext.start_block); in __hfsplus_ext_cache_extent()
197 hip->cached_blocks = in __hfsplus_ext_cache_extent()
198 hfsplus_ext_block_count(hip->cached_extents); in __hfsplus_ext_cache_extent()
200 hip->cached_start = hip->cached_blocks = 0; in __hfsplus_ext_cache_extent()
201 hip->extent_state &= ~(HFSPLUS_EXT_DIRTY | HFSPLUS_EXT_NEW); in __hfsplus_ext_cache_extent()
208 struct hfsplus_inode_info *hip = HFSPLUS_I(inode); in hfsplus_ext_read_extent() local
212 if (block >= hip->cached_start && in hfsplus_ext_read_extent()
213 block < hip->cached_start + hip->cached_blocks) in hfsplus_ext_read_extent()
230 struct hfsplus_inode_info *hip = HFSPLUS_I(inode); in hfsplus_get_block() local
239 if (iblock >= hip->fs_blocks) { in hfsplus_get_block()
242 if (iblock > hip->fs_blocks) in hfsplus_get_block()
244 if (ablock >= hip->alloc_blocks) { in hfsplus_get_block()
252 if (ablock < hip->first_blocks) { in hfsplus_get_block()
253 dblock = hfsplus_ext_find_block(hip->first_extents, ablock); in hfsplus_get_block()
260 mutex_lock(&hip->extents_lock); in hfsplus_get_block()
267 was_dirty = (hip->extent_state & HFSPLUS_EXT_DIRTY); in hfsplus_get_block()
270 mutex_unlock(&hip->extents_lock); in hfsplus_get_block()
273 dblock = hfsplus_ext_find_block(hip->cached_extents, in hfsplus_get_block()
274 ablock - hip->cached_start); in hfsplus_get_block()
275 mutex_unlock(&hip->extents_lock); in hfsplus_get_block()
288 hip->phys_size += sb->s_blocksize; in hfsplus_get_block()
289 hip->fs_blocks++; in hfsplus_get_block()
444 struct hfsplus_inode_info *hip = HFSPLUS_I(inode); in hfsplus_file_extend() local
457 mutex_lock(&hip->extents_lock); in hfsplus_file_extend()
458 if (hip->alloc_blocks == hip->first_blocks) in hfsplus_file_extend()
459 goal = hfsplus_ext_lastblock(hip->first_extents); in hfsplus_file_extend()
461 res = hfsplus_ext_read_extent(inode, hip->alloc_blocks); in hfsplus_file_extend()
464 goal = hfsplus_ext_lastblock(hip->cached_extents); in hfsplus_file_extend()
467 len = hip->clump_blocks; in hfsplus_file_extend()
485 if (hip->alloc_blocks <= hip->first_blocks) { in hfsplus_file_extend()
486 if (!hip->first_blocks) { in hfsplus_file_extend()
489 hip->first_extents[0].start_block = cpu_to_be32(start); in hfsplus_file_extend()
490 hip->first_extents[0].block_count = cpu_to_be32(len); in hfsplus_file_extend()
494 res = hfsplus_add_extent(hip->first_extents, in hfsplus_file_extend()
495 hip->alloc_blocks, in hfsplus_file_extend()
501 hfsplus_dump_extent(hip->first_extents); in hfsplus_file_extend()
502 hip->first_blocks += len; in hfsplus_file_extend()
505 res = hfsplus_add_extent(hip->cached_extents, in hfsplus_file_extend()
506 hip->alloc_blocks - hip->cached_start, in hfsplus_file_extend()
509 hfsplus_dump_extent(hip->cached_extents); in hfsplus_file_extend()
510 hip->extent_state |= HFSPLUS_EXT_DIRTY; in hfsplus_file_extend()
511 hip->cached_blocks += len; in hfsplus_file_extend()
517 hip->alloc_blocks += len; in hfsplus_file_extend()
518 mutex_unlock(&hip->extents_lock); in hfsplus_file_extend()
522 mutex_unlock(&hip->extents_lock); in hfsplus_file_extend()
531 memset(hip->cached_extents, 0, sizeof(hfsplus_extent_rec)); in hfsplus_file_extend()
532 hip->cached_extents[0].start_block = cpu_to_be32(start); in hfsplus_file_extend()
533 hip->cached_extents[0].block_count = cpu_to_be32(len); in hfsplus_file_extend()
534 hfsplus_dump_extent(hip->cached_extents); in hfsplus_file_extend()
535 hip->extent_state |= HFSPLUS_EXT_DIRTY | HFSPLUS_EXT_NEW; in hfsplus_file_extend()
536 hip->cached_start = hip->alloc_blocks; in hfsplus_file_extend()
537 hip->cached_blocks = len; in hfsplus_file_extend()
546 struct hfsplus_inode_info *hip = HFSPLUS_I(inode); in hfsplus_file_truncate() local
552 inode->i_ino, (long long)hip->phys_size, inode->i_size); in hfsplus_file_truncate()
554 if (inode->i_size > hip->phys_size) { in hfsplus_file_truncate()
570 } else if (inode->i_size == hip->phys_size) in hfsplus_file_truncate()
576 mutex_lock(&hip->extents_lock); in hfsplus_file_truncate()
578 alloc_cnt = hip->alloc_blocks; in hfsplus_file_truncate()
584 mutex_unlock(&hip->extents_lock); in hfsplus_file_truncate()
589 if (alloc_cnt == hip->first_blocks) { in hfsplus_file_truncate()
591 hfsplus_free_extents(sb, hip->first_extents, in hfsplus_file_truncate()
593 hfsplus_dump_extent(hip->first_extents); in hfsplus_file_truncate()
594 hip->first_blocks = blk_cnt; in hfsplus_file_truncate()
602 start = hip->cached_start; in hfsplus_file_truncate()
606 hfsplus_free_extents(sb, hip->cached_extents, in hfsplus_file_truncate()
608 hfsplus_dump_extent(hip->cached_extents); in hfsplus_file_truncate()
611 hip->extent_state |= HFSPLUS_EXT_DIRTY; in hfsplus_file_truncate()
615 hip->cached_start = hip->cached_blocks = 0; in hfsplus_file_truncate()
616 hip->extent_state &= ~(HFSPLUS_EXT_DIRTY | HFSPLUS_EXT_NEW); in hfsplus_file_truncate()
620 hip->alloc_blocks = blk_cnt; in hfsplus_file_truncate()
622 mutex_unlock(&hip->extents_lock); in hfsplus_file_truncate()
623 hip->phys_size = inode->i_size; in hfsplus_file_truncate()
624 hip->fs_blocks = (inode->i_size + sb->s_blocksize - 1) >> in hfsplus_file_truncate()
626 inode_set_bytes(inode, hip->fs_blocks << sb->s_blocksize_bits); in hfsplus_file_truncate()