return err;
 }
 
-void extent_clear_unlock_delalloc(struct inode *inode, u64 start, u64 end,
+void extent_clear_unlock_delalloc(struct btrfs_inode *inode, u64 start, u64 end,
                                  struct page *locked_page,
                                  unsigned clear_bits,
                                  unsigned long page_ops)
 {
-       clear_extent_bit(&BTRFS_I(inode)->io_tree, start, end, clear_bits, 1, 0,
-                        NULL);
+       clear_extent_bit(&inode->io_tree, start, end, clear_bits, 1, 0, NULL);
 
-       __process_pages_contig(inode->i_mapping, locked_page,
+       __process_pages_contig(inode->vfs_inode.i_mapping, locked_page,
                               start >> PAGE_SHIFT, end >> PAGE_SHIFT,
                               page_ops, NULL);
 }
 
                         * our outstanding extent for clearing delalloc for this
                         * range.
                         */
-                       extent_clear_unlock_delalloc(inode, start, end, NULL,
+                       extent_clear_unlock_delalloc(BTRFS_I(inode), start, end,
+                                                    NULL,
                                                     clear_flags,
                                                     PAGE_UNLOCK |
                                                     PAGE_CLEAR_DIRTY |
                /*
                 * clear dirty, set writeback and unlock the pages.
                 */
-               extent_clear_unlock_delalloc(inode, async_extent->start,
+               extent_clear_unlock_delalloc(BTRFS_I(inode), async_extent->start,
                                async_extent->start +
                                async_extent->ram_size - 1,
                                NULL, EXTENT_LOCKED | EXTENT_DELALLOC,
                        btrfs_writepage_endio_finish_ordered(p, start, end, 0);
 
                        p->mapping = NULL;
-                       extent_clear_unlock_delalloc(inode, start, end,
+                       extent_clear_unlock_delalloc(BTRFS_I(inode), start, end,
                                                     NULL, 0,
                                                     PAGE_END_WRITEBACK |
                                                     PAGE_SET_ERROR);
        btrfs_dec_block_group_reservations(fs_info, ins.objectid);
        btrfs_free_reserved_extent(fs_info, ins.objectid, ins.offset, 1);
 out_free:
-       extent_clear_unlock_delalloc(inode, async_extent->start,
+       extent_clear_unlock_delalloc(BTRFS_I(inode), async_extent->start,
                                     async_extent->start +
                                     async_extent->ram_size - 1,
                                     NULL, EXTENT_LOCKED | EXTENT_DELALLOC |
                         * our outstanding extent for clearing delalloc for this
                         * range.
                         */
-                       extent_clear_unlock_delalloc(inode, start, end, NULL,
+                       extent_clear_unlock_delalloc(BTRFS_I(inode), start, end,
+                                    NULL,
                                     EXTENT_LOCKED | EXTENT_DELALLOC |
                                     EXTENT_DELALLOC_NEW | EXTENT_DEFRAG |
                                     EXTENT_DO_ACCOUNTING, PAGE_UNLOCK |
                page_ops = unlock ? PAGE_UNLOCK : 0;
                page_ops |= PAGE_SET_PRIVATE2;
 
-               extent_clear_unlock_delalloc(inode, start,
+               extent_clear_unlock_delalloc(BTRFS_I(inode), start,
                                             start + ram_size - 1,
                                             locked_page,
                                             EXTENT_LOCKED | EXTENT_DELALLOC,
         * it the flag EXTENT_CLEAR_DATA_RESV.
         */
        if (extent_reserved) {
-               extent_clear_unlock_delalloc(inode, start,
+               extent_clear_unlock_delalloc(BTRFS_I(inode), start,
                                             start + cur_alloc_size - 1,
                                             locked_page,
                                             clear_bits,
                if (start >= end)
                        goto out;
        }
-       extent_clear_unlock_delalloc(inode, start, end, locked_page,
+       extent_clear_unlock_delalloc(BTRFS_I(inode), start, end, locked_page,
                                     clear_bits | EXTENT_CLEAR_DATA_RESV,
                                     page_ops);
        goto out;
                        PAGE_SET_WRITEBACK | PAGE_END_WRITEBACK |
                        PAGE_SET_ERROR;
 
-               extent_clear_unlock_delalloc(inode, start, end, locked_page,
-                                            clear_bits, page_ops);
+               extent_clear_unlock_delalloc(BTRFS_I(inode), start, end,
+                                            locked_page, clear_bits, page_ops);
                return -ENOMEM;
        }
 
 
        path = btrfs_alloc_path();
        if (!path) {
-               extent_clear_unlock_delalloc(inode, start, end, locked_page,
+               extent_clear_unlock_delalloc(BTRFS_I(inode), start, end,
+                                            locked_page,
                                             EXTENT_LOCKED | EXTENT_DELALLOC |
                                             EXTENT_DO_ACCOUNTING |
                                             EXTENT_DEFRAG, PAGE_UNLOCK |
                        ret = btrfs_reloc_clone_csums(BTRFS_I(inode), cur_offset,
                                                      num_bytes);
 
-               extent_clear_unlock_delalloc(inode, cur_offset,
+               extent_clear_unlock_delalloc(BTRFS_I(inode), cur_offset,
                                             cur_offset + num_bytes - 1,
                                             locked_page, EXTENT_LOCKED |
                                             EXTENT_DELALLOC |
                btrfs_dec_nocow_writers(fs_info, disk_bytenr);
 
        if (ret && cur_offset < end)
-               extent_clear_unlock_delalloc(inode, cur_offset, end,
+               extent_clear_unlock_delalloc(BTRFS_I(inode), cur_offset, end,
                                             locked_page, EXTENT_LOCKED |
                                             EXTENT_DELALLOC | EXTENT_DEFRAG |
                                             EXTENT_DO_ACCOUNTING, PAGE_UNLOCK |