mirror of https://github.com/vitalif/e2fsprogs
ext2fs: Optimize extending an extent-mapped file using ext2fs_block_iterate2()
When ext2fs_block_iterate2() is called on an extent-mapped file with a depth > 1, it will erroneously calling the callback function starting all over again with an offset of logical block 0. It shouldn't do this, and it cases mke2fs to become very slow when creating files with very large journals. Fix this. Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>bitmap-optimize
parent
4ffafee26c
commit
8e2399d57a
|
@ -379,6 +379,7 @@ errcode_t ext2fs_block_iterate2(ext2_filsys fs,
|
||||||
ctx.errcode = 0;
|
ctx.errcode = 0;
|
||||||
if (!(flags & BLOCK_FLAG_APPEND))
|
if (!(flags & BLOCK_FLAG_APPEND))
|
||||||
break;
|
break;
|
||||||
|
next_block_set:
|
||||||
blk = 0;
|
blk = 0;
|
||||||
r = (*ctx.func)(fs, &blk, blockcnt,
|
r = (*ctx.func)(fs, &blk, blockcnt,
|
||||||
0, 0, priv_data);
|
0, 0, priv_data);
|
||||||
|
@ -392,7 +393,8 @@ errcode_t ext2fs_block_iterate2(ext2_filsys fs,
|
||||||
(blk64_t) blk, 0);
|
(blk64_t) blk, 0);
|
||||||
if (ctx.errcode || (ret & BLOCK_ABORT))
|
if (ctx.errcode || (ret & BLOCK_ABORT))
|
||||||
break;
|
break;
|
||||||
continue;
|
if (blk)
|
||||||
|
goto next_block_set;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue