xfs: Make fiemap work in query mode.
authorTao Ma <tao.ma@oracle.com>
Thu, 29 Apr 2010 05:13:56 +0000 (15:13 +1000)
committerAlex Elder <aelder@sgi.com>
Wed, 19 May 2010 14:58:16 +0000 (09:58 -0500)
commit2d1ff3c75a4642062d314634290be6d8da4ffb03
tree1112feee61ad0c7653c6877d04397b4949c46471
parent48389ef17583f2214bbd2c119b3015677419c16b
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 97db39a1f6f69e906e98118392400de5217aa33a 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>
fs/xfs/linux-2.6/xfs_iops.c