]> sourceware.org Git - lvm2.git/commitdiff
libdm: ensure first extent is always counted
authorBryn M. Reeves <bmr@redhat.com>
Tue, 13 Dec 2016 21:36:11 +0000 (21:36 +0000)
committerBryn M. Reeves <bmr@redhat.com>
Tue, 13 Dec 2016 21:41:31 +0000 (21:41 +0000)
If FIEMAP returns a single extent after the first call, no extent
boundary is detected and the first extent is not counted by the
normal mechanism.

In this case, increment nr_extents at the same time the extent is
added to the region table, before returning.

libdm/libdm-stats.c

index 02a30dc4ed6fe4bc71aa24a272a54a7b1df7ae4d..8d202d21c8df4ab139ed64444748994e3af86658 100644 (file)
@@ -4286,8 +4286,10 @@ static uint64_t _stats_map_extents(struct dm_pool *mem,
         * If the file only has a single extent, no boundary is ever
         * detected to trigger addition of the first extent.
         */
-       if (fm_ext[i - 1].fe_logical == 0)
+       if (fm_ext[i - 1].fe_logical == 0) {
                _stats_add_extent(mem, fm_pending, nr_extents);
+               nr_extents++;
+       }
 
        fiemap->fm_start = (fm_ext[i - 1].fe_logical +
                            fm_ext[i - 1].fe_length);
This page took 0.037035 seconds and 5 git commands to generate.