@@ -2539,6 +2539,16 @@ static void fill_inode_item(struct btrfs_trans_handle *trans,
struct btrfs_inode_item *item,
struct inode *inode)
{
+ int unmap_on_exit;
+
+ unmap_on_exit = (leaf->map_token == NULL);
+ if (unmap_on_exit)
+ map_extent_buffer(leaf, (unsigned long)item,
+ sizeof(*item), &leaf->map_token,
+ &leaf->kaddr, &leaf->map_start,
+ &leaf->map_len, KM_USER1);
+
+
btrfs_set_inode_uid(leaf, item, inode->i_uid);
btrfs_set_inode_gid(leaf, item, inode->i_gid);
btrfs_set_inode_size(leaf, item, BTRFS_I(inode)->disk_i_size);
@@ -2567,6 +2577,11 @@ static void fill_inode_item(struct btrfs_trans_handle *trans,
btrfs_set_inode_rdev(leaf, item, inode->i_rdev);
btrfs_set_inode_flags(leaf, item, BTRFS_I(inode)->flags);
btrfs_set_inode_block_group(leaf, item, BTRFS_I(inode)->block_group);
+
+ if (unmap_on_exit && leaf->map_token) {
+ unmap_extent_buffer(leaf, leaf->map_token, KM_USER1);
+ leaf->map_token = NULL;
+ }
}
/*