[Btrfs-devel] [PATCH] Fix btrfs-convert's large file support.

Zhu Yanhai piggestpig at gmail.com
Sun Apr 27 23:03:57 PDT 2008


Hello,
  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.

Regards,
Zhu Yanhai

----
diff -r 1c218a5b9784 convert.c
--- a/convert.c	Fri Apr 25 16:55:21 2008 -0400
+++ b/convert.c	Mon Apr 28 13:01:58 2008 +0800
@@ -928,6 +928,10 @@ static int copy_inode_item(struct btrfs_
 		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]) {



More information about the Btrfs-devel mailing list