ext4: rename and improbe ext4_es_find_extent()

This commit renames ext4_es_find_extent with ext4_es_find_delayed_extent
and improve this function.  First, we split input and output parameter.
Second, this function never return the first block of the next delayed
extent after 'es'.

Signed-off-by: Zheng Liu <wenqing.lz@taobao.com>
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
Cc: Jan kara <jack@suse.cz>
diff --git a/fs/ext4/extents.c b/fs/ext4/extents.c
index 37f94a7..895c195 100644
--- a/fs/ext4/extents.c
+++ b/fs/ext4/extents.c
@@ -3528,8 +3528,7 @@
 {
 	struct extent_status es;
 
-	es.es_lblk = lblk_start;
-	(void)ext4_es_find_extent(inode, &es);
+	ext4_es_find_delayed_extent(inode, lblk_start, &es);
 	if (es.es_len == 0)
 		return 0; /* there is no delay extent in this tree */
 	else if (es.es_lblk <= lblk_start &&
@@ -4568,10 +4567,9 @@
 				    struct ext4_ext_cache *newex)
 {
 	struct extent_status es;
-	ext4_lblk_t next_del;
+	ext4_lblk_t block, next_del;
 
-	es.es_lblk = newex->ec_block;
-	next_del = ext4_es_find_extent(inode, &es);
+	ext4_es_find_delayed_extent(inode, newex->ec_block, &es);
 
 	if (newex->ec_start == 0) {
 		/*
@@ -4592,6 +4590,13 @@
 		newex->ec_len = es.es_lblk + es.es_len - newex->ec_block;
 	}
 
+	block = newex->ec_block + newex->ec_len;
+	ext4_es_find_delayed_extent(inode, block, &es);
+	if (es.es_len == 0)
+		next_del = EXT_MAX_BLOCKS;
+	else
+		next_del = es.es_lblk;
+
 	return next_del;
 }
 /* fiemap flags we can handle specified here */