Whamcloud - gitweb
libext2fs: don't error out when punching a totally sparse file
authorDarrick J. Wong <darrick.wong@oracle.com>
Thu, 12 Dec 2013 18:25:40 +0000 (13:25 -0500)
committerTheodore Ts'o <tytso@mit.edu>
Thu, 12 Dec 2013 18:25:42 +0000 (13:25 -0500)
commit042a0f52ec79e448fd798df7757c6addeb00aede
treed4a3d1611e5ac8e6f181807e443d12827cf8a4f3
parentdc9673abcf8e00f2b2e6e346b6312ef3745ac543
libext2fs: don't error out when punching a totally sparse file

If we're asked to punch a file with no data blocks mapped to it and a
non-zero length, we don't need to do any work in ext2fs_punch_extent()
and can return success.  Unfortunately, the extent_get() function
returns "no current node" because it (correctly) failed to find any
extents, which is bubbled up to callers.  Since no extents being found
is not an error in this corner case, fix up ext2fs_punch_extent() to
return 0 to callers.

Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
lib/ext2fs/punch.c