Re: [RFC][E2FSPROGS][PATCH 5/8]
Andreas Dilger <[email protected]>
| Newsgroups | gmane.comp.file-systems.ext2.devel |
|---|---|
| Message-ID | <[email protected]> |
On May 24, 2006 16:40 +0200, Alexandre Ratchov wrote:
> Partial support of extents. Allows to run e2fsck and debug2fs on
> file-systems with extents. debug2fs allows to use "cat" and "stat" on
> files with extents. e2fsck allows to fsck a file-system with extents
> but cannot repair it.
There are a couple of items missing here from our current patches.
I'd post an updated patch set, but our patches are intermingled with
other changes so hard to extract easily.
> +++ e2fsprogs-upstream/lib/ext2fs/block.c 2006-05-19 14:56:10.000000000 +0200
> +static int block_iterate_extents(struct ext3_extent_header *eh, ext2_filsys fs,
> + struct block_context *ctx)
> +{
> + if(eh->eh_depth == 0) {
> + show_extent(eh);
> + ex = EXT_FIRST_EXTENT(eh);
> + for (i = 0; i < eh->eh_entries; i++, ex++) {
> + for(j=0; j< ex->ee_len; j++) {
> + block_address = ex->ee_start + j;
> + ret = (*ctx->func)(ctx->fs, &block_address,
> + (ex->ee_block + j), 0,
> + i, ctx->priv_data);
if (ret & BLOCK_ABORT)
return ret;
> + }
> + }
> + } else {
> + show_index(eh);
> + ret = ext2fs_get_mem(fs->blocksize, &block_buf);
> + if (ret)
> + return ret;
> + ix = EXT_FIRST_INDEX(eh);
> + for (i = 0; i < eh->eh_entries; i++, ix++) {
> + block_address = ix->ei_leaf;
if (!(ctx->flags & BLOCK_FLAG_DEPTH_TRAVERSE) &&
!(ctx->flags & BLOCK_FLAG_DATA_ONLY)) {
> + ret = (*ctx->func)(ctx->fs, &block_address,
> + BLOCK_COUNT_IND, 0, i, ctx->priv_data);
> + if (ret & BLOCK_ABORT) {
> + ext2fs_free_mem(&block_buf);
> + return ret;
> + }
}
> @@ -155,6 +200,15 @@
> return retval;
> inode = &inode_buf;
> }
> +
> + if (inode->i_flags & EXT3_EXTENTS_FL) {
> + eh = (struct ext3_extent_header *)&inode->i_block[0];
> + if (eh->eh_magic == EXT3_EXT_MAGIC)
> + return block_extents_bmap(eh, fs, block, phys_blk);
> + else
> + return BLOCK_ERROR;
> + }
> +
> addr_per_block = (blk_t) fs->blocksize >> 2;
>
> if (!block_buf) {
Shouldn't the call to block_extents_bmap() happen after "block_buf" is
allocated, and you can use this internal to block_extents_bmap()?
> +++ e2fsprogs-upstream/lib/ext2fs/mkdir.c 2006-05-19 14:56:10.000000000 +0200
> + if (fs->super->s_feature_ro_compat & EXT2_FEATURE_RO_COMPAT_64BIT) {
> + struct ext3_extent_header *eh = (struct ext3_extent_header *)inode.i_block;
> + struct ext3_extent *ex = EXT_FIRST_EXTENT(eh);
> +
> + eh->eh_magic = EXT3_EXT_MAGIC;
> + eh->eh_depth = 0;
> + eh->eh_entries = 1;
> + eh->eh_max = (sizeof(inode.i_block) - sizeof(struct ext3_extent_header))
> + / sizeof(struct ext3_extent);
> + ex->ee_block = 0;
> + ex->ee_start = blk;
> + ex->ee_len = 1;
> +
> + inode.i_flags = EXT3_EXTENTS_FL;
Extents are unfortunately not so great for directories, since they are very
likely fragmented into small chunks instead of large contiguous extents.
This would be one main reason to supprt the "extent-mapped blocks" extent
type. It would still have a normal ext3_extent_header at the top of the
block, but essentially be an indirect block for the rest of the block
(subject to eh_max).
> +++ e2fsprogs-upstream/e2fsck/pass1.c 2006-05-19 14:56:10.000000000 +0200
> + if (fs->super->s_feature_ro_compat & EXT2_FEATURE_RO_COMPAT_64BIT) {
> + if (inode->i_flags & EXT3_EXTENTS_FL) {
> inodes_to_process[process_inode_count].ino = ino;
> inodes_to_process[process_inode_count].inode = *inode;
> process_inode_count++;
> + } else
> + mark_inode_bad(ctx, ino);
This basically requires extent-mapped files for large filesystems, which
isn't very friendly for upgrades at all.
Cheers, Andreas
--
Andreas Dilger
Principal Software Engineer
Cluster File Systems, Inc.
-------------------------------------------------------
All the advantages of Linux Managed Hosting--Without the Cost and Risk!
Fully trained technicians. The highest number of Red Hat certifications in
the hosting industry. Fanatical Support. Click to learn more
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=107521&bid=248729&dat=121642