Lines Matching refs:HFS_I

114 	hfs_ext_build_key(fd->search_key, inode->i_ino, HFS_I(inode)->cached_start,  in __hfs_ext_write_extent()
117 if (HFS_I(inode)->flags & HFS_FLG_EXT_NEW) { in __hfs_ext_write_extent()
124 hfs_brec_insert(fd, HFS_I(inode)->cached_extents, sizeof(hfs_extent_rec)); in __hfs_ext_write_extent()
125 HFS_I(inode)->flags &= ~(HFS_FLG_EXT_DIRTY|HFS_FLG_EXT_NEW); in __hfs_ext_write_extent()
129 hfs_bnode_write(fd->bnode, HFS_I(inode)->cached_extents, fd->entryoffset, fd->entrylength); in __hfs_ext_write_extent()
130 HFS_I(inode)->flags &= ~HFS_FLG_EXT_DIRTY; in __hfs_ext_write_extent()
140 if (HFS_I(inode)->flags & HFS_FLG_EXT_DIRTY) { in hfs_ext_write_extent()
173 if (HFS_I(inode)->flags & HFS_FLG_EXT_DIRTY) { in __hfs_ext_cache_extent()
179 res = __hfs_ext_read_extent(fd, HFS_I(inode)->cached_extents, inode->i_ino, in __hfs_ext_cache_extent()
182 HFS_I(inode)->cached_start = be16_to_cpu(fd->key->ext.FABN); in __hfs_ext_cache_extent()
183 HFS_I(inode)->cached_blocks = hfs_ext_block_count(HFS_I(inode)->cached_extents); in __hfs_ext_cache_extent()
185 HFS_I(inode)->cached_start = HFS_I(inode)->cached_blocks = 0; in __hfs_ext_cache_extent()
186 HFS_I(inode)->flags &= ~(HFS_FLG_EXT_DIRTY|HFS_FLG_EXT_NEW); in __hfs_ext_cache_extent()
196 if (block >= HFS_I(inode)->cached_start && in hfs_ext_read_extent()
197 block < HFS_I(inode)->cached_start + HFS_I(inode)->cached_blocks) in hfs_ext_read_extent()
347 if (block >= HFS_I(inode)->fs_blocks) { in hfs_get_block()
350 if (block > HFS_I(inode)->fs_blocks) in hfs_get_block()
352 if (ablock >= HFS_I(inode)->alloc_blocks) { in hfs_get_block()
360 if (ablock < HFS_I(inode)->first_blocks) { in hfs_get_block()
361 dblock = hfs_ext_find_block(HFS_I(inode)->first_extents, ablock); in hfs_get_block()
365 mutex_lock(&HFS_I(inode)->extents_lock); in hfs_get_block()
368 dblock = hfs_ext_find_block(HFS_I(inode)->cached_extents, in hfs_get_block()
369 ablock - HFS_I(inode)->cached_start); in hfs_get_block()
371 mutex_unlock(&HFS_I(inode)->extents_lock); in hfs_get_block()
374 mutex_unlock(&HFS_I(inode)->extents_lock); in hfs_get_block()
383 HFS_I(inode)->phys_size += sb->s_blocksize; in hfs_get_block()
384 HFS_I(inode)->fs_blocks++; in hfs_get_block()
397 mutex_lock(&HFS_I(inode)->extents_lock); in hfs_extend_file()
398 if (HFS_I(inode)->alloc_blocks == HFS_I(inode)->first_blocks) in hfs_extend_file()
399 goal = hfs_ext_lastblock(HFS_I(inode)->first_extents); in hfs_extend_file()
401 res = hfs_ext_read_extent(inode, HFS_I(inode)->alloc_blocks); in hfs_extend_file()
404 goal = hfs_ext_lastblock(HFS_I(inode)->cached_extents); in hfs_extend_file()
407 len = HFS_I(inode)->clump_blocks; in hfs_extend_file()
415 if (HFS_I(inode)->alloc_blocks == HFS_I(inode)->first_blocks) { in hfs_extend_file()
416 if (!HFS_I(inode)->first_blocks) { in hfs_extend_file()
419 HFS_I(inode)->first_extents[0].block = cpu_to_be16(start); in hfs_extend_file()
420 HFS_I(inode)->first_extents[0].count = cpu_to_be16(len); in hfs_extend_file()
424 res = hfs_add_extent(HFS_I(inode)->first_extents, in hfs_extend_file()
425 HFS_I(inode)->alloc_blocks, in hfs_extend_file()
431 hfs_dump_extent(HFS_I(inode)->first_extents); in hfs_extend_file()
432 HFS_I(inode)->first_blocks += len; in hfs_extend_file()
435 res = hfs_add_extent(HFS_I(inode)->cached_extents, in hfs_extend_file()
436 HFS_I(inode)->alloc_blocks - in hfs_extend_file()
437 HFS_I(inode)->cached_start, in hfs_extend_file()
440 hfs_dump_extent(HFS_I(inode)->cached_extents); in hfs_extend_file()
441 HFS_I(inode)->flags |= HFS_FLG_EXT_DIRTY; in hfs_extend_file()
442 HFS_I(inode)->cached_blocks += len; in hfs_extend_file()
447 mutex_unlock(&HFS_I(inode)->extents_lock); in hfs_extend_file()
449 HFS_I(inode)->alloc_blocks += len; in hfs_extend_file()
464 memset(HFS_I(inode)->cached_extents, 0, sizeof(hfs_extent_rec)); in hfs_extend_file()
465 HFS_I(inode)->cached_extents[0].block = cpu_to_be16(start); in hfs_extend_file()
466 HFS_I(inode)->cached_extents[0].count = cpu_to_be16(len); in hfs_extend_file()
467 hfs_dump_extent(HFS_I(inode)->cached_extents); in hfs_extend_file()
468 HFS_I(inode)->flags |= HFS_FLG_EXT_DIRTY|HFS_FLG_EXT_NEW; in hfs_extend_file()
469 HFS_I(inode)->cached_start = HFS_I(inode)->alloc_blocks; in hfs_extend_file()
470 HFS_I(inode)->cached_blocks = len; in hfs_extend_file()
485 inode->i_ino, (long long)HFS_I(inode)->phys_size, in hfs_file_truncate()
487 if (inode->i_size > HFS_I(inode)->phys_size) { in hfs_file_truncate()
501 inode->i_size = HFS_I(inode)->phys_size; in hfs_file_truncate()
503 } else if (inode->i_size == HFS_I(inode)->phys_size) in hfs_file_truncate()
507 alloc_cnt = HFS_I(inode)->alloc_blocks; in hfs_file_truncate()
511 mutex_lock(&HFS_I(inode)->extents_lock); in hfs_file_truncate()
514 mutex_unlock(&HFS_I(inode)->extents_lock); in hfs_file_truncate()
519 if (alloc_cnt == HFS_I(inode)->first_blocks) { in hfs_file_truncate()
520 hfs_free_extents(sb, HFS_I(inode)->first_extents, in hfs_file_truncate()
522 hfs_dump_extent(HFS_I(inode)->first_extents); in hfs_file_truncate()
523 HFS_I(inode)->first_blocks = blk_cnt; in hfs_file_truncate()
529 start = HFS_I(inode)->cached_start; in hfs_file_truncate()
530 hfs_free_extents(sb, HFS_I(inode)->cached_extents, in hfs_file_truncate()
532 hfs_dump_extent(HFS_I(inode)->cached_extents); in hfs_file_truncate()
534 HFS_I(inode)->flags |= HFS_FLG_EXT_DIRTY; in hfs_file_truncate()
538 HFS_I(inode)->cached_start = HFS_I(inode)->cached_blocks = 0; in hfs_file_truncate()
539 HFS_I(inode)->flags &= ~(HFS_FLG_EXT_DIRTY|HFS_FLG_EXT_NEW); in hfs_file_truncate()
543 mutex_unlock(&HFS_I(inode)->extents_lock); in hfs_file_truncate()
545 HFS_I(inode)->alloc_blocks = blk_cnt; in hfs_file_truncate()
547 HFS_I(inode)->phys_size = inode->i_size; in hfs_file_truncate()
548 HFS_I(inode)->fs_blocks = (inode->i_size + sb->s_blocksize - 1) >> sb->s_blocksize_bits; in hfs_file_truncate()
549 inode_set_bytes(inode, HFS_I(inode)->fs_blocks << sb->s_blocksize_bits); in hfs_file_truncate()