Btrfs image tool
[platform/upstream/btrfs-progs.git] / file-item.c
index 2639901..e5f5dea 100644 (file)
@@ -136,11 +136,11 @@ int btrfs_insert_inline_extent(struct btrfs_trans_handle *trans,
                        err = ret;
                        btrfs_print_leaf(root, leaf);
                        printk("found wasn't inline offset %llu inode %llu\n",
-                              offset, objectid);
+                              (unsigned long long)offset,
+                              (unsigned long long)objectid);
                        goto fail;
                }
-               found_size = btrfs_file_extent_inline_len(leaf,
-                                         btrfs_item_nr(leaf, path->slots[0]));
+               found_size = btrfs_file_extent_inline_len(leaf, ei);
                found_end = key.offset + found_size;
 
                if (found_end < offset + size) {
@@ -385,6 +385,12 @@ csum:
 found:
        csum_result = btrfs_csum_data(root, data, csum_result, len);
        btrfs_csum_final(csum_result, (char *)&csum_result);
+       if (csum_result == 0) {
+               printk("csum result is 0 for inode %llu offset %llu\n",
+                      (unsigned long long)objectid,
+                      (unsigned long long)offset);
+       }
+
        write_extent_buffer(leaf, &csum_result, (unsigned long)item,
                            BTRFS_CRC32_SIZE);
        btrfs_mark_buffer_dirty(path->nodes[0]);