[Devel] [PATCH RHEL7 COMMIT] ms/ext4: use ext4_ext_next_allocated_block instead of mext_next_extent

Konstantin Khorenko khorenko at virtuozzo.com
Wed Jul 29 09:22:27 PDT 2015


The commit is pushed to "branch-rh7-3.10.0-229.7.2-ovz" and will appear at https://src.openvz.org/scm/ovz/vzkernel.git
after rh7-3.10.0-229.7.2.el7
------>
commit b9785e2091d3cae795d60772051eda3cefc29e28
Author: Dmitry Monakhov <dmonakhov at openvz.org>
Date:   Wed Jul 29 20:21:30 2015 +0400

    ms/ext4: use ext4_ext_next_allocated_block instead of mext_next_extent
    
    ms commit: f8fb4f415034baeed983ca2fb0f51bd74d7370b0
    
    This allows us to make mext_next_extent static and potentially get rid
    of it.
    
    Signed-off-by: Dmitry Monakhov <dmonakhov at openvz.org>
    Signed-off-by: Theodore Ts'o <tytso at mit.edu>
---
 fs/ext4/ext4.h    |  2 --
 fs/ext4/extents.c | 15 +++++++--------
 2 files changed, 7 insertions(+), 10 deletions(-)

diff --git a/fs/ext4/ext4.h b/fs/ext4/ext4.h
index dbaef5e..7059994 100644
--- a/fs/ext4/ext4.h
+++ b/fs/ext4/ext4.h
@@ -2813,8 +2813,6 @@ extern void ext4_double_up_write_data_sem(struct inode *orig_inode,
 extern int ext4_move_extents(struct file *o_filp, struct file *d_filp,
 			     __u64 start_orig, __u64 start_donor,
 			     __u64 len, __u64 *moved_len);
-extern int mext_next_extent(struct inode *inode, struct ext4_ext_path *path,
-			    struct ext4_extent **extent);
 
 /* page-io.c */
 extern int __init ext4_init_pageio(void);
diff --git a/fs/ext4/extents.c b/fs/ext4/extents.c
index 73cbe68..08b0709 100644
--- a/fs/ext4/extents.c
+++ b/fs/ext4/extents.c
@@ -5447,7 +5447,7 @@ ext4_ext_shift_extents(struct inode *inode, handle_t *handle,
 	struct ext4_ext_path *path;
 	int ret = 0, depth;
 	struct ext4_extent *extent;
-	ext4_lblk_t stop_block, current_block;
+	ext4_lblk_t stop_block;
 	ext4_lblk_t ex_start, ex_end;
 
 	/* Let path point to the last extent */
@@ -5502,16 +5502,15 @@ ext4_ext_shift_extents(struct inode *inode, handle_t *handle,
 			return -EIO;
 		}
 
-		current_block = le32_to_cpu(extent->ee_block);
-		if (start > current_block) {
+		if (start > le32_to_cpu(extent->ee_block)) {
 			/* Hole, move to the next extent */
-			ret = mext_next_extent(inode, path, &extent);
-			if (ret != 0) {
+			if (extent < EXT_LAST_EXTENT(path[depth].p_hdr)) {
+				path[depth].p_ext++;
+			} else {
+				start = ext4_ext_next_allocated_block(path);
 				ext4_ext_drop_refs(path);
 				kfree(path);
-				if (ret == 1)
-					ret = 0;
-				break;
+				continue;
 			}
 		}
 		ret = ext4_ext_shift_path_extents(path, shift, inode,



More information about the Devel mailing list