} __attribute__ ((__packed__));
 
 struct btrfs_file_extent_item {
+       __le64 generation;
        /*
         * disk space consumed by the extent, checksum blocks are included
         * in these numbers
        e->disk_blocknr = cpu_to_le64(val);
 }
 
+static inline u64 btrfs_file_extent_generation(struct btrfs_file_extent_item *e)
+{
+       return le64_to_cpu(e->generation);
+}
+
+static inline void btrfs_set_file_extent_generation(struct
+                                                   btrfs_file_extent_item *e,
+                                                   u64 val)
+{
+       e->generation = cpu_to_le64(val);
+}
+
 static inline u64 btrfs_file_extent_disk_num_blocks(struct
                                                    btrfs_file_extent_item *e)
 {
 
        btrfs_set_file_extent_disk_num_blocks(item, ins.offset);
        btrfs_set_file_extent_offset(item, 0);
        btrfs_set_file_extent_num_blocks(item, ins.offset);
+       btrfs_set_file_extent_generation(item, trans->transid);
        mark_buffer_dirty(path.nodes[0]);
        *result = ins.objectid;
        btrfs_release_path(root, &path);