Fix btrfs-convert's large file support.
authorZhu <piggestpig@gmail.com>
Mon, 28 Apr 2008 20:45:11 +0000 (16:45 -0400)
committerDavid Woodhouse <dwmw2@hera.kernel.org>
Mon, 28 Apr 2008 20:45:11 +0000 (16:45 -0400)
This patch add ext2_inode.i_size_high into account when calculating regular
file's size in btrfs-convert,  which makes it deal with large files bigger than
4GB properly.

convert.c

index 435cafd..80dc3f5 100644 (file)
--- a/convert.c
+++ b/convert.c
@@ -928,6 +928,10 @@ static int copy_inode_item(struct btrfs_inode_item *dst,
                btrfs_set_stack_inode_size(dst, 0);
                btrfs_set_stack_inode_nlink(dst, 1);
        }
+       if (S_ISREG(src->i_mode)) {
+               btrfs_set_stack_inode_size(dst, (u64)src->i_size_high << 32 |
+                                          (u64)src->i_size);
+       }
        if (!S_ISREG(src->i_mode) && !S_ISDIR(src->i_mode) &&
            !S_ISLNK(src->i_mode)) {
                if (src->i_block[0]) {