xfs: refactor shift-by-merge into xfs_bmse_merge() helper
authorBrian Foster <bfoster@redhat.com>
Tue, 23 Sep 2014 05:38:09 +0000 (15:38 +1000)
committerDave Chinner <david@fromorbit.com>
Tue, 23 Sep 2014 05:38:09 +0000 (15:38 +1000)
commitddb19e3180fa42362a04e86771d758be1de0bb13
tree17caa0584d177b35bb57a77e559ac53d821c41c9
parent2c845f5a5f238f42376b6551a7f7716952c8f509
xfs: refactor shift-by-merge into xfs_bmse_merge() helper

The extent shift mechanism in xfs_bmap_shift_extents() is complicated
and handles several different, non-deterministic scenarios. These
include extent shifts, extent merges and potential btree updates in
either of the former scenarios.

Refactor the code to be more linear and readable. The loop logic in
xfs_bmap_shift_extents() and some initial error checking is adjusted
slightly. The associated btree lookup and update/delete operations are
condensed into single blocks of code. This reduces the number of
btree-specific blocks and facilitates the separation of the merge
operation into a new xfs_bmse_merge() and xfs_bmse_can_merge() helpers.

This is a code refactor only. The behavior of extent shift and collapse
range is not modified.

Signed-off-by: Brian Foster <bfoster@redhat.com>
Reviewed-by: Dave Chinner <dchinner@redhat.com>
Signed-off-by: Dave Chinner <david@fromorbit.com>
fs/xfs/libxfs/xfs_bmap.c