Btrfs: return the internal error unchanged if btrfs_get_extent_fiemap() call failed...
authorJeff Liu <jeff.liu@oracle.com>
Thu, 9 Feb 2012 06:25:50 +0000 (14:25 +0800)
committerDavid Sterba <dsterba@suse.cz>
Wed, 15 Feb 2012 15:40:23 +0000 (16:40 +0100)
Given that ENXIO only means "offset beyond EOF" for either SEEK_DATA or SEEK_HOLE inquiry
in a desired file range, so we should return the internal error unchanged if btrfs_get_extent_fiemap()
call failed, rather than ENXIO.

Cc: Dave Chinner <david@fromorbit.com>
Signed-off-by: Jie Liu <jeff.liu@oracle.com>
fs/btrfs/file.c

index 0621a3a7d5d157161cef85401aa135fd342fe931..3a520899b024a0a8c9eb8263c51ffa19b9048260 100644 (file)
@@ -1755,7 +1755,7 @@ static int find_desired_extent(struct inode *inode, loff_t *offset, int origin)
                                                     start - root->sectorsize,
                                                     root->sectorsize, 0);
                if (IS_ERR(em)) {
-                       ret = -ENXIO;
+                       ret = PTR_ERR(em);
                        goto out;
                }
                last_end = em->start + em->len;
@@ -1767,7 +1767,7 @@ static int find_desired_extent(struct inode *inode, loff_t *offset, int origin)
        while (1) {
                em = btrfs_get_extent_fiemap(inode, NULL, 0, start, len, 0);
                if (IS_ERR(em)) {
-                       ret = -ENXIO;
+                       ret = PTR_ERR(em);
                        break;
                }