linux-ext4.vger.kernel.org archive mirror
 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 5/6] libext2fs: optimize rb_get_bmap_range() for mostly allocated bmaps
Date: Mon, 26 Nov 2012 12:22:42 +0100 (CET)	[thread overview]
Message-ID: <alpine.LFD.2.00.1211261152260.18234@localhost> (raw)
In-Reply-To: <1353803794-11593-6-git-send-email-tytso@mit.edu>

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

> Date: Sat, 24 Nov 2012 19:36:33 -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 5/6] libext2fs: optimize rb_get_bmap_range() for mostly
>     allocated bmaps
> 
> This optimizies the CPU utilization of the rb_get_bmap_range()
> function when most of the bitmap is allocated.
> 
> Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
> ---
>  lib/ext2fs/blkmap64_rb.c | 29 ++++++++++++++++++++++++-----
>  1 file changed, 24 insertions(+), 5 deletions(-)
> 
> diff --git a/lib/ext2fs/blkmap64_rb.c b/lib/ext2fs/blkmap64_rb.c
> index 0705cf2..3a5518b 100644
> --- a/lib/ext2fs/blkmap64_rb.c
> +++ b/lib/ext2fs/blkmap64_rb.c
> @@ -721,6 +721,7 @@ static errcode_t rb_get_bmap_range(ext2fs_generic_bitmap bitmap,
>  	struct rb_node *parent = NULL, *next, **n;
>  	struct ext2fs_rb_private *bp;
>  	struct bmap_rb_extent *ext;
> +	int count;
>  	__u64 pos;
>  
>  	bp = (struct ext2fs_rb_private *) bitmap->private;
> @@ -748,14 +749,32 @@ static errcode_t rb_get_bmap_range(ext2fs_generic_bitmap bitmap,
>  		ext = ext2fs_rb_entry(parent, struct bmap_rb_extent, node);
>  
>  		pos = ext->start;
> -		if (pos < start)
> +		count = ext->count;
> +		if (pos > start+num)

Missing spacing around '+'.

Also I think that the condition should rather be:

		if (pos >= start + num)

> +			break;
> +		if (pos < start) {
> +			count -= start - pos;
> +			if (count < 0)
> +				continue;
>  			pos = start;
> -
> -		while (pos < (ext->start + ext->count)) {
> -			if ((pos - start) >= num)
> -				return 0;
> +		}
> +		if (pos+count > start+num)
> +			count = start+num - pos;

missing spacing around '+'

> +
> +		while (count > 0) {
> +			if ((count >= 8) &&
> +			    ((pos - start) % 8) == 0) {
> +				int nbytes = count >> 3;
> +				int offset = (pos -start) >> 3;

missing spacing around '-'

> +
> +				memset(out + offset, 0xFF, nbytes);
> +				pos += nbytes << 3;
> +				count -= nbytes << 3;
> +				continue;
> +			}
>  			ext2fs_fast_set_bit64((pos - start), out);
>  			pos++;
> +			count--;
>  		}
>  	}
>  	return 0;
> 

  reply	other threads:[~2012-11-26 11:22 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
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 [this message]
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.1211261152260.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).