ext2fs_inode_data_blocks2@Base 1.41.99
ext2fs_inode_data_blocks@Base 1.37
ext2fs_inode_has_valid_blocks@Base 1.37
+ ext2fs_inode_has_valid_blocks2@Base 1.41.99
ext2fs_inode_i_blocks@Base 1.41.99
ext2fs_inode_io_intern2@Base 1.37
ext2fs_inode_io_intern@Base 1.37
inode_buf.i_dtime = current_fs->now ? current_fs->now : time(0);
if (debugfs_write_inode(inode, &inode_buf, 0))
return;
- if (!ext2fs_inode_has_valid_blocks(&inode_buf))
+ if (!ext2fs_inode_has_valid_blocks2(current_fs, &inode_buf))
return;
ext2fs_block_iterate3(current_fs, inode, BLOCK_FLAG_READ_ONLY, NULL,
bw.inode = ino;
- blk = ext2fs_file_acl_block(&inode);
+ blk = ext2fs_file_acl_block(current_fs, &inode);
if (blk) {
icheck_proc(current_fs, &blk, 0,
0, 0, &bw);
if (bw.blocks_left == 0)
break;
- ext2fs_file_acl_block_set(&inode, blk);
+ ext2fs_file_acl_block_set(current_fs, &inode, blk);
}
- if (!ext2fs_inode_has_valid_blocks(&inode))
+ if (!ext2fs_inode_has_valid_blocks2(current_fs, &inode))
goto next;
/*
* To handle filesystems touched by 0.3c extfs; can be
printf("%u", inode->i_faddr);
break;
case 'f':
- printf("%llu", ext2fs_file_acl_block(inode));
+ printf("%llu", ext2fs_file_acl_block(fs, inode));
break;
case 'd':
printf("%u", (LINUX_S_ISDIR(inode->i_mode) ?
check_is_really_dir(ctx, &pctx, block_buf);
/*
- * ext2fs_inode_has_valid_blocks does not actually look
+ * ext2fs_inode_has_valid_blocks2 does not actually look
* at i_block[] values, so not endian-sensitive here.
*/
if (extent_fs && (inode->i_flags & EXT4_EXTENTS_FL) &&
LINUX_S_ISLNK(inode->i_mode) &&
- !ext2fs_inode_has_valid_blocks(inode) &&
+ !ext2fs_inode_has_valid_blocks2(fs, inode) &&
fix_problem(ctx, PR_1_FAST_SYMLINK_EXTENT_FL, &pctx)) {
inode->i_flags &= ~EXT4_EXTENTS_FL;
e2fsck_write_inode(ctx, ino, inode, "pass1");
(inode->i_block[EXT2_IND_BLOCK] ||
inode->i_block[EXT2_DIND_BLOCK] ||
inode->i_block[EXT2_TIND_BLOCK] ||
- ext2fs_file_acl_block(inode))) {
+ ext2fs_file_acl_block(fs, inode))) {
inodes_to_process[process_inode_count].ino = ino;
inodes_to_process[process_inode_count].inode = *inode;
process_inode_count++;
ret = (ib_a->inode.i_block[EXT2_IND_BLOCK] -
ib_b->inode.i_block[EXT2_IND_BLOCK]);
if (ret == 0)
- ret = ext2fs_file_acl_block(&(ib_a->inode)) -
- ext2fs_file_acl_block(&ib_b->inode);
+ /*
+ * We only call process_inodes() for non-extent
+ * inodes, so it's OK to pass NULL to
+ * ext2fs_file_acl_block() here.
+ */
+ ret = ext2fs_file_acl_block(0, &(ib_a->inode)) -
+ ext2fs_file_acl_block(0, &(ib_b->inode));
if (ret == 0)
ret = ib_a->ino - ib_b->ino;
return ret;
int count;
region_t region = 0;
- blk = ext2fs_file_acl_block(inode);
+ blk = ext2fs_file_acl_block(fs, inode);
if (blk == 0)
return 0;
if (pctx->errcode && fix_problem(ctx, PR_1_READ_EA_BLOCK, pctx))
goto clear_extattr;
header = (struct ext2_ext_attr_header *) block_buf;
- pctx->blk = ext2fs_file_acl_block(inode);
+ pctx->blk = ext2fs_file_acl_block(fs, inode);
if (((ctx->ext_attr_ver == 1) &&
(header->h_magic != EXT2_EXT_ATTR_MAGIC_v1)) ||
((ctx->ext_attr_ver == 2) &&
clear_extattr:
if (region)
region_free(region);
- ext2fs_file_acl_block_set(inode, 0);
+ ext2fs_file_acl_block_set(fs, inode, 0);
e2fsck_write_inode(ctx, ino, inode, "check_ext_attr");
return 0;
}
}
}
- if (ext2fs_file_acl_block(inode) &&
+ if (ext2fs_file_acl_block(fs, inode) &&
check_ext_attr(ctx, pctx, block_buf)) {
if (ctx->flags & E2F_FLAG_SIGNAL_MASK)
goto out;
pb.num_blocks++;
}
- if (ext2fs_inode_has_valid_blocks(inode)) {
+ if (ext2fs_inode_has_valid_blocks2(fs, inode)) {
if (extent_fs && (inode->i_flags & EXT4_EXTENTS_FL))
check_blocks_extents(ctx, pctx, &pb);
else
pb.dup_blocks = 0;
pb.inode = &inode;
- if (ext2fs_inode_has_valid_blocks(&inode) ||
+ if (ext2fs_inode_has_valid_blocks2(fs, &inode) ||
(ino == EXT2_BAD_INO))
pctx.errcode = ext2fs_block_iterate3(fs, ino,
BLOCK_FLAG_READ_ONLY, block_buf,
process_pass1b_block, &pb);
/* If the feature is not set, attrs will be cleared later anyway */
if ((fs->super->s_feature_compat & EXT2_FEATURE_COMPAT_EXT_ATTR) &&
- ext2fs_file_acl_block(&inode)) {
- blk64_t blk = ext2fs_file_acl_block(&inode);
+ ext2fs_file_acl_block(fs, &inode)) {
+ blk64_t blk = ext2fs_file_acl_block(fs, &inode);
process_pass1b_block(fs, &blk,
BLOCK_COUNT_EXTATTR, 0, 0, &pb);
- ext2fs_file_acl_block_set(&inode, blk);
+ ext2fs_file_acl_block_set(fs, &inode, blk);
}
if (pb.dup_blocks) {
end_problem_latch(ctx, PR_LATCH_DBLOCK);
pctx.str = "delete_file";
e2fsck_read_inode(ctx, ino, &inode, "delete_file");
- if (ext2fs_inode_has_valid_blocks(&inode))
+ if (ext2fs_inode_has_valid_blocks2(fs, &inode))
pctx.errcode = ext2fs_block_iterate3(fs, ino, BLOCK_FLAG_READ_ONLY,
block_buf, delete_file_block, &pb);
if (pctx.errcode)
/* Inode may have changed by block_iterate, so reread it */
e2fsck_read_inode(ctx, ino, &inode, "delete_file");
e2fsck_clear_inode(ctx, ino, &inode, 0, "delete_file");
- if (ext2fs_file_acl_block(&inode) &&
+ if (ext2fs_file_acl_block(fs, &inode) &&
(fs->super->s_feature_compat & EXT2_FEATURE_COMPAT_EXT_ATTR)) {
count = 1;
pctx.errcode = ext2fs_adjust_ea_refcount2(fs,
- ext2fs_file_acl_block(&inode),
+ ext2fs_file_acl_block(fs, &inode),
block_buf, -1, &count);
if (pctx.errcode == EXT2_ET_BAD_EA_BLOCK_NUM) {
pctx.errcode = 0;
count = 1;
}
if (pctx.errcode) {
- pctx.blk = ext2fs_file_acl_block(&inode);
+ pctx.blk = ext2fs_file_acl_block(fs, &inode);
fix_problem(ctx, PR_1B_ADJ_EA_REFCOUNT, &pctx);
}
/*
*/
if ((count == 0) ||
ext2fs_test_block_bitmap2(ctx->block_dup_map,
- ext2fs_file_acl_block(&inode))) {
- blk64_t blk = ext2fs_file_acl_block(&inode);
+ ext2fs_file_acl_block(fs, &inode))) {
+ blk64_t blk = ext2fs_file_acl_block(fs, &inode);
delete_file_block(fs, &blk,
BLOCK_COUNT_EXTATTR, 0, 0, &pb);
- ext2fs_file_acl_block_set(&inode, blk);
+ ext2fs_file_acl_block_set(fs, &inode, blk);
quota_data_sub(ctx->qctx, &inode, ino, fs->blocksize);
}
}
pctx.ino = ino;
pctx.str = "clone_file";
- if (ext2fs_inode_has_valid_blocks(&dp->inode))
+ if (ext2fs_inode_has_valid_blocks2(fs, &dp->inode))
pctx.errcode = ext2fs_block_iterate3(fs, ino, 0, block_buf,
clone_file_block, &cs);
ext2fs_mark_bb_dirty(fs);
}
/* The inode may have changed on disk, so we have to re-read it */
e2fsck_read_inode(ctx, ino, &dp->inode, "clone file EA");
- blk = ext2fs_file_acl_block(&dp->inode);
+ blk = ext2fs_file_acl_block(fs, &dp->inode);
new_blk = blk;
if (blk && (clone_file_block(fs, &new_blk,
BLOCK_COUNT_EXTATTR, 0, 0, &cs) ==
BLOCK_CHANGED)) {
- ext2fs_file_acl_block_set(&dp->inode, new_blk);
+ ext2fs_file_acl_block_set(fs, &dp->inode, new_blk);
e2fsck_write_inode(ctx, ino, &dp->inode, "clone file EA");
/*
* If we cloned the EA block, find all other inodes
goto errout;
}
di = (struct dup_inode *) dnode_get(n);
- if (ext2fs_file_acl_block(&di->inode) == blk) {
- ext2fs_file_acl_block_set(&di->inode,
- ext2fs_file_acl_block(&dp->inode));
+ if (ext2fs_file_acl_block(fs, &di->inode) == blk) {
+ ext2fs_file_acl_block_set(fs, &di->inode,
+ ext2fs_file_acl_block(fs, &dp->inode));
e2fsck_write_inode(ctx, ino_el->inode,
&di->inode, "clone file EA");
decrement_badcount(ctx, blk, dc);
e2fsck_read_bitmaps(ctx);
ext2fs_inode_alloc_stats2(fs, ino, -1, LINUX_S_ISDIR(inode.i_mode));
- if (ext2fs_file_acl_block(&inode) &&
+ if (ext2fs_file_acl_block(fs, &inode) &&
(fs->super->s_feature_compat & EXT2_FEATURE_COMPAT_EXT_ATTR)) {
- pctx.errcode = ext2fs_adjust_ea_refcount2(fs, ext2fs_file_acl_block(&inode),
- block_buf, -1, &count);
+ pctx.errcode = ext2fs_adjust_ea_refcount2(fs,
+ ext2fs_file_acl_block(fs, &inode),
+ block_buf, -1, &count);
if (pctx.errcode == EXT2_ET_BAD_EA_BLOCK_NUM) {
pctx.errcode = 0;
count = 1;
}
if (pctx.errcode) {
- pctx.blk = ext2fs_file_acl_block(&inode);
+ pctx.blk = ext2fs_file_acl_block(fs, &inode);
fix_problem(ctx, PR_2_ADJ_EA_REFCOUNT, &pctx);
ctx->flags |= E2F_FLAG_ABORT;
return;
}
if (count == 0) {
ext2fs_unmark_block_bitmap2(ctx->block_found_map,
- ext2fs_file_acl_block(&inode));
+ ext2fs_file_acl_block(fs, &inode));
ext2fs_block_alloc_stats2(fs,
- ext2fs_file_acl_block(&inode),
- -1);
+ ext2fs_file_acl_block(fs, &inode), -1);
}
- ext2fs_file_acl_block_set(&inode, 0);
+ ext2fs_file_acl_block_set(fs, &inode, 0);
}
- if (!ext2fs_inode_has_valid_blocks(&inode))
+ if (!ext2fs_inode_has_valid_blocks2(fs, &inode))
return;
if (LINUX_S_ISREG(inode.i_mode) && EXT2_I_SIZE(&inode) >= 0x80000000UL)
pctx.dir = dir;
pctx.inode = &inode;
- if (ext2fs_file_acl_block(&inode) &&
+ if (ext2fs_file_acl_block(fs, &inode) &&
!(fs->super->s_feature_compat & EXT2_FEATURE_COMPAT_EXT_ATTR)) {
if (fix_problem(ctx, PR_2_FILE_ACL_ZERO, &pctx)) {
- ext2fs_file_acl_block_set(&inode, 0);
+ ext2fs_file_acl_block_set(fs, &inode, 0);
inode_modified++;
} else
not_fixed++;
not_fixed++;
}
- if (ext2fs_file_acl_block(&inode) &&
- ((ext2fs_file_acl_block(&inode) < fs->super->s_first_data_block) ||
- (ext2fs_file_acl_block(&inode) >= ext2fs_blocks_count(fs->super)))) {
+ if (ext2fs_file_acl_block(fs, &inode) &&
+ ((ext2fs_file_acl_block(fs, &inode) < fs->super->s_first_data_block) ||
+ (ext2fs_file_acl_block(fs, &inode) >= ext2fs_blocks_count(fs->super)))) {
if (fix_problem(ctx, PR_2_FILE_ACL_BAD, &pctx)) {
- ext2fs_file_acl_block_set(&inode, 0);
+ ext2fs_file_acl_block_set(fs, &inode, 0);
inode_modified++;
} else
not_fixed++;
errcode_t retval;
__u32 count;
- if (!ext2fs_inode_has_valid_blocks(inode))
+ if (!ext2fs_inode_has_valid_blocks2(fs, inode))
return 0;
pb.buf = block_buf + 3 * ctx->fs->blocksize;
if (pb.truncated_blocks)
ext2fs_iblk_sub_blocks(fs, inode, pb.truncated_blocks);
- if (ext2fs_file_acl_block(inode)) {
- retval = ext2fs_adjust_ea_refcount2(fs, ext2fs_file_acl_block(inode),
- block_buf, -1, &count);
+ if (ext2fs_file_acl_block(fs, inode)) {
+ retval = ext2fs_adjust_ea_refcount2(fs,
+ ext2fs_file_acl_block(fs, inode),
+ block_buf, -1, &count);
if (retval == EXT2_ET_BAD_EA_BLOCK_NUM) {
retval = 0;
count = 1;
}
if (count == 0)
ext2fs_block_alloc_stats2(fs,
- ext2fs_file_acl_block(inode),
- -1);
- ext2fs_file_acl_block_set(inode, 0);
+ ext2fs_file_acl_block(fs, inode), -1);
+ ext2fs_file_acl_block_set(fs, inode, 0);
}
return 0;
}
/*
* Get the acl block of a file
- *
- * XXX Ignoring 64-bit file system flag - most places where this is
- * called don't have access to the fs struct, and the high bits should
- * be 0 in the non-64-bit case anyway.
*/
-blk64_t ext2fs_file_acl_block(const struct ext2_inode *inode)
+blk64_t ext2fs_file_acl_block(ext2_filsys fs, const struct ext2_inode *inode)
{
- return (inode->i_file_acl |
- (__u64) inode->osd2.linux2.l_i_file_acl_high << 32);
+ blk64_t blk = inode->i_file_acl;
+
+ if (fs && fs->super->s_feature_incompat & EXT4_FEATURE_INCOMPAT_64BIT)
+ blk |= ((__u64) inode->osd2.linux2.l_i_file_acl_high) << 32;
+ return blk;
}
/*
* Set the acl block of a file
*/
-void ext2fs_file_acl_block_set(struct ext2_inode *inode, blk64_t blk)
+void ext2fs_file_acl_block_set(ext2_filsys fs, struct ext2_inode *inode,
+ blk64_t blk)
{
inode->i_file_acl = blk;
- inode->osd2.linux2.l_i_file_acl_high = (__u64) blk >> 32;
+ if (fs && fs->super->s_feature_incompat & EXT4_FEATURE_INCOMPAT_64BIT)
+ inode->osd2.linux2.l_i_file_acl_high = (__u64) blk >> 32;
}
while (ino) {
if ((inode.i_links_count == 0) ||
- !ext2fs_inode_has_valid_blocks(&inode))
+ !ext2fs_inode_has_valid_blocks2(fs, &inode))
goto next;
pb.ino = ino;
extern void ext2fs_bg_flags_clear(ext2_filsys fs, dgrp_t group, __u16 bg_flags);
extern __u16 ext2fs_bg_checksum(ext2_filsys fs, dgrp_t group);
extern void ext2fs_bg_checksum_set(ext2_filsys fs, dgrp_t group, __u16 checksum);
-extern blk64_t ext2fs_file_acl_block(const struct ext2_inode *inode);
-extern void ext2fs_file_acl_block_set(struct ext2_inode *inode, blk64_t blk);
+extern blk64_t ext2fs_file_acl_block(ext2_filsys fs,
+ const struct ext2_inode *inode);
+extern void ext2fs_file_acl_block_set(ext2_filsys fs,
+ struct ext2_inode *inode, blk64_t blk);
/* block.c */
extern errcode_t ext2fs_block_iterate(ext2_filsys fs,
/* valid_blk.c */
extern int ext2fs_inode_has_valid_blocks(struct ext2_inode *inode);
+extern int ext2fs_inode_has_valid_blocks2(ext2_filsys fs,
+ struct ext2_inode *inode);
/* version.c */
extern int ext2fs_parse_version_string(const char *ver_string);
* This function returns 1 if the inode's block entries actually
* contain block entries.
*/
-int ext2fs_inode_has_valid_blocks(struct ext2_inode *inode)
+int ext2fs_inode_has_valid_blocks2(ext2_filsys fs, struct ext2_inode *inode)
{
/*
* Only directories, regular files, and some symbolic links
* target is stored in the block entries.
*/
if (LINUX_S_ISLNK (inode->i_mode)) {
- if (ext2fs_file_acl_block(inode) == 0) {
+ if (ext2fs_file_acl_block(fs, inode) == 0) {
/* With no EA block, we can rely on i_blocks */
if (inode->i_blocks == 0)
return 0;
}
return 1;
}
+
+int ext2fs_inode_has_valid_blocks(struct ext2_inode *inode)
+{
+ return ext2fs_inode_has_valid_blocks2(NULL, inode);
+}
return;
inode.i_dtime = fs->now ? fs->now : time(0);
- if (!ext2fs_inode_has_valid_blocks(&inode))
+ if (!ext2fs_inode_has_valid_blocks2(fs, &inode))
return;
ext2fs_block_iterate3(fs, ino, BLOCK_FLAG_READ_ONLY, NULL,
break;
if (!inode.i_links_count)
continue;
- if (ext2fs_file_acl_block(&inode)) {
+ if (ext2fs_file_acl_block(fs, &inode)) {
ext2fs_mark_block_bitmap2(meta_block_map,
- ext2fs_file_acl_block(&inode));
+ ext2fs_file_acl_block(fs, &inode));
meta_blocks_count++;
}
- if (!ext2fs_inode_has_valid_blocks(&inode))
+ if (!ext2fs_inode_has_valid_blocks2(fs, &inode))
continue;
stashed_ino = ino;
pb.is_dir = LINUX_S_ISDIR(inode.i_mode);
if (LINUX_S_ISDIR(inode.i_mode) ||
(LINUX_S_ISLNK(inode.i_mode) &&
- ext2fs_inode_has_valid_blocks(&inode)) ||
+ ext2fs_inode_has_valid_blocks2(fs, &inode)) ||
ino == fs->super->s_journal_inum) {
retval = ext2fs_block_iterate3(fs, ino,
BLOCK_FLAG_READ_ONLY, block_buf,
* Do we need to fix this ??
*/
- if (ext2fs_file_acl_block(&inode) &&
+ if (ext2fs_file_acl_block(fs, &inode) &&
ext2fs_test_block_bitmap2(bmap,
- ext2fs_file_acl_block(&inode))) {
- blk = translate_block(ext2fs_file_acl_block(&inode));
+ ext2fs_file_acl_block(fs, &inode))) {
+ blk = translate_block(ext2fs_file_acl_block(fs,
+ &inode));
if (!blk)
continue;
- ext2fs_file_acl_block_set(&inode, blk);
+ ext2fs_file_acl_block_set(fs, &inode, blk);
/*
* Write the inode to disk so that inode table
goto err_out;
}
- if (!ext2fs_inode_has_valid_blocks(&inode))
+ if (!ext2fs_inode_has_valid_blocks2(fs, &inode))
continue;
retval = ext2fs_block_iterate3(fs, ino, 0, block_buf,
pb.is_dir = LINUX_S_ISDIR(inode->i_mode);
pb.changed = 0;
- if (ext2fs_file_acl_block(inode) && rfs->bmap) {
+ if (ext2fs_file_acl_block(rfs->old_fs, inode) && rfs->bmap) {
new_block = ext2fs_extent_translate(rfs->bmap,
- ext2fs_file_acl_block(inode));
+ ext2fs_file_acl_block(rfs->old_fs, inode));
if (new_block) {
- ext2fs_file_acl_block_set(inode, new_block);
+ ext2fs_file_acl_block_set(rfs->old_fs, inode,
+ new_block);
retval = ext2fs_write_inode_full(rfs->old_fs,
ino, inode, inode_size);
if (retval) goto errout;
}
}
- if (ext2fs_inode_has_valid_blocks(inode) &&
+ if (ext2fs_inode_has_valid_blocks2(rfs->old_fs, inode) &&
(rfs->bmap || pb.is_dir)) {
pb.ino = ino;
retval = ext2fs_block_iterate3(rfs->old_fs,
Pass 4: Checking reference counts
Inode 2 ref count is 4, should be 3. Fix? yes
-i_file_acl for inode 13 (...) is 239964041625745, should be zero.
+i_file_acl for inode 13 (...) is 4218798225, should be zero.
Clear? yes
Inode 13 (...) has invalid mode (0117003).
Clear? yes
-i_file_acl for inode 14 (...) is 178759431711162, should be zero.
+i_file_acl for inode 14 (...) is 2892851642, should be zero.
Clear? yes
Inode 14 (...) has invalid mode (0154247).