Skip to content

Commit f8fb4f4

Browse files
Dmitry Monakhovtytso
authored andcommitted
ext4: use ext4_ext_next_allocated_block instead of mext_next_extent
This allows us to make mext_next_extent static and potentially get rid of it. Signed-off-by: Dmitry Monakhov <[email protected]> Signed-off-by: Theodore Ts'o <[email protected]>
1 parent ee124d2 commit f8fb4f4

File tree

3 files changed

+8
-12
lines changed

3 files changed

+8
-12
lines changed

fs/ext4/ext4.h

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2753,8 +2753,6 @@ extern void ext4_double_up_write_data_sem(struct inode *orig_inode,
27532753
extern int ext4_move_extents(struct file *o_filp, struct file *d_filp,
27542754
__u64 start_orig, __u64 start_donor,
27552755
__u64 len, __u64 *moved_len);
2756-
extern int mext_next_extent(struct inode *inode, struct ext4_ext_path *path,
2757-
struct ext4_extent **extent);
27582756

27592757
/* page-io.c */
27602758
extern int __init ext4_init_pageio(void);

fs/ext4/extents.c

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -5304,7 +5304,7 @@ ext4_ext_shift_extents(struct inode *inode, handle_t *handle,
53045304
struct ext4_ext_path *path;
53055305
int ret = 0, depth;
53065306
struct ext4_extent *extent;
5307-
ext4_lblk_t stop_block, current_block;
5307+
ext4_lblk_t stop_block;
53085308
ext4_lblk_t ex_start, ex_end;
53095309

53105310
/* Let path point to the last extent */
@@ -5365,17 +5365,15 @@ ext4_ext_shift_extents(struct inode *inode, handle_t *handle,
53655365
(unsigned long) start);
53665366
return -EIO;
53675367
}
5368-
5369-
current_block = le32_to_cpu(extent->ee_block);
5370-
if (start > current_block) {
5368+
if (start > le32_to_cpu(extent->ee_block)) {
53715369
/* Hole, move to the next extent */
5372-
ret = mext_next_extent(inode, path, &extent);
5373-
if (ret != 0) {
5370+
if (extent < EXT_LAST_EXTENT(path[depth].p_hdr)) {
5371+
path[depth].p_ext++;
5372+
} else {
5373+
start = ext4_ext_next_allocated_block(path);
53745374
ext4_ext_drop_refs(path);
53755375
kfree(path);
5376-
if (ret == 1)
5377-
ret = 0;
5378-
break;
5376+
continue;
53795377
}
53805378
}
53815379
ret = ext4_ext_shift_path_extents(path, shift, inode,

fs/ext4/move_extent.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ copy_extent_status(struct ext4_extent *src, struct ext4_extent *dest)
7676
* ext4_ext_path structure refers to the last extent, or a negative error
7777
* value on failure.
7878
*/
79-
int
79+
static int
8080
mext_next_extent(struct inode *inode, struct ext4_ext_path *path,
8181
struct ext4_extent **extent)
8282
{

0 commit comments

Comments
 (0)