* - The dirinfo directory information cache.
*/
+#include "config.h"
#ifdef HAVE_ERRNO_H
#include <errno.h>
#endif
/*
* Allocate some bitmaps to do loop detection.
*/
- pctx.errcode = ext2fs_allocate_inode_bitmap(fs, _("inode done bitmap"),
- &inode_done_map);
+ pctx.errcode = e2fsck_allocate_inode_bitmap(fs, _("inode done bitmap"),
+ EXT2FS_BMAP64_AUTODIR,
+ "inode_done_map", &inode_done_map);
if (pctx.errcode) {
pctx.num = 2;
fix_problem(ctx, PR_3_ALLOCATE_IBITMAP_ERROR, &pctx);
return;
}
- pctx.errcode = ext2fs_write_dir_block(fs, blk, block);
+ pctx.errcode = ext2fs_write_dir_block4(fs, blk, block, 0,
+ EXT2_ROOT_INO);
if (pctx.errcode) {
pctx.str = "ext2fs_write_dir_block";
fix_problem(ctx, PR_3_CREATE_ROOT_ERROR, &pctx);
if (inode_loop_detect)
ext2fs_clear_inode_bitmap(inode_loop_detect);
else {
- pctx->errcode = ext2fs_allocate_inode_bitmap(fs, _("inode loop detection bitmap"), &inode_loop_detect);
+ pctx->errcode = e2fsck_allocate_inode_bitmap(fs, _("inode loop detection bitmap"), EXT2FS_BMAP64_AUTODIR, "inode_loop_detect", &inode_loop_detect);
if (pctx->errcode) {
pctx->num = 1;
fix_problem(ctx,
if (retval && !fix)
return 0;
if (!retval) {
- if (ext2fs_test_inode_bitmap2(ctx->inode_dir_map, ino)) {
+ if (ext2fs_check_directory(fs, ino) == 0) {
ctx->lost_and_found = ino;
return ino;
}
return 0;
}
ext2fs_mark_block_bitmap2(ctx->block_found_map, blk);
- ext2fs_block_alloc_stats(fs, blk, +1);
+ ext2fs_block_alloc_stats2(fs, blk, +1);
/*
* Next find a free inode.
return 0;
}
- retval = ext2fs_write_dir_block(fs, blk, block);
+ retval = ext2fs_write_dir_block4(fs, blk, block, 0, ino);
ext2fs_free_mem(&block);
if (retval) {
pctx.errcode = retval;
ext2fs_icount_store(ctx->inode_count, ino, 2);
ext2fs_icount_store(ctx->inode_link_info, ino, 2);
ctx->lost_and_found = ino;
+ quota_data_add(ctx->qctx, &inode, ino, fs->blocksize);
+ quota_data_inodes(ctx->qctx, &inode, ino, +1);
#if 0
printf("/lost+found created; inode #%lu\n", ino);
#endif
clear_problem_context(&pctx);
pctx.ino = ino;
+ if (e2fsck_dir_will_be_rehashed(ctx, ino))
+ ctx->fs->flags |= EXT2_FLAG_IGNORE_CSUM_ERRORS;
retval = ext2fs_dir_iterate(fs, ino, DIRENT_FLAG_INCLUDE_EMPTY,
0, fix_dotdot_proc, &fp);
+ if (e2fsck_dir_will_be_rehashed(ctx, ino))
+ ctx->fs->flags &= ~EXT2_FLAG_IGNORE_CSUM_ERRORS;
if (retval || !fp.done) {
pctx.errcode = retval;
fix_problem(ctx, retval ? PR_3_FIX_PARENT_ERR :
*/
struct expand_dir_struct {
- int num;
- int guaranteed_size;
- int newblocks;
- int last_block;
+ blk64_t num;
+ e2_blkcnt_t guaranteed_size;
+ blk64_t newblocks;
+ blk64_t last_block;
errcode_t err;
e2fsck_t ctx;
+ ext2_ino_t dir;
};
static int expand_dir_proc(ext2_filsys fs,
- blk_t *blocknr,
+ blk64_t *blocknr,
e2_blkcnt_t blockcnt,
- blk_t ref_block EXT2FS_ATTR((unused)),
+ blk64_t ref_block EXT2FS_ATTR((unused)),
int ref_offset EXT2FS_ATTR((unused)),
void *priv_data)
{
struct expand_dir_struct *es = (struct expand_dir_struct *) priv_data;
blk64_t new_blk;
- static blk_t last_blk = 0;
+ static blk64_t last_blk = 0;
char *block;
errcode_t retval;
e2fsck_t ctx;
return BLOCK_ABORT;
}
es->num--;
- retval = ext2fs_write_dir_block(fs, new_blk, block);
+ retval = ext2fs_write_dir_block4(fs, new_blk, block, 0,
+ es->dir);
} else {
retval = ext2fs_get_mem(fs->blocksize, &block);
if (retval) {
ext2fs_free_mem(&block);
*blocknr = new_blk;
ext2fs_mark_block_bitmap2(ctx->block_found_map, new_blk);
- ext2fs_block_alloc_stats(fs, new_blk, +1);
+ ext2fs_block_alloc_stats2(fs, new_blk, +1);
es->newblocks++;
if (es->num == 0)
es.err = 0;
es.newblocks = 0;
es.ctx = ctx;
+ es.dir = dir;
- retval = ext2fs_block_iterate2(fs, dir, BLOCK_FLAG_APPEND,
+ retval = ext2fs_block_iterate3(fs, dir, BLOCK_FLAG_APPEND,
0, expand_dir_proc, &es);
if (es.err)
inode.i_size = (es.last_block + 1) * fs->blocksize;
ext2fs_iblk_add_blocks(fs, &inode, es.newblocks);
+ quota_data_add(ctx->qctx, &inode, dir, es.newblocks * fs->blocksize);
e2fsck_write_inode(ctx, dir, &inode, "expand_directory");