Пример #1
0
void minix_free_block(struct inode *inode, unsigned long block)
{
	struct super_block *sb = inode->i_sb;
	struct minix_sb_info *sbi = minix_sb(sb);
	struct buffer_head *bh;
	int k = sb->s_blocksize_bits + 3;
	unsigned long bit, zone;

	if (block < sbi->s_firstdatazone || block >= sbi->s_nzones) {
		printk("Trying to free block not in datazone\n");
		return;
	}
	zone = block - sbi->s_firstdatazone + 1;
	bit = zone & ((1<<k) - 1);
	zone >>= k;
	if (zone >= sbi->s_zmap_blocks) {
		printk("minix_free_block: nonexistent bitmap buffer\n");
		return;
	}
	bh = sbi->s_zmap[zone];
	spin_lock(&bitmap_lock);
	if (!minix_test_and_clear_bit(bit, bh->b_data))
		printk("minix_free_block (%s:%lu): bit already cleared\n",
		       sb->s_id, block);
	spin_unlock(&bitmap_lock);
	mark_buffer_dirty(bh);
	return;
}
Пример #2
0
void minix_free_inode(struct inode * inode)
{
	struct super_block *sb = inode->i_sb;
	struct minix_sb_info *sbi = minix_sb(inode->i_sb);
	struct buffer_head *bh;
	int k = sb->s_blocksize_bits + 3;
	unsigned long ino, bit;

	ino = inode->i_ino;
	if (ino < 1 || ino > sbi->s_ninodes) {
		printk("minix_free_inode: inode 0 or nonexistent inode\n");
		return;
	}
	bit = ino & ((1<<k) - 1);
	ino >>= k;
	if (ino >= sbi->s_imap_blocks) {
		printk("minix_free_inode: nonexistent imap in superblock\n");
		return;
	}

	minix_clear_inode(inode);	/*                    */

	bh = sbi->s_imap[ino];
	spin_lock(&bitmap_lock);
	if (!minix_test_and_clear_bit(bit, bh->b_data))
		printk("minix_free_inode: bit %lu already cleared\n", bit);
	spin_unlock(&bitmap_lock);
	mark_buffer_dirty(bh);
}
Пример #3
0
void minix_free_inode(struct inode * inode)
{
	struct super_block *sb = inode->i_sb;
	struct minix_sb_info *sbi = minix_sb(inode->i_sb);
	struct buffer_head *bh;
	int k = sb->s_blocksize_bits + 3;
	unsigned long ino, bit;

	ino = inode->i_ino;
	if (ino < 1 || ino > sbi->s_ninodes) {
;
		return;
	}
	bit = ino & ((1<<k) - 1);
	ino >>= k;
	if (ino >= sbi->s_imap_blocks) {
;
		return;
	}

	minix_clear_inode(inode);	/* clear on-disk copy */

	bh = sbi->s_imap[ino];
	spin_lock(&bitmap_lock);
	if (!minix_test_and_clear_bit(bit, bh->b_data))
;
	spin_unlock(&bitmap_lock);
	mark_buffer_dirty(bh);
}
Пример #4
0
void minix_free_inode(struct minix_inode_info *inode) {
    struct minix_sb_info *sbi = inode->i_sb;
    u8 *ib;
    unsigned int k = BLOCK_SHIFT + 3;
    unsigned long inr,bit;

    inr = inode->i_inr;
    if(inr < 1 || inr > sbi->s_ninodes) {
        mfs_err("inode 0 or nonexistent inode.\n");
        return;
    }
    bit = inr & ((1 << k) - 1);
    inr >>= k;
    if(inr >= sbi->s_imap_blocks) {
        mfs_err("nonexistenet imap in superblock.\n");
        return;
    }
    minix_clear_inode(inode);
    ib = sbi->s_imap[inr];
    lock();
    if(!minix_test_and_clear_bit(bit,ib))
            mfs_err("bit %lu already cleared.\n",bit);
    unlock();
}
Пример #5
0
void minix_free_block(struct minix_inode_info *inode,unsigned long block) {
    struct minix_sb_info *sbi = inode->i_sb;
    u8 *ib;
    int k = BLOCK_SHIFT + 3;
    unsigned long bit,zone;

    if(block < sbi->s_firstdatazone || block >= sbi->s_nzones) {
        mfs_err("Trying to free block not in datazone.\n");
        return ;
    }
    zone = block - sbi->s_firstdatazone + 1;
    bit = zone & ((1 << k) - 1);
    zone >>= k;
    if(zone >= sbi->s_zmap_blocks) {
        mfs_err("nonexistent bitmap buffer.\n");
        return ;
    }
    ib = sbi->s_zmap[zone];
    lock();
    if(!minix_test_and_clear_bit(bit,ib))
        mfs_err("(%d): bit already cleared.\n",block);
    unlock();
    //mark_buffer_dirty(ib);
}