From patchwork Thu Nov 17 02:03:25 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yongqiang Yang X-Patchwork-Id: 126112 Return-Path: X-Original-To: patchwork-incoming@ozlabs.org Delivered-To: patchwork-incoming@ozlabs.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id CA239B71C4 for ; Thu, 17 Nov 2011 15:32:04 +1100 (EST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755309Ab1KQEcD (ORCPT ); Wed, 16 Nov 2011 23:32:03 -0500 Received: from mail-yx0-f174.google.com ([209.85.213.174]:64882 "EHLO mail-yx0-f174.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755094Ab1KQEcD (ORCPT ); Wed, 16 Nov 2011 23:32:03 -0500 Received: by yenq3 with SMTP id q3so560251yen.19 for ; Wed, 16 Nov 2011 20:32:01 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=from:to:cc:subject:date:message-id:x-mailer:in-reply-to:references; bh=K1RCTZUzflkIW6ZXwkD7lpsU3o6hRoZygSNQTViVlCM=; b=sOYpx1EQJo5wBjP9i8jQQ/norvJ2cOtKZAY1GZ4Q6iL7SgzhIIJuagTaPBuPKVihal jXCGHgMYchWD6vMAUHn8y5NKKafu7InBGpaNoAYVkaePQ1I+s1Pu2chH2kG3nOz4/D6L MR9O3jsXxmmAhfT8+LVAjrCIk+3/WaFPrDj9g= Received: by 10.42.151.4 with SMTP id c4mr37580950icw.39.1321504321480; Wed, 16 Nov 2011 20:32:01 -0800 (PST) Received: from localhost.localdomain ([159.226.43.42]) by mx.google.com with ESMTPS id l28sm11691965ibc.3.2011.11.16.20.31.59 (version=TLSv1/SSLv3 cipher=OTHER); Wed, 16 Nov 2011 20:32:01 -0800 (PST) From: Yongqiang Yang To: tytso@mit.edu Cc: linux-ext4@vger.kernel.org, Yongqiang Yang Subject: [PATCH 6/6] ext4: move code checking if leaf is full to the beginning of ext4_ext_split Date: Thu, 17 Nov 2011 10:03:25 +0800 Message-Id: <1321495405-9583-6-git-send-email-xiaoqiangnk@gmail.com> X-Mailer: git-send-email 1.7.5.1 In-Reply-To: <1321495405-9583-1-git-send-email-xiaoqiangnk@gmail.com> References: <1321495405-9583-1-git-send-email-xiaoqiangnk@gmail.com> Sender: linux-ext4-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-ext4@vger.kernel.org The work checking if the lead is full can be done before we do actual splitting work. Signed-off-by: Yongqiang Yang --- fs/ext4/extents.c | 17 +++++++++-------- 1 files changed, 9 insertions(+), 8 deletions(-) diff --git a/fs/ext4/extents.c b/fs/ext4/extents.c index d483635..6f0300e 100644 --- a/fs/ext4/extents.c +++ b/fs/ext4/extents.c @@ -817,6 +817,15 @@ static int ext4_ext_split(handle_t *handle, struct inode *inode, EXT4_ERROR_INODE(inode, "p_ext > EXT_MAX_EXTENT!"); return -EIO; } + + if (unlikely(path[depth].p_hdr->eh_entries != + path[depth].p_hdr->eh_max)) { + EXT4_ERROR_INODE(inode, "eh_entries %d != eh_max %d!", + path[depth].p_hdr->eh_entries, + path[depth].p_hdr->eh_max); + return -EIO; + } + if (path[depth].p_ext != EXT_MAX_EXTENT(path[depth].p_hdr)) { border = path[depth].p_ext[1].ee_block; ext_debug("leaf will be split." @@ -875,14 +884,6 @@ static int ext4_ext_split(handle_t *handle, struct inode *inode, neh->eh_depth = 0; /* move remainder of path[depth] to the new leaf */ - if (unlikely(path[depth].p_hdr->eh_entries != - path[depth].p_hdr->eh_max)) { - EXT4_ERROR_INODE(inode, "eh_entries %d != eh_max %d!", - path[depth].p_hdr->eh_entries, - path[depth].p_hdr->eh_max); - err = -EIO; - goto cleanup; - } /* start copy from next extent */ m = EXT_MAX_EXTENT(path[depth].p_hdr) - path[depth].p_ext++; ext4_ext_show_move(inode, path, newblock, depth);