linux-ext4.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Yongqiang Yang <xiaoqiangnk@gmail.com>
To: tytso@mit.edu
Cc: linux-ext4@vger.kernel.org, Yongqiang Yang <xiaoqiangnk@gmail.com>
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	[thread overview]
Message-ID: <1321495405-9583-6-git-send-email-xiaoqiangnk@gmail.com> (raw)
In-Reply-To: <1321495405-9583-1-git-send-email-xiaoqiangnk@gmail.com>

The work checking if the lead is full can be done before we do actual splitting
work.

Signed-off-by: Yongqiang Yang <xiaoqiangnk@gmail.com>
---
 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);
-- 
1.7.5.1


      parent reply	other threads:[~2011-11-17  4:32 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-11-17  2:03 [PATCH 1/6] ext4: remove unnecessary var in ext4_ext_insert_extent Yongqiang Yang
2011-11-17  2:03 ` [PATCH 2/6] ext4: remove useless BUG_ON " Yongqiang Yang
2011-11-17  2:03 ` [PATCH 3/6] ext4: correct comment on extent merging " Yongqiang Yang
2011-11-17  2:03 ` [PATCH 4/6] ext4: remove code related to punching hole from ext4_ext_insert_extent Yongqiang Yang
2011-11-17 16:56   ` Andreas Dilger
2011-11-18  3:19     ` Yongqiang Yang
2011-12-01 20:55   ` Allison Henderson
2011-12-02  1:09     ` Yongqiang Yang
2011-11-17  2:03 ` [PATCH 5/6] ext4: remove useless code in ext4_ext_split Yongqiang Yang
2011-11-17  2:03 ` Yongqiang Yang [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1321495405-9583-6-git-send-email-xiaoqiangnk@gmail.com \
    --to=xiaoqiangnk@gmail.com \
    --cc=linux-ext4@vger.kernel.org \
    --cc=tytso@mit.edu \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).