lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20100823130932.GD2404@localhost.localdomain>
Date:	Mon, 23 Aug 2010 09:09:32 -0400
From:	Josef Bacik <josef@...hat.com>
To:	Li Zefan <lizf@...fujitsu.com>
Cc:	Chris Mason <chris.mason@...cle.com>,
	Josef Bacik <josef@...hat.com>, linux-btrfs@...r.kernel.org,
	LKML <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH 4/6] btrfs: update stats when allocating from a cluster

On Mon, Aug 23, 2010 at 09:23:29AM +0800, Li Zefan wrote:
> When allocating extent entry from a cluster, we should update
> the free_space and free_extents fields of the block group.
> 
> Signed-off-by: Li Zefan <lizf@...fujitsu.com>
> ---
>  fs/btrfs/free-space-cache.c |   17 ++++++++++++++---
>  1 files changed, 14 insertions(+), 3 deletions(-)
> 
> diff --git a/fs/btrfs/free-space-cache.c b/fs/btrfs/free-space-cache.c
> index 631e14f..20f3141 100644
> --- a/fs/btrfs/free-space-cache.c
> +++ b/fs/btrfs/free-space-cache.c
> @@ -1090,15 +1090,26 @@ u64 btrfs_alloc_from_cluster(struct btrfs_block_group_cache *block_group,
>  		entry->offset += bytes;
>  		entry->bytes -= bytes;
>  
> -		if (entry->bytes == 0) {
> +		if (entry->bytes == 0)
>  			rb_erase(&entry->offset_index, &cluster->root);
> -			kfree(entry);
> -		}
>  		break;
>  	}
>  out:
>  	spin_unlock(&cluster->lock);
>  
> +	if (!ret)
> +		return 0;
> +
> +	spin_lock(&block_group->tree_lock);
> +
> +	block_group->free_space -= bytes;
> +	if (entry->bytes == 0) {
> +		block_group->free_extents--;
> +		kfree(entry);
> +	}
> +
> +	spin_unlock(&block_group->tree_lock);
> +

Move this part up so we don't drop the spinlock and then re-grab it.  Thanks,

Josef
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ