Permalink
Browse files

FileStore:: fix fiemap issue in xfs when #extents > 1364

Signed-off-by: Ning Yao <yaoning@unitedstack.com>
  • Loading branch information...
1 parent 55852f7 commit 539b7998fea16f8af3f6cbbbd243f6996f292acc Ning Yao committed Oct 13, 2016
Showing with 9 additions and 2 deletions.
  1. +9 −2 src/os/filestore/FileStore.cc
@@ -3136,11 +3136,13 @@ int FileStore::read(
int FileStore::_do_fiemap(int fd, uint64_t offset, size_t len,
map<uint64_t, uint64_t> *m)
{
- struct fiemap *fiemap = NULL;
uint64_t i;
struct fiemap_extent *extent = NULL;
+ struct fiemap_extent *last = NULL;
+ struct fiemap *fiemap = NULL;
int r = 0;
+more:
r = backend->do_fiemap(fd, offset, len, &fiemap);
if (r < 0)
return r;
@@ -3180,9 +3182,14 @@ int FileStore::_do_fiemap(int fd, uint64_t offset, size_t len,
extent->fe_length = offset + len - extent->fe_logical;
(*m)[extent->fe_logical] = extent->fe_length;
i++;
- extent++;
+ last = extent++;
}
free(fiemap);
+ if (!(last->fe_flags & FIEMAP_EXTENT_LAST)) {
+ offset = last->fe_logical + last->fe_length;
+ len -= offset;
+ goto more;
+ }
return r;
}

0 comments on commit 539b799

Please sign in to comment.