All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Lukáš Czerner" <lczerner@redhat.com>
To: "Theodore Ts'o" <tytso@mit.edu>
Cc: Ext4 Developers List <linux-ext4@vger.kernel.org>
Subject: Re: [PATCH 2/6] e2fsck: optimize pass1 for CPU time
Date: Mon, 26 Nov 2012 11:06:49 +0100 (CET)	[thread overview]
Message-ID: <alpine.LFD.2.00.1211261100070.18234@localhost> (raw)
In-Reply-To: <1353803794-11593-3-git-send-email-tytso@mit.edu>

On Sat, 24 Nov 2012, Theodore Ts'o wrote:

> Date: Sat, 24 Nov 2012 19:36:30 -0500
> From: Theodore Ts'o <tytso@mit.edu>
> To: Ext4 Developers List <linux-ext4@vger.kernel.org>
> Cc: Theodore Ts'o <tytso@mit.edu>
> Subject: [PATCH 2/6] e2fsck: optimize pass1 for CPU time
> 
> Optimize e2fsck pass 1 by marking entire extents as being in use at a
> time, instead of block by block.  This optimization only works for
> non-bigalloc file systems for now (it's tricky to handle bigalloc file
> systems since this code is also responsible for dealing with blocks
> that are not correctly aligned within a cluster).  When the
> optimization works, the CPU savings can be significant: up to two or
> three CPU minutes for a full 4T disk.
> 
> Addresses-Google-Bug: #7534813

Looks good.

Reviewed-by: Lukas Czerner <lczerner@redhat.com>

> 
> Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
> ---
>  e2fsck/pass1.c | 18 ++++++++++++++++--
>  1 file changed, 16 insertions(+), 2 deletions(-)
> 
> diff --git a/e2fsck/pass1.c b/e2fsck/pass1.c
> index 78fbe8d..cc00e0f 100644
> --- a/e2fsck/pass1.c
> +++ b/e2fsck/pass1.c
> @@ -1432,6 +1432,16 @@ static _INLINE_ void mark_block_used(e2fsck_t ctx, blk64_t block)
>  	}
>  }
>  
> +static _INLINE_ void mark_blocks_used(e2fsck_t ctx, blk64_t block,
> +				      unsigned int num)
> +{
> +	if (ext2fs_test_block_bitmap_range2(ctx->block_found_map, block, num))
> +		ext2fs_mark_block_bitmap_range2(ctx->block_found_map, block, num);
> +	else
> +		while (num--)
> +			mark_block_used(ctx, block++);
> +}
> +
>  /*
>   * Adjust the extended attribute block's reference counts at the end
>   * of pass 1, either by subtracting out references for EA blocks that
> @@ -1867,11 +1877,15 @@ static void scan_extent_node(e2fsck_t ctx, struct problem_context *pctx,
>  				goto failed_add_dir_block;
>  			}
>  		}
> +		if (!ctx->fs->cluster_ratio_bits) {
> +			mark_blocks_used(ctx, extent.e_pblk, extent.e_len);
> +			pb->num_blocks += extent.e_len;
> +		}
>  		for (blk = extent.e_pblk, blockcnt = extent.e_lblk, i = 0;
>  		     i < extent.e_len;
>  		     blk++, blockcnt++, i++) {
> -			if (!(ctx->fs->cluster_ratio_bits &&
> -			      pb->previous_block &&
> +			if (ctx->fs->cluster_ratio_bits &&
> +			    !(pb->previous_block &&
>  			      (EXT2FS_B2C(ctx->fs, blk) ==
>  			       EXT2FS_B2C(ctx->fs, pb->previous_block)) &&
>  			      (blk & EXT2FS_CLUSTER_MASK(ctx->fs)) ==
> 

  reply	other threads:[~2012-11-26 10:06 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-11-25  0:36 [RFC PATCH 0/6] Optimize e2fsck for large file systems Theodore Ts'o
2012-11-25  0:36 ` [PATCH 1/6] libext2fs: optimize rb_set_bmap_range() Theodore Ts'o
2012-11-26  9:40   ` Lukáš Czerner
2012-11-26 13:36     ` Theodore Ts'o
2012-11-25  0:36 ` [PATCH 2/6] e2fsck: optimize pass1 for CPU time Theodore Ts'o
2012-11-26 10:06   ` Lukáš Czerner [this message]
2012-11-25  0:36 ` [PATCH 3/6] libext2fs: add ext2fs_bitcount() function Theodore Ts'o
2012-11-26 10:30   ` Lukáš Czerner
2012-11-26 14:06     ` Theodore Ts'o
2012-11-26 14:10       ` [PATCH 3/6 -v2] " Theodore Ts'o
2012-11-26 14:12         ` [PATCH 4/6 -v3] " Theodore Ts'o
2012-11-25  0:36 ` [PATCH 4/6] libext2fs: optimize rb_get_bmap_range() Theodore Ts'o
2012-11-26 10:46   ` Lukáš Czerner
2012-11-25  0:36 ` [PATCH 5/6] libext2fs: optimize rb_get_bmap_range() for mostly allocated bmaps Theodore Ts'o
2012-11-26 11:22   ` Lukáš Czerner
2012-11-26 14:17     ` Theodore Ts'o
2012-11-25  0:36 ` [PATCH 6/6] e2fsck: optimize pass 5 for CPU utilization Theodore Ts'o
2012-11-26 11:59   ` Lukáš Czerner
2012-11-25  5:09 ` [RFC PATCH 0/6] Optimize e2fsck for large file systems Theodore Ts'o
2012-11-26  9:19 ` Lukáš Czerner

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=alpine.LFD.2.00.1211261100070.18234@localhost \
    --to=lczerner@redhat.com \
    --cc=linux-ext4@vger.kernel.org \
    --cc=tytso@mit.edu \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.