aboutsummaryrefslogtreecommitdiffstats
path: root/fs/btrfs/ioctl.c
diff options
context:
space:
mode:
Diffstat (limited to 'fs/btrfs/ioctl.c')
-rw-r--r--fs/btrfs/ioctl.c37
1 files changed, 18 insertions, 19 deletions
diff --git a/fs/btrfs/ioctl.c b/fs/btrfs/ioctl.c
index ba484aac1b9c..c2aa33e3feb5 100644
--- a/fs/btrfs/ioctl.c
+++ b/fs/btrfs/ioctl.c
@@ -311,7 +311,7 @@ static noinline int btrfs_mksubvol(struct path *parent, char *name,
311 * to see if is references the subvolume where we are 311 * to see if is references the subvolume where we are
312 * placing this new snapshot. 312 * placing this new snapshot.
313 */ 313 */
314 while(1) { 314 while (1) {
315 if (!test || 315 if (!test ||
316 dir == snap_src->fs_info->sb->s_root || 316 dir == snap_src->fs_info->sb->s_root ||
317 test == snap_src->fs_info->sb->s_root || 317 test == snap_src->fs_info->sb->s_root ||
@@ -319,7 +319,8 @@ static noinline int btrfs_mksubvol(struct path *parent, char *name,
319 break; 319 break;
320 } 320 }
321 if (S_ISLNK(test->d_inode->i_mode)) { 321 if (S_ISLNK(test->d_inode->i_mode)) {
322 printk("Symlink in snapshot path, failed\n"); 322 printk(KERN_INFO "Btrfs symlink in snapshot "
323 "path, failed\n");
323 error = -EMLINK; 324 error = -EMLINK;
324 btrfs_free_path(path); 325 btrfs_free_path(path);
325 goto out_drop_write; 326 goto out_drop_write;
@@ -329,7 +330,8 @@ static noinline int btrfs_mksubvol(struct path *parent, char *name,
329 ret = btrfs_find_root_ref(snap_src->fs_info->tree_root, 330 ret = btrfs_find_root_ref(snap_src->fs_info->tree_root,
330 path, test_oid, parent_oid); 331 path, test_oid, parent_oid);
331 if (ret == 0) { 332 if (ret == 0) {
332 printk("Snapshot creation failed, looping\n"); 333 printk(KERN_INFO "Btrfs snapshot creation "
334 "failed, looping\n");
333 error = -EMLINK; 335 error = -EMLINK;
334 btrfs_free_path(path); 336 btrfs_free_path(path);
335 goto out_drop_write; 337 goto out_drop_write;
@@ -617,7 +619,8 @@ static noinline int btrfs_ioctl_snap_create(struct file *file,
617 619
618 src_inode = src_file->f_path.dentry->d_inode; 620 src_inode = src_file->f_path.dentry->d_inode;
619 if (src_inode->i_sb != file->f_path.dentry->d_inode->i_sb) { 621 if (src_inode->i_sb != file->f_path.dentry->d_inode->i_sb) {
620 printk("btrfs: Snapshot src from another FS\n"); 622 printk(KERN_INFO "btrfs: Snapshot src from "
623 "another FS\n");
621 ret = -EINVAL; 624 ret = -EINVAL;
622 fput(src_file); 625 fput(src_file);
623 goto out; 626 goto out;
@@ -810,9 +813,6 @@ static long btrfs_ioctl_clone(struct file *file, unsigned long srcfd,
810 ((off + len) & (bs-1))) 813 ((off + len) & (bs-1)))
811 goto out_unlock; 814 goto out_unlock;
812 815
813 printk("final src extent is %llu~%llu\n", off, len);
814 printk("final dst extent is %llu~%llu\n", destoff, len);
815
816 /* do any pending delalloc/csum calc on src, one way or 816 /* do any pending delalloc/csum calc on src, one way or
817 another, and lock file content */ 817 another, and lock file content */
818 while (1) { 818 while (1) {
@@ -883,10 +883,13 @@ static long btrfs_ioctl_clone(struct file *file, unsigned long srcfd,
883 comp = btrfs_file_extent_compression(leaf, extent); 883 comp = btrfs_file_extent_compression(leaf, extent);
884 type = btrfs_file_extent_type(leaf, extent); 884 type = btrfs_file_extent_type(leaf, extent);
885 if (type == BTRFS_FILE_EXTENT_REG) { 885 if (type == BTRFS_FILE_EXTENT_REG) {
886 disko = btrfs_file_extent_disk_bytenr(leaf, extent); 886 disko = btrfs_file_extent_disk_bytenr(leaf,
887 diskl = btrfs_file_extent_disk_num_bytes(leaf, extent); 887 extent);
888 diskl = btrfs_file_extent_disk_num_bytes(leaf,
889 extent);
888 datao = btrfs_file_extent_offset(leaf, extent); 890 datao = btrfs_file_extent_offset(leaf, extent);
889 datal = btrfs_file_extent_num_bytes(leaf, extent); 891 datal = btrfs_file_extent_num_bytes(leaf,
892 extent);
890 } else if (type == BTRFS_FILE_EXTENT_INLINE) { 893 } else if (type == BTRFS_FILE_EXTENT_INLINE) {
891 /* take upper bound, may be compressed */ 894 /* take upper bound, may be compressed */
892 datal = btrfs_file_extent_ram_bytes(leaf, 895 datal = btrfs_file_extent_ram_bytes(leaf,
@@ -916,8 +919,6 @@ static long btrfs_ioctl_clone(struct file *file, unsigned long srcfd,
916 919
917 extent = btrfs_item_ptr(leaf, slot, 920 extent = btrfs_item_ptr(leaf, slot,
918 struct btrfs_file_extent_item); 921 struct btrfs_file_extent_item);
919 printk(" orig disk %llu~%llu data %llu~%llu\n",
920 disko, diskl, datao, datal);
921 922
922 if (off > key.offset) { 923 if (off > key.offset) {
923 datao += off - key.offset; 924 datao += off - key.offset;
@@ -929,8 +930,6 @@ static long btrfs_ioctl_clone(struct file *file, unsigned long srcfd,
929 /* disko == 0 means it's a hole */ 930 /* disko == 0 means it's a hole */
930 if (!disko) 931 if (!disko)
931 datao = 0; 932 datao = 0;
932 printk(" final disk %llu~%llu data %llu~%llu\n",
933 disko, diskl, datao, datal);
934 933
935 btrfs_set_file_extent_offset(leaf, extent, 934 btrfs_set_file_extent_offset(leaf, extent,
936 datao); 935 datao);
@@ -952,12 +951,11 @@ static long btrfs_ioctl_clone(struct file *file, unsigned long srcfd,
952 skip = off - key.offset; 951 skip = off - key.offset;
953 new_key.offset += skip; 952 new_key.offset += skip;
954 } 953 }
954
955 if (key.offset + datal > off+len) 955 if (key.offset + datal > off+len)
956 trim = key.offset + datal - (off+len); 956 trim = key.offset + datal - (off+len);
957 printk("len %lld skip %lld trim %lld\n", 957
958 datal, skip, trim);
959 if (comp && (skip || trim)) { 958 if (comp && (skip || trim)) {
960 printk("btrfs clone_range can't split compressed inline extents yet\n");
961 ret = -EINVAL; 959 ret = -EINVAL;
962 goto out; 960 goto out;
963 } 961 }
@@ -969,7 +967,8 @@ static long btrfs_ioctl_clone(struct file *file, unsigned long srcfd,
969 goto out; 967 goto out;
970 968
971 if (skip) { 969 if (skip) {
972 u32 start = btrfs_file_extent_calc_inline_size(0); 970 u32 start =
971 btrfs_file_extent_calc_inline_size(0);
973 memmove(buf+start, buf+start+skip, 972 memmove(buf+start, buf+start+skip,
974 datal); 973 datal);
975 } 974 }
@@ -985,7 +984,7 @@ static long btrfs_ioctl_clone(struct file *file, unsigned long srcfd,
985 btrfs_mark_buffer_dirty(leaf); 984 btrfs_mark_buffer_dirty(leaf);
986 } 985 }
987 986
988 next: 987next:
989 btrfs_release_path(root, path); 988 btrfs_release_path(root, path);
990 key.offset++; 989 key.offset++;
991 } 990 }