if (bi->i_dsk_ino) { if (bi->i_sblock)
info->si_freeb += bi->i_eblock + 1 - bi->i_sblock;
info->si_freei++;
clear_bit(ino, info->si_imap);
bfs_dump_imap("evict_inode", s);
}
/* * If this was the last file, make the previous block * "last block of the last file" even if there is no * real file there, saves us 1 gap.
*/ if (info->si_lf_eblk == bi->i_eblock)
info->si_lf_eblk = bi->i_sblock - 1;
mutex_unlock(&info->bfs_lock);
}
staticvoid destroy_inodecache(void)
{ /* * Make sure all delayed rcu free inodes are flushed before we * destroy cache.
*/
rcu_barrier();
kmem_cache_destroy(bfs_inode_cachep);
}
info = kzalloc(sizeof(*info), GFP_KERNEL); if (!info) return -ENOMEM;
mutex_init(&info->bfs_lock);
s->s_fs_info = info;
s->s_time_min = 0;
s->s_time_max = U32_MAX;
sb_set_blocksize(s, BFS_BSIZE);
sbh = sb_bread(s, 0); if (!sbh) goto out;
bfs_sb = (struct bfs_super_block *)sbh->b_data; if (le32_to_cpu(bfs_sb->s_magic) != BFS_MAGIC) { if (!silent)
printf("No BFS filesystem on %s (magic=%08x)\n", s->s_id, le32_to_cpu(bfs_sb->s_magic)); goto out1;
} if (BFS_UNCLEAN(bfs_sb, s) && !silent)
printf("%s is unclean, continuing\n", s->s_id);
s->s_magic = BFS_MAGIC;
if (le32_to_cpu(bfs_sb->s_start) > le32_to_cpu(bfs_sb->s_end) ||
le32_to_cpu(bfs_sb->s_start) < sizeof(struct bfs_super_block) + sizeof(struct bfs_dirent)) {
printf("Superblock is corrupted on %s\n", s->s_id); goto out1;
}
info->si_lasti = (le32_to_cpu(bfs_sb->s_start) - BFS_BSIZE) / sizeof(struct bfs_inode) + BFS_ROOT_INO - 1; if (info->si_lasti == BFS_MAX_LASTI)
printf("NOTE: filesystem %s was created with 512 inodes, the real maximum is 511, mounting anyway\n", s->s_id); elseif (info->si_lasti > BFS_MAX_LASTI) {
printf("Impossible last inode number %lu > %d on %s\n", info->si_lasti, BFS_MAX_LASTI, s->s_id); goto out1;
} for (i = 0; i < BFS_ROOT_INO; i++)
set_bit(i, info->si_imap);
s->s_op = &bfs_sops;
inode = bfs_iget(s, BFS_ROOT_INO); if (IS_ERR(inode)) {
ret = PTR_ERR(inode); goto out1;
}
s->s_root = d_make_root(inode); if (!s->s_root) {
ret = -ENOMEM; goto out1;
}
/* can we read the last block? */
bh = sb_bread(s, info->si_blocks - 1); if (!bh) {
printf("Last block not available on %s: %lu\n", s->s_id, info->si_blocks - 1);
ret = -EIO; goto out2;
}
brelse(bh);
bh = NULL; for (i = BFS_ROOT_INO; i <= info->si_lasti; i++) { struct bfs_inode *di; int block = (i - BFS_ROOT_INO) / BFS_INODES_PER_BLOCK + 1; int off = (i - BFS_ROOT_INO) % BFS_INODES_PER_BLOCK; unsignedlong eblock;
if (!off) {
brelse(bh);
bh = sb_bread(s, block);
}
¤ Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.0.2Bemerkung:
(vorverarbeitet am 2026-06-05)
¤
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.