mirror of
https://github.com/torvalds/linux.git
synced 2024-11-24 13:11:40 +00:00
xfs: Make fiemap work in query mode.
According to Documentation/filesystems/fiemap.txt, If fm_extent_count
is zero, then the fm_extents[] array is ignored (no extents will be
returned), and the fm_mapped_extents count will hold the number of
extents needed.
But as the commit 97db39a1f6
has changed
bmv_count to the caller's input buffer, this number query function can't
work any more. As this commit is written to change bmv_count from
MAXEXTNUM because of ENOMEM.
This patch just try to set bm.bmv_count to something sane.
Thanks to Dave Chinner <david@fromorbit.com> for the suggestion.
Cc: Eric Sandeen <sandeen@redhat.com>
Cc: Alex Elder <aelder@sgi.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Tao Ma <tao.ma@oracle.com>
This commit is contained in:
parent
48389ef175
commit
2d1ff3c75a
@ -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;
|
||||
|
Loading…
Reference in New Issue
Block a user