Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 163684
b: refs/heads/master
c: e850597
h: refs/heads/master
v: v3
  • Loading branch information
Akira Fujita authored and Theodore Ts'o committed Sep 16, 2009
1 parent 95ecc1e commit 59e2209
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 22 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 3661d28615ea580c1db02a972fd4d3898df1cb01
refs/heads/master: e8505970af46658ece2545e9bc1fe594998fdcdf
55 changes: 34 additions & 21 deletions trunk/fs/ext4/move_extent.c
Original file line number Diff line number Diff line change
Expand Up @@ -19,14 +19,29 @@
#include "ext4_extents.h"
#include "ext4.h"

#define get_ext_path(path, inode, block, ret) \
do { \
path = ext4_ext_find_extent(inode, block, path); \
if (IS_ERR(path)) { \
ret = PTR_ERR(path); \
path = NULL; \
} \
} while (0)
/**
* get_ext_path - Find an extent path for designated logical block number.
*
* @inode: an inode which is searched
* @lblock: logical block number to find an extent path
* @path: pointer to an extent path pointer (for output)
*
* ext4_ext_find_extent wrapper. Return 0 on success, or a negative error value
* on failure.
*/
static inline int
get_ext_path(struct inode *inode, ext4_lblk_t lblock,
struct ext4_ext_path **path)
{
int ret = 0;

*path = ext4_ext_find_extent(inode, lblock, *path);
if (IS_ERR(*path)) {
ret = PTR_ERR(*path);
*path = NULL;
}
return ret;
}

/**
* copy_extent_status - Copy the extent's initialization status
Expand Down Expand Up @@ -283,7 +298,7 @@ mext_insert_across_blocks(handle_t *handle, struct inode *orig_inode,
}

if (new_flag) {
get_ext_path(orig_path, orig_inode, eblock, err);
err = get_ext_path(orig_inode, eblock, &orig_path);
if (orig_path == NULL)
goto out;

Expand All @@ -293,8 +308,8 @@ mext_insert_across_blocks(handle_t *handle, struct inode *orig_inode,
}

if (end_flag) {
get_ext_path(orig_path, orig_inode,
le32_to_cpu(end_ext->ee_block) - 1, err);
err = get_ext_path(orig_inode,
le32_to_cpu(end_ext->ee_block) - 1, &orig_path);
if (orig_path == NULL)
goto out;

Expand Down Expand Up @@ -631,12 +646,12 @@ mext_replace_branches(handle_t *handle, struct inode *orig_inode,
mext_double_down_write(orig_inode, donor_inode);

/* Get the original extent for the block "orig_off" */
get_ext_path(orig_path, orig_inode, orig_off, err);
err = get_ext_path(orig_inode, orig_off, &orig_path);
if (orig_path == NULL)
goto out;

/* Get the donor extent for the head */
get_ext_path(donor_path, donor_inode, donor_off, err);
err = get_ext_path(donor_inode, donor_off, &donor_path);
if (donor_path == NULL)
goto out;
depth = ext_depth(orig_inode);
Expand Down Expand Up @@ -678,7 +693,7 @@ mext_replace_branches(handle_t *handle, struct inode *orig_inode,

if (orig_path)
ext4_ext_drop_refs(orig_path);
get_ext_path(orig_path, orig_inode, orig_off, err);
err = get_ext_path(orig_inode, orig_off, &orig_path);
if (orig_path == NULL)
goto out;
depth = ext_depth(orig_inode);
Expand All @@ -692,8 +707,7 @@ mext_replace_branches(handle_t *handle, struct inode *orig_inode,

if (donor_path)
ext4_ext_drop_refs(donor_path);
get_ext_path(donor_path, donor_inode,
donor_off, err);
err = get_ext_path(donor_inode, donor_off, &donor_path);
if (donor_path == NULL)
goto out;
depth = ext_depth(donor_inode);
Expand Down Expand Up @@ -1154,12 +1168,12 @@ ext4_move_extents(struct file *o_filp, struct file *d_filp,
if (file_end < block_end)
len -= block_end - file_end;

get_ext_path(orig_path, orig_inode, block_start, ret);
ret = get_ext_path(orig_inode, block_start, &orig_path);
if (orig_path == NULL)
goto out2;

/* Get path structure to check the hole */
get_ext_path(holecheck_path, orig_inode, block_start, ret);
ret = get_ext_path(orig_inode, block_start, &holecheck_path);
if (holecheck_path == NULL)
goto out;

Expand Down Expand Up @@ -1289,16 +1303,15 @@ ext4_move_extents(struct file *o_filp, struct file *d_filp,
/* Decrease buffer counter */
if (holecheck_path)
ext4_ext_drop_refs(holecheck_path);
get_ext_path(holecheck_path, orig_inode,
seq_start, ret);
ret = get_ext_path(orig_inode, seq_start, &holecheck_path);
if (holecheck_path == NULL)
break;
depth = holecheck_path->p_depth;

/* Decrease buffer counter */
if (orig_path)
ext4_ext_drop_refs(orig_path);
get_ext_path(orig_path, orig_inode, seq_start, ret);
ret = get_ext_path(orig_inode, seq_start, &orig_path);
if (orig_path == NULL)
break;

Expand Down

0 comments on commit 59e2209

Please sign in to comment.