} 
} else if (inode->i_size == HFS_I(inode)->phys_size) return; 
void hfs_file_truncate(struct inode *inode){	struct super_block *sb = inode->i_sb;	struct hfs_find_data fd;	u16 blk_cnt, alloc_cnt, start;	u32 size;	int res;	dprint(DBG_INODE, "truncate: %lu, %Lu -> %Lu\n", inode->i_ino,	       (long long)HFS_I(inode)->phys_size, inode->i_size);	if (inode->i_size > HFS_I(inode)->phys_size) {		struct address_space *mapping = inode->i_mapping;		struct page *page;		int res;		size = inode->i_size - 1;		page = grab_cache_page(mapping, size >> PAGE_CACHE_SHIFT);		if (!page)			return;		size &= PAGE_CACHE_SIZE - 1;		size++;		res = mapping->a_ops->prepare_write(NULL, page, size, size);		if (!res)			res = mapping->a_ops->commit_write(NULL, page, size, size);		if (res)			inode->i_size = HFS_I(inode)->phys_size;		unlock_page(page);		page_cache_release(page);		mark_inode_dirty(inode);		return;	}	size = inode->i_size + HFS_SB(sb)->alloc_blksz - 1;	blk_cnt = size / HFS_SB(sb)->alloc_blksz;	alloc_cnt = HFS_I(inode)->alloc_blocks;	if (blk_cnt == alloc_cnt)		goto out;	down(&HFS_I(inode)->extents_lock);	hfs_find_init(HFS_SB(sb)->ext_tree, &fd);	while (1) {		if (alloc_cnt == HFS_I(inode)->first_blocks) {			hfs_free_extents(sb, HFS_I(inode)->first_extents,					 alloc_cnt, alloc_cnt - blk_cnt);			hfs_dump_extent(HFS_I(inode)->first_extents);			HFS_I(inode)->first_blocks = blk_cnt;			break;		}		res = __hfs_ext_cache_extent(&fd, inode, alloc_cnt);		if (res)			break;		start = HFS_I(inode)->cached_start;		hfs_free_extents(sb, HFS_I(inode)->cached_extents,				 alloc_cnt - start, alloc_cnt - blk_cnt);		hfs_dump_extent(HFS_I(inode)->cached_extents);		if (blk_cnt > start) {			HFS_I(inode)->flags |= HFS_FLG_EXT_DIRTY;			break;		}		alloc_cnt = start;		HFS_I(inode)->cached_start = HFS_I(inode)->cached_blocks = 0;		HFS_I(inode)->flags &= ~(HFS_FLG_EXT_DIRTY|HFS_FLG_EXT_NEW);		hfs_brec_remove(&fd);	}	hfs_find_exit(&fd);	up(&HFS_I(inode)->extents_lock);	HFS_I(inode)->alloc_blocks = blk_cnt;out:	HFS_I(inode)->phys_size = inode->i_size;	HFS_I(inode)->fs_blocks = (inode->i_size + sb->s_blocksize - 1) >> sb->s_blocksize_bits;	inode_set_bytes(inode, HFS_I(inode)->fs_blocks << sb->s_blocksize_bits);	mark_inode_dirty(inode);}
10457	/local/tlutelli/issta_data/temp/c/2005_temp/2005/10457/f76d28d235cf777dd2e1c1d48c16ee10c1d1587f/extent.c/buggy/fs/hfs/extent.c