1
0
mirror of git://sourceware.org/git/lvm2.git synced 2024-12-21 13:34:40 +03:00

libdm: use macro for boundary test in _stats_get_extents_for_file()

This commit is contained in:
Bryn M. Reeves 2016-07-08 22:21:14 +01:00
parent 74565e41fc
commit feb69966d4

View File

@ -4137,6 +4137,12 @@ static int _stats_add_extent(struct dm_pool *mem, struct fiemap_extent *fm_ext,
} }
/* test for the boundary of an extent */
#define ext_boundary(ext, exp, exp_dense) \
(((ext).fe_logical != 0) && \
((ext).fe_physical != (exp)) && \
((ext).fe_physical != (exp_dense)))
/* /*
* Read the extents of an open file descriptor into a table of struct _extent. * Read the extents of an open file descriptor into a table of struct _extent.
* *
@ -4198,9 +4204,7 @@ static struct _extent *_stats_get_extents_for_file(struct dm_pool *mem, int fd,
fm_last.fe_length; fm_last.fe_length;
expected = fm_last.fe_physical + expected = fm_last.fe_physical +
fm_ext[i].fe_logical - fm_last.fe_logical; fm_ext[i].fe_logical - fm_last.fe_logical;
if ((fm_ext[i].fe_logical != 0) if (ext_boundary(fm_ext[i], expected, expected_dense)) {
&& (fm_ext[i].fe_physical != expected)
&& (fm_ext[i].fe_physical != expected_dense)) {
tot_extents++; tot_extents++;
if (!_stats_add_extent(mem, fm_ext + i, if (!_stats_add_extent(mem, fm_ext + i,
tot_extents - 1)) tot_extents - 1))