Skip to contentSkip to conversation

master - libdm: fix _stats_get_extents_for_file()

PATCH Bryn Reeves 1 participant 1 message Dec 13, 2016

lore
Share & tools
lore
#0 lore raw
Gitweb:        http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=93f420caf4e58f468919f40a9f3f9c20157affd0
Commit:        93f420caf4e58f468919f40a9f3f9c20157affd0
Parent:        87117c2b2546231c789f92c75590f053a8fb987c
Author:        Bryn M. Reeves <[email protected]>
AuthorDate:    Mon Dec 12 20:40:27 2016 +0000
Committer:     Bryn M. Reeves <[email protected]>
CommitterDate: Tue Dec 13 09:09:25 2016 +0000

libdm: fix _stats_get_extents_for_file()

Handle files that contain multiple logical extents in a single physical extent properly:

- In FIEMAP terms a logical extent is a contiguous range of sectors in the file's address space.

- One or more physically adjacent logical extents comprise a physical extent: these are the disk areas that will be mapped to regions.

- An extent boundary occurs when the start sector of extent n+1 is not equal to (n.start + n.length).

This requires that we accumulate the length values of extents returned by FIEMAP until a discontinuity is found (since each struct fiemap_extent returned by FIEMAP only represents a single logical extent, which may be contiguous with other logical extents on-disk).

This avoids creating large numbers of regions for physically adjacent (logical) extents and fixes the earlier behaviour which would only map the first logical extent of the physical extent, leaving gaps in the region table for these files.

---
 WHATS_NEW_DM        |    3 +-
 libdm/libdm-stats.c |   56 +++++++++++++++++++++++++++++++++-----------------
 2 files changed, 39 insertions(+), 20 deletions(-)
WHATS_NEW_DM +2 -1
index f402113..ab32bdb 100644
@@ -1,8 +1,9 @@
 Version 1.02.138 - 
 =====================================
+  Fix file mapping for extents with physically adjacent extents.
   Validation vsnprintf result in runtime translate of dm_log (1.02.136).
   Separate filemap extent allocation from region table.
-  Fix segmentation fault when filemap region creation fails
+  Fix segmentation fault when filemap region creation fails.
   Fix performance of region cleanup for failed filemap creation.
   Fix very slow region deletion with many regions.
 
libdm/libdm-stats.c +37 -19

88 lines not on this page · raw message