From patchwork Thu Sep 22 19:11:34 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Goldwyn Rodrigues X-Patchwork-Id: 9346695 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id DE76A607D0 for ; Thu, 22 Sep 2016 19:11:58 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id CC6572AC91 for ; Thu, 22 Sep 2016 19:11:58 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id C12382AC93; Thu, 22 Sep 2016 19:11:58 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.9 required=2.0 tests=BAYES_00,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id C53362AC91 for ; Thu, 22 Sep 2016 19:11:56 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S965870AbcIVTLo (ORCPT ); Thu, 22 Sep 2016 15:11:44 -0400 Received: from mx2.suse.de ([195.135.220.15]:39328 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S966435AbcIVTLm (ORCPT ); Thu, 22 Sep 2016 15:11:42 -0400 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (charybdis-ext.suse.de [195.135.220.254]) by mx2.suse.de (Postfix) with ESMTP id F0E70ABAE for ; Thu, 22 Sep 2016 19:11:40 +0000 (UTC) From: Goldwyn Rodrigues To: linux-btrfs@vger.kernel.org Cc: Goldwyn Rodrigues Subject: [PATCH] parent_start initialization cleanup Date: Thu, 22 Sep 2016 14:11:34 -0500 Message-Id: <1474571494-5321-1-git-send-email-rgoldwyn@suse.de> X-Mailer: git-send-email 2.6.6 Sender: linux-btrfs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-btrfs@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Goldwyn Rodrigues Code cleanup. parent_start is initialized multiple times when it is not necessary to do so. Signed-off-by: Goldwyn Rodrigues Reviewed-by: David Sterba --- fs/btrfs/ctree.c | 18 +++--------------- 1 file changed, 3 insertions(+), 15 deletions(-) diff --git a/fs/btrfs/ctree.c b/fs/btrfs/ctree.c index d1c56c9..734e817 100644 --- a/fs/btrfs/ctree.c +++ b/fs/btrfs/ctree.c @@ -1102,7 +1102,7 @@ static noinline int __btrfs_cow_block(struct btrfs_trans_handle *trans, int level, ret; int last_ref = 0; int unlock_orig = 0; - u64 parent_start; + u64 parent_start = 0; if (*cow_ret == buf) unlock_orig = 1; @@ -1121,13 +1121,8 @@ static noinline int __btrfs_cow_block(struct btrfs_trans_handle *trans, else btrfs_node_key(buf, &disk_key, 0); - if (root->root_key.objectid == BTRFS_TREE_RELOC_OBJECTID) { - if (parent) - parent_start = parent->start; - else - parent_start = 0; - } else - parent_start = 0; + if ((root->root_key.objectid == BTRFS_TREE_RELOC_OBJECTID) && parent) + parent_start = parent->start; cow = btrfs_alloc_tree_block(trans, root, parent_start, root->root_key.objectid, &disk_key, level, @@ -1170,8 +1165,6 @@ static noinline int __btrfs_cow_block(struct btrfs_trans_handle *trans, if (root->root_key.objectid == BTRFS_TREE_RELOC_OBJECTID || btrfs_header_backref_rev(buf) < BTRFS_MIXED_BACKREF_REV) parent_start = buf->start; - else - parent_start = 0; extent_buffer_get(cow); tree_mod_log_set_root_pointer(root, cow, 1); @@ -1182,11 +1175,6 @@ static noinline int __btrfs_cow_block(struct btrfs_trans_handle *trans, free_extent_buffer(buf); add_root_to_dirty_list(root); } else { - if (root->root_key.objectid == BTRFS_TREE_RELOC_OBJECTID) - parent_start = parent->start; - else - parent_start = 0; - WARN_ON(trans->transid != btrfs_header_generation(parent)); tree_mod_log_insert_key(root->fs_info, parent, parent_slot, MOD_LOG_KEY_REPLACE, GFP_NOFS);