aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAkira Fujita <a-fujita@rs.jp.nec.com>2009-09-16 13:46:38 -0400
committerTheodore Ts'o <tytso@mit.edu>2009-09-16 13:46:38 -0400
commite8505970af46658ece2545e9bc1fe594998fdcdf (patch)
tree14a26c8f120667c70d2925c756ee518fc56453aa
parent3661d28615ea580c1db02a972fd4d3898df1cb01 (diff)
ext4: Replace get_ext_path macro with an inline funciton
Replace get_ext_path macro with an inline function, since this macro looks like a function call but its arguments get modified. Ted pointed this out, thanks. Signed-off-by: Akira Fujita <a-fujita@rs.jp.nec.com> Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
-rw-r--r--fs/ext4/move_extent.c55
1 files changed, 34 insertions, 21 deletions
diff --git a/fs/ext4/move_extent.c b/fs/ext4/move_extent.c
index 4c4491cef357..e4bd8761498a 100644
--- a/fs/ext4/move_extent.c
+++ b/fs/ext4/move_extent.c
@@ -19,14 +19,29 @@
19#include "ext4_extents.h" 19#include "ext4_extents.h"
20#include "ext4.h" 20#include "ext4.h"
21 21
22#define get_ext_path(path, inode, block, ret) \ 22/**
23 do { \ 23 * get_ext_path - Find an extent path for designated logical block number.
24 path = ext4_ext_find_extent(inode, block, path); \ 24 *
25 if (IS_ERR(path)) { \ 25 * @inode: an inode which is searched
26 ret = PTR_ERR(path); \ 26 * @lblock: logical block number to find an extent path
27 path = NULL; \ 27 * @path: pointer to an extent path pointer (for output)
28 } \ 28 *
29 } while (0) 29 * ext4_ext_find_extent wrapper. Return 0 on success, or a negative error value
30 * on failure.
31 */
32static inline int
33get_ext_path(struct inode *inode, ext4_lblk_t lblock,
34 struct ext4_ext_path **path)
35{
36 int ret = 0;
37
38 *path = ext4_ext_find_extent(inode, lblock, *path);
39 if (IS_ERR(*path)) {
40 ret = PTR_ERR(*path);
41 *path = NULL;
42 }
43 return ret;
44}
30 45
31/** 46/**
32 * copy_extent_status - Copy the extent's initialization status 47 * copy_extent_status - Copy the extent's initialization status
@@ -283,7 +298,7 @@ mext_insert_across_blocks(handle_t *handle, struct inode *orig_inode,
283 } 298 }
284 299
285 if (new_flag) { 300 if (new_flag) {
286 get_ext_path(orig_path, orig_inode, eblock, err); 301 err = get_ext_path(orig_inode, eblock, &orig_path);
287 if (orig_path == NULL) 302 if (orig_path == NULL)
288 goto out; 303 goto out;
289 304
@@ -293,8 +308,8 @@ mext_insert_across_blocks(handle_t *handle, struct inode *orig_inode,
293 } 308 }
294 309
295 if (end_flag) { 310 if (end_flag) {
296 get_ext_path(orig_path, orig_inode, 311 err = get_ext_path(orig_inode,
297 le32_to_cpu(end_ext->ee_block) - 1, err); 312 le32_to_cpu(end_ext->ee_block) - 1, &orig_path);
298 if (orig_path == NULL) 313 if (orig_path == NULL)
299 goto out; 314 goto out;
300 315
@@ -631,12 +646,12 @@ mext_replace_branches(handle_t *handle, struct inode *orig_inode,
631 mext_double_down_write(orig_inode, donor_inode); 646 mext_double_down_write(orig_inode, donor_inode);
632 647
633 /* Get the original extent for the block "orig_off" */ 648 /* Get the original extent for the block "orig_off" */
634 get_ext_path(orig_path, orig_inode, orig_off, err); 649 err = get_ext_path(orig_inode, orig_off, &orig_path);
635 if (orig_path == NULL) 650 if (orig_path == NULL)
636 goto out; 651 goto out;
637 652
638 /* Get the donor extent for the head */ 653 /* Get the donor extent for the head */
639 get_ext_path(donor_path, donor_inode, donor_off, err); 654 err = get_ext_path(donor_inode, donor_off, &donor_path);
640 if (donor_path == NULL) 655 if (donor_path == NULL)
641 goto out; 656 goto out;
642 depth = ext_depth(orig_inode); 657 depth = ext_depth(orig_inode);
@@ -678,7 +693,7 @@ mext_replace_branches(handle_t *handle, struct inode *orig_inode,
678 693
679 if (orig_path) 694 if (orig_path)
680 ext4_ext_drop_refs(orig_path); 695 ext4_ext_drop_refs(orig_path);
681 get_ext_path(orig_path, orig_inode, orig_off, err); 696 err = get_ext_path(orig_inode, orig_off, &orig_path);
682 if (orig_path == NULL) 697 if (orig_path == NULL)
683 goto out; 698 goto out;
684 depth = ext_depth(orig_inode); 699 depth = ext_depth(orig_inode);
@@ -692,8 +707,7 @@ mext_replace_branches(handle_t *handle, struct inode *orig_inode,
692 707
693 if (donor_path) 708 if (donor_path)
694 ext4_ext_drop_refs(donor_path); 709 ext4_ext_drop_refs(donor_path);
695 get_ext_path(donor_path, donor_inode, 710 err = get_ext_path(donor_inode, donor_off, &donor_path);
696 donor_off, err);
697 if (donor_path == NULL) 711 if (donor_path == NULL)
698 goto out; 712 goto out;
699 depth = ext_depth(donor_inode); 713 depth = ext_depth(donor_inode);
@@ -1154,12 +1168,12 @@ ext4_move_extents(struct file *o_filp, struct file *d_filp,
1154 if (file_end < block_end) 1168 if (file_end < block_end)
1155 len -= block_end - file_end; 1169 len -= block_end - file_end;
1156 1170
1157 get_ext_path(orig_path, orig_inode, block_start, ret); 1171 ret = get_ext_path(orig_inode, block_start, &orig_path);
1158 if (orig_path == NULL) 1172 if (orig_path == NULL)
1159 goto out2; 1173 goto out2;
1160 1174
1161 /* Get path structure to check the hole */ 1175 /* Get path structure to check the hole */
1162 get_ext_path(holecheck_path, orig_inode, block_start, ret); 1176 ret = get_ext_path(orig_inode, block_start, &holecheck_path);
1163 if (holecheck_path == NULL) 1177 if (holecheck_path == NULL)
1164 goto out; 1178 goto out;
1165 1179
@@ -1289,8 +1303,7 @@ ext4_move_extents(struct file *o_filp, struct file *d_filp,
1289 /* Decrease buffer counter */ 1303 /* Decrease buffer counter */
1290 if (holecheck_path) 1304 if (holecheck_path)
1291 ext4_ext_drop_refs(holecheck_path); 1305 ext4_ext_drop_refs(holecheck_path);
1292 get_ext_path(holecheck_path, orig_inode, 1306 ret = get_ext_path(orig_inode, seq_start, &holecheck_path);
1293 seq_start, ret);
1294 if (holecheck_path == NULL) 1307 if (holecheck_path == NULL)
1295 break; 1308 break;
1296 depth = holecheck_path->p_depth; 1309 depth = holecheck_path->p_depth;
@@ -1298,7 +1311,7 @@ ext4_move_extents(struct file *o_filp, struct file *d_filp,
1298 /* Decrease buffer counter */ 1311 /* Decrease buffer counter */
1299 if (orig_path) 1312 if (orig_path)
1300 ext4_ext_drop_refs(orig_path); 1313 ext4_ext_drop_refs(orig_path);
1301 get_ext_path(orig_path, orig_inode, seq_start, ret); 1314 ret = get_ext_path(orig_inode, seq_start, &orig_path);
1302 if (orig_path == NULL) 1315 if (orig_path == NULL)
1303 break; 1316 break;
1304 1317