From patchwork Mon Mar 22 04:55:26 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sean Bartell X-Patchwork-Id: 87355 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by demeter.kernel.org (8.14.3/8.14.3) with ESMTP id o2M4tVCu006139 for ; Mon, 22 Mar 2010 04:55:31 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751396Ab0CVEza (ORCPT ); Mon, 22 Mar 2010 00:55:30 -0400 Received: from mail-gw0-f46.google.com ([74.125.83.46]:53287 "EHLO mail-gw0-f46.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751175Ab0CVEz3 (ORCPT ); Mon, 22 Mar 2010 00:55:29 -0400 Received: by gwaa18 with SMTP id a18so811765gwa.19 for ; Sun, 21 Mar 2010 21:55:28 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:date:from:to:subject :message-id:mail-followup-to:references:mime-version:content-type :content-disposition:in-reply-to:user-agent; bh=4I6XMdhGfqPi4uKuOLWQdcn/oKW8bWj5oZq+5+xsgKA=; b=lVRN2daHIr8ENLIXCoSRDTNtUmhXWYZcRtYm9pMF1Y4u+B2M80NhveLFOOiVnkqv9d vQrcfrYV2kmDVEXljJV9JoWVEtzbzxMNbn1JpJI12qa5NmH+xXPitUyBhmQMtVokCLVm zD9whWRCs+sypaCodtu6/wuhDmI2bOS0J2BW4= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=date:from:to:subject:message-id:mail-followup-to:references :mime-version:content-type:content-disposition:in-reply-to :user-agent; b=pc+Qam2R/Vo418VcIxYOaG9PqD8ClkBop0SP+XWHpYy4Ltxb7qSl62KjyhikkxwJHA 1wWoBHRD1N2soSWJOQKSl+iXA1Y6ot0CCIruC5pCKGCF/Kio7ELU9xgL6IlqA1tUSNKd Fn4UV6cUw5vcep3z69qNPOQy/vBhE7DBRAZrA= Received: by 10.101.21.15 with SMTP id y15mr4457802ani.190.1269233728383; Sun, 21 Mar 2010 21:55:28 -0700 (PDT) Received: from flcl.lan (cpe-065-190-001-228.nc.res.rr.com [65.190.1.228]) by mx.google.com with ESMTPS id 7sm1724249ywf.40.2010.03.21.21.55.24 (version=TLSv1/SSLv3 cipher=RC4-MD5); Sun, 21 Mar 2010 21:55:27 -0700 (PDT) Date: Mon, 22 Mar 2010 00:55:26 -0400 From: Sean Bartell To: linux-btrfs@vger.kernel.org Subject: Re: [PATCH 2/4] btrfs-convert: Add extent iteration functions. Message-ID: <20100322045526.GA21666@flcl.lan> Mail-Followup-To: linux-btrfs@vger.kernel.org References: <20100320042649.GA17106@flcl.lan> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20100320042649.GA17106@flcl.lan> User-Agent: Mutt/1.5.20 (2009-06-14) 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.3 (demeter.kernel.org [140.211.167.41]); Mon, 22 Mar 2010 04:55:31 +0000 (UTC) diff --git a/convert.c b/convert.c index dfd2976..7bb4ed0 100644 --- a/convert.c +++ b/convert.c @@ -471,21 +471,24 @@ int finish_file_extents(struct extent_iterate_data *priv) return ret; } *priv->inode_nbytes += priv->size; - return btrfs_insert_inline_extent(priv->trans, priv->root, - priv->objectid, - priv->file_off, priv->data, - priv->size); - } - - ret = commit_file_extents(priv); - if (ret) - return ret; - - if (priv->total_size > priv->last_file_off) { - ret = commit_disk_extent(priv, priv->last_file_off, 0, - priv->total_size - priv->last_file_off); + ret = btrfs_insert_inline_extent(priv->trans, priv->root, + priv->objectid, + priv->file_off, priv->data, + priv->size); if (ret) return ret; + } else { + ret = commit_file_extents(priv); + if (ret) + return ret; + + if (priv->total_size > priv->last_file_off) { + ret = commit_disk_extent(priv, priv->last_file_off, 0, + priv->total_size - + priv->last_file_off); + if (ret) + return ret; + } } free(priv->data); return 0;