|
@@ -673,7 +673,10 @@ xfs_vn_fiemap(
|
|
|
bm.bmv_length = BTOBB(length);
|
|
|
|
|
|
/* We add one because in getbmap world count includes the header */
|
|
|
- bm.bmv_count = fieinfo->fi_extents_max + 1;
|
|
|
+ bm.bmv_count = !fieinfo->fi_extents_max ? MAXEXTNUM :
|
|
|
+ fieinfo->fi_extents_max + 1;
|
|
|
+ bm.bmv_count = min_t(__s32, bm.bmv_count,
|
|
|
+ (PAGE_SIZE * 16 / sizeof(struct getbmapx)));
|
|
|
bm.bmv_iflags = BMV_IF_PREALLOC;
|
|
|
if (fieinfo->fi_flags & FIEMAP_FLAG_XATTR)
|
|
|
bm.bmv_iflags |= BMV_IF_ATTRFORK;
|