From patchwork Fri Nov 30 06:02:28 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Wang Sheng-Hui X-Patchwork-Id: 1823731 Return-Path: X-Original-To: patchwork-linux-btrfs@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork1.kernel.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by patchwork1.kernel.org (Postfix) with ESMTP id 7354D3FC23 for ; Fri, 30 Nov 2012 06:03:37 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754240Ab2K3GDe (ORCPT ); Fri, 30 Nov 2012 01:03:34 -0500 Received: from mail-ia0-f174.google.com ([209.85.210.174]:58027 "EHLO mail-ia0-f174.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752725Ab2K3GDd (ORCPT ); Fri, 30 Nov 2012 01:03:33 -0500 Received: by mail-ia0-f174.google.com with SMTP id y25so97671iay.19 for ; Thu, 29 Nov 2012 22:03:33 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id:x-mailer:in-reply-to:references; bh=PfHqZ0JlNbgNERQeZHqjFpz8FRoE01YLY+7QqvmUzt4=; b=ox2xqDCahrDepN5HsB9zCT6hfWO1/T/oHWa52WUMBDhiDhZvZgSWuu/p6tSDMx6Bnn 2NKmTEvy/NCJU0DzsSfDKai6cBCTSKeg+AJjdw2rRl9YnOv6vwxyrp6xRaij85yb5ZiO V7rFPUTsR8xBg2LykCsjGs+cdpu1+0fJV4IZIkaElQER/XyT0Mj03JRPL3+LFLwTdCEY LtGsY2NwoDEmVvZ3FY6bOVOhGZBqJR7KJO4xyV8QzpXnUfd+RPaIIFlYJV1vsAQmzOee sLutwjB3gIQdledzLfCU+kU8RDq4lY3h1bwYVlYly3qaMgezKsmBeITlcuNjCTtrSz3B kX4g== Received: by 10.42.175.5 with SMTP id ay5mr156481icb.10.1354255413221; Thu, 29 Nov 2012 22:03:33 -0800 (PST) Received: from localhost ([202.108.130.138]) by mx.google.com with ESMTPS id hg2sm9345123igc.3.2012.11.29.22.03.30 (version=TLSv1/SSLv3 cipher=OTHER); Thu, 29 Nov 2012 22:03:32 -0800 (PST) From: shhuiw@gmail.com To: chris.mason@fusionio.com, jbacik@fusionio.com Cc: linux-btrfs@vger.kernel.org Subject: [PATCH] Btrfs: cleanup: assign path->nodes[0]to leaf after ret check in __btrfs_write_out_cache Date: Fri, 30 Nov 2012 14:02:28 +0800 Message-Id: <50b84c34.82c0320a.0e91.ffffe6bd@mx.google.com> X-Mailer: git-send-email 1.7.5.4 In-Reply-To: <1354255348-5011-1-git-send-email-y> References: <1354255348-5011-1-git-send-email-y> Sender: linux-btrfs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-btrfs@vger.kernel.org From: Wang Sheng-Hui If the ret check fails, the assignment is useless. Move the assignment after the check. Signed-off-by: Wang Sheng-Hui --- fs/btrfs/free-space-cache.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/fs/btrfs/free-space-cache.c b/fs/btrfs/free-space-cache.c index 058fc9b..d7b3286 100644 --- a/fs/btrfs/free-space-cache.c +++ b/fs/btrfs/free-space-cache.c @@ -1033,7 +1033,6 @@ int __btrfs_write_out_cache(struct btrfs_root *root, struct inode *inode, GFP_NOFS); goto out; } - leaf = path->nodes[0]; if (ret > 0) { struct btrfs_key found_key; BUG_ON(!path->slots[0]); @@ -1049,6 +1048,7 @@ int __btrfs_write_out_cache(struct btrfs_root *root, struct inode *inode, goto out; } } + leaf = path->nodes[0]; BTRFS_I(inode)->generation = trans->transid; header = btrfs_item_ptr(leaf, path->slots[0],