示例#1
0
文件: truncate.c 项目: Larhard/hurd
static inline void
_free_block_run_flush (struct free_block_run *fbr, unsigned long count)
{
  fbr->node->dn_stat.st_blocks -= count << log2_stat_blocks_per_fs_block;
  fbr->node->dn_stat_dirty = 1;
  ext2_free_blocks (fbr->first_block, count);
}
示例#2
0
/*
 * Free a block or fragment.
 *
 * pass on to the Linux code
 */
void
ext2_blkfree(struct inode *ip, daddr_t bno, long size)
{
	struct ext2_sb_info *fs;

	fs = ip->i_e2fs;
	/*
	 *	call Linux code with mount *, block number, count
	 */
	ext2_free_blocks(ITOV(ip)->v_mount, bno, size / fs->s_frag_size);
}
示例#3
0
/*
 * Linux calls this functions at the following locations:
 * (1) the inode is freed
 * (2) a preallocation miss occurs
 * (3) truncate is called
 * (4) release_file is called and f_mode & 2
 *
 * I call it in ext2_inactive, ext2_truncate, ext2_vfree and in (2)
 * the call in vfree might be redundant
 */
void
ext2_discard_prealloc(struct inode *ip)
{
#ifdef EXT2_PREALLOCATE
        if (ip->i_prealloc_count) {
                int i = ip->i_prealloc_count;
                ip->i_prealloc_count = 0;
                ext2_free_blocks (ITOV(ip)->v_mount,
                                  ip->i_prealloc_block,
                                  i);
        }
#endif
}
示例#4
0
void ext2_discard_prealloc (struct inode * inode)
{
#ifdef EXT2_PREALLOCATE
	lock_kernel();
	/* Writer: ->i_prealloc* */
	if (inode->u.ext2_i.i_prealloc_count) {
		unsigned short total = inode->u.ext2_i.i_prealloc_count;
		unsigned long block = inode->u.ext2_i.i_prealloc_block;
		inode->u.ext2_i.i_prealloc_count = 0;
		inode->u.ext2_i.i_prealloc_block = 0;
		/* Writer: end */
		ext2_free_blocks (inode, block, total);
	}
	unlock_kernel();
#endif
}
示例#5
0
void ext2_discard_prealloc (struct inode * inode)
{
#ifdef EXT2_PREALLOCATE
    struct ext2_inode_info *ei = EXT2_I(inode);
    write_lock(&ei->i_meta_lock);
    if (ei->i_prealloc_count) {
        unsigned short total = ei->i_prealloc_count;
        unsigned long block = ei->i_prealloc_block;
        ei->i_prealloc_count = 0;
        ei->i_prealloc_block = 0;
        write_unlock(&ei->i_meta_lock);
        ext2_free_blocks (inode, block, total);
        return;
    } else
        write_unlock(&ei->i_meta_lock);
#endif
}