From patchwork Wed Mar 16 14:54:45 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ilya Dryomov X-Patchwork-Id: 639381 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by demeter1.kernel.org (8.14.4/8.14.3) with ESMTP id p2GEuABH023533 for ; Wed, 16 Mar 2011 14:56:10 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753167Ab1CPO4F (ORCPT ); Wed, 16 Mar 2011 10:56:05 -0400 Received: from mail-fx0-f46.google.com ([209.85.161.46]:64140 "EHLO mail-fx0-f46.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752456Ab1CPO4C (ORCPT ); Wed, 16 Mar 2011 10:56:02 -0400 Received: by fxm17 with SMTP id 17so1736057fxm.19 for ; Wed, 16 Mar 2011 07:56:01 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:date:from:to:cc:subject:message-id:references :mime-version:content-type:content-disposition:in-reply-to :user-agent; bh=+PGxUbzOVlKHQe7uvfhdqnPR3JRzPDnRdjC4fyDmA+s=; b=HvHd2PTCKoNzsX56LyuYXz+IY5FR+xXlwyHbGOu5FhVCh8pubEqEGFj3dW8sj3PfnN vt2IsqqOiT4Z+SYBa6LDGvgi2GSNdlKpn7kpSc5SNDv3TT2+RruW1A9Anya0OAegt1z6 i/2FA0riOeNqKPTObc51f9wWaaw/04em1S37Q= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=date:from:to:cc:subject:message-id:references:mime-version :content-type:content-disposition:in-reply-to:user-agent; b=rh2Z8niYRcDhr3qEYRSC9kFMXLeSYfL+Evm4cpdQcp827JZLwCJA4YeCuSUX3uN4MW YzJGO9uoQVatQV4fYNvD5GZivaQVQDv6lSY348okL1v6Xe122qqO0chHcx/j7MS29Ahx +zRq5/R028rhtx4y6MNUregRGVy0g+QAX7JRU= Received: by 10.223.160.5 with SMTP id l5mr80859fax.85.1300287288454; Wed, 16 Mar 2011 07:54:48 -0700 (PDT) Received: from localhost ([46.35.225.87]) by mx.google.com with ESMTPS id b18sm263005fak.32.2011.03.16.07.54.46 (version=TLSv1/SSLv3 cipher=OTHER); Wed, 16 Mar 2011 07:54:47 -0700 (PDT) Date: Wed, 16 Mar 2011 16:54:45 +0200 From: Ilya Dryomov To: Arne Jansen Cc: chris.mason@oracle.com, linux-btrfs@vger.kernel.org Subject: Re: [PATCH v3 3/6] btrfs: add scrub code and prototypes Message-ID: <20110316145445.GA7007@kwango.lan.net> References: <7ccafb5250b72ca706369a8d5b45f06e8d5a4f8a.1299941055.git.sensille@gmx.net> <20110316143525.GA2546@kwango.lan.net> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20110316143525.GA2546@kwango.lan.net> User-Agent: Mutt/1.5.18 (2008-05-17) Sender: linux-btrfs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-btrfs@vger.kernel.org X-Greylist: IP, sender and recipient auto-whitelisted, not delayed by milter-greylist-4.2.6 (demeter1.kernel.org [140.211.167.41]); Wed, 16 Mar 2011 14:56:11 +0000 (UTC) diff --git a/fs/btrfs/scrub.c b/fs/btrfs/scrub.c index ef59200..8926438 100644 --- a/fs/btrfs/scrub.c +++ b/fs/btrfs/scrub.c @@ -1111,7 +1111,7 @@ static noinline_for_stack int scrub_chunk(struct scrub_dev *sdev, struct map_lookup *map; struct extent_map *em; int i; - int ret; + int ret = 0; read_lock(&map_tree->map_tree.lock); em = lookup_extent_mapping(&map_tree->map_tree, chunk_offset, 1); @@ -1121,20 +1121,27 @@ static noinline_for_stack int scrub_chunk(struct scrub_dev *sdev, return -EINVAL; map = (struct map_lookup *)em->bdev; - if (em->start != chunk_offset) - return -EINVAL; + if (em->start != chunk_offset) { + ret = -EINVAL; + goto out; + } - if (em->len < length) - return -EINVAL; + if (em->len < length) { + ret = -EINVAL; + goto out; + } for (i = 0; i < map->num_stripes; ++i) { if (map->stripes[i].dev == sdev->dev) { ret = scrub_stripe(sdev, map, i, chunk_offset, length); if (ret) - return ret; + goto out; } } - return 0; + +out: + free_extent_map(em); + return ret; } static noinline_for_stack