linux-ext4.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Wang Sheng-Hui <shhuiw@gmail.com>
To: Theodore Ts'o <tytso@mit.edu>,
	Andreas Dilger <adilger.kernel@dilger.ca>,
	linux-ext4@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: [PATCH 2/2] ext4: make extents.c/ext4_ext_try_to_merge return 1 on merged
Date: Fri, 06 Jul 2012 14:27:44 +0800	[thread overview]
Message-ID: <4FF68560.7040102@gmail.com> (raw)

In the old version, ext4_ext_try_to_merge would return 0 if
merge left or no merge, and return 1 if merge right.
Here make ext4_ext_try_to_merge return 1 on merged, and return
0 if no merge.

Signed-off-by: Wang Sheng-Hui <shhuiw@gmail.com>
---
 fs/ext4/extents.c |    7 +++----
 1 files changed, 3 insertions(+), 4 deletions(-)

diff --git a/fs/ext4/extents.c b/fs/ext4/extents.c
index 6c2a37d..7f6fb48 100644
--- a/fs/ext4/extents.c
+++ b/fs/ext4/extents.c
@@ -1657,7 +1657,7 @@ static int ext4_ext_try_to_merge_right(struct inode *inode,
 
 /*
  * This function tries to merge the @ex extent to neighbours in the tree.
- * return 1 if merge left else 0.
+ * return 1 if merged else 0.
  */
 static int ext4_ext_try_to_merge(struct inode *inode,
 				  struct ext4_ext_path *path,
@@ -1665,7 +1665,6 @@ static int ext4_ext_try_to_merge(struct inode *inode,
 	struct ext4_extent_header *eh;
 	unsigned int depth;
 	int merge_done = 0;
-	int ret = 0;
 
 	depth = ext_depth(inode);
 	BUG_ON(path[depth].p_hdr == NULL);
@@ -1675,9 +1674,9 @@ static int ext4_ext_try_to_merge(struct inode *inode,
 		merge_done = ext4_ext_try_to_merge_right(inode, path, ex - 1);
 
 	if (!merge_done)
-		ret = ext4_ext_try_to_merge_right(inode, path, ex);
+		merge_done = ext4_ext_try_to_merge_right(inode, path, ex);
 
-	return ret;
+	return merge_done;
 }
 
 /*
-- 
1.7.1

                 reply	other threads:[~2012-07-06  6:27 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=4FF68560.7040102@gmail.com \
    --to=shhuiw@gmail.com \
    --cc=adilger.kernel@dilger.ca \
    --cc=linux-ext4@vger.kernel.org \
    --cc=linux-kernel@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).