From be401363ac5ec652c706263a59b0bd0acc3612e8 Mon Sep 17 00:00:00 2001 From: Zheng Liu Date: Mon, 18 Feb 2013 00:27:26 -0500 Subject: 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 Signed-off-by: "Theodore Ts'o" Cc: Jan kara --- fs/ext4/extents.c | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) (limited to 'fs/ext4/extents.c') diff --git a/fs/ext4/extents.c b/fs/ext4/extents.c index 37f94a751ad7..895c19595ecf 100644 --- a/fs/ext4/extents.c +++ b/fs/ext4/extents.c @@ -3528,8 +3528,7 @@ static int ext4_find_delalloc_range(struct inode *inode, { 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 @@ static int ext4_find_delayed_extent(struct inode *inode, 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 @@ static int ext4_find_delayed_extent(struct inode *inode, 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 */ -- cgit v1.2.3