From patchwork Mon Oct 8 13:26:15 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: 1565901 Return-Path: X-Original-To: patchwork-linux-btrfs@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork2.kernel.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by patchwork2.kernel.org (Postfix) with ESMTP id 41CA7DFFAD for ; Mon, 8 Oct 2012 13:26:46 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752864Ab2JHN01 (ORCPT ); Mon, 8 Oct 2012 09:26:27 -0400 Received: from mail-da0-f46.google.com ([209.85.210.46]:45922 "EHLO mail-da0-f46.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752749Ab2JHN00 (ORCPT ); Mon, 8 Oct 2012 09:26:26 -0400 Received: by mail-da0-f46.google.com with SMTP id n41so1563354dak.19 for ; Mon, 08 Oct 2012 06:26:26 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=message-id:date:from:user-agent:mime-version:to:subject :content-type:content-transfer-encoding; bh=eWZ4js7XMvDpAwRk1/F9O8/QuQDbxhbVUwOEFya0gCc=; b=Nn0tlLjqS8GNbS09LzSotxgNrHOzxNyWtV7saadCQCT1OSw3k5OqPNCBxvFeEJZv3U pIFmagI4X6qyNjluuLEPLzx8hsMnHg+W/7E7dlTbUd0gSc3J7pjMrgitue1J1NmUMvIA S/ekJv+b+fDk+WNdx6z5ei3eX4oZ/uxr/M51iiK49gUrGbN/rtT2uKOs6illD5HEw8to nOHeq8RvRCUlZK70czus30RNueItz1TqhK1+JhpAJ+6hj2gdnjMk64z4ZCrTdRNiXvrG Cing3nvM3TwdU7JTpUfm5RNv5ZZ8WL4EnHukgHzAkxUdM59GIPldCvWZLgdY4aAMSgHm DZrg== Received: by 10.68.132.41 with SMTP id or9mr53983381pbb.67.1349702786129; Mon, 08 Oct 2012 06:26:26 -0700 (PDT) Received: from crossover.org ([122.70.116.219]) by mx.google.com with ESMTPS id o5sm6036771paz.32.2012.10.08.06.26.22 (version=TLSv1/SSLv3 cipher=OTHER); Mon, 08 Oct 2012 06:26:24 -0700 (PDT) Message-ID: <5072D477.3070303@gmail.com> Date: Mon, 08 Oct 2012 21:26:15 +0800 From: Wang Sheng-Hui User-Agent: Mozilla/5.0 (X11; Linux i686; rv:7.0.1) Gecko/20110929 Thunderbird/7.0.1 MIME-Version: 1.0 To: chris.mason@fusionio.com, linux-btrfs@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH] Btrfs: remove repeated eb->pages check in, disk-io.c/csum_dirty_buffer Sender: linux-btrfs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-btrfs@vger.kernel.org In csum_dirty_buffer, we first get eb from page->private. Then we check if the page is the first page of eb. Later we check it again. Remove the repeated check here. Signed-off-by: Wang Sheng-Hui --- fs/btrfs/disk-io.c | 8 +++----- 1 files changed, 3 insertions(+), 5 deletions(-) diff --git a/fs/btrfs/disk-io.c b/fs/btrfs/disk-io.c index 22e98e0..8919c56 100644 --- a/fs/btrfs/disk-io.c +++ b/fs/btrfs/disk-io.c @@ -432,14 +432,12 @@ static int csum_dirty_buffer(struct btrfs_root *root, struct page *page) tree = &BTRFS_I(page->mapping->host)->io_tree; eb = (struct extent_buffer *)page->private; - if (page != eb->pages[0]) - return 0; - found_start = btrfs_header_bytenr(eb); - if (found_start != start) { + if (page != eb->pages[0]) { WARN_ON(1); return 0; } - if (eb->pages[0] != page) { + found_start = btrfs_header_bytenr(eb); + if (found_start != start) { WARN_ON(1); return 0; }