Btrfs: fix arithmetic error in clone ioctl
authorSage Weil <sage@newdream.net>
Mon, 21 Sep 2009 20:00:27 +0000 (16:00 -0400)
committerChris Mason <chris.mason@oracle.com>
Mon, 21 Sep 2009 20:00:27 +0000 (16:00 -0400)
Fix an arithmetic error that was breaking extents cloned via the clone
ioctl starting in the second half of a file.

Signed-off-by: Sage Weil <sage@newdream.net>
Signed-off-by: Chris Mason <chris.mason@oracle.com>
fs/btrfs/ioctl.c

index a13fd556db74954ce361cc2dd77d0a6f9ea27966..a8577a7f26ab248984357a0b8b6505013cff3dba 100644 (file)
@@ -1105,8 +1105,7 @@ static noinline long btrfs_ioctl_clone(struct file *file, unsigned long srcfd,
                                        datao += off - key.offset;
                                        datal -= off - key.offset;
                                }
-                               if (key.offset + datao + datal + key.offset >
-                                   off + len)
+                               if (key.offset + datao + datal > off + len)
                                        datal = off + len - key.offset - datao;
                                /* disko == 0 means it's a hole */
                                if (!disko)