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