Commit 71951f35 authored by Chris Mason's avatar Chris Mason Committed by David Woodhouse

Btrfs: add generation field to file extent

Signed-off-by: default avatarChris Mason <chris.mason@oracle.com>
parent 9a6f11ed
...@@ -192,6 +192,7 @@ struct btrfs_root_item { ...@@ -192,6 +192,7 @@ struct btrfs_root_item {
} __attribute__ ((__packed__)); } __attribute__ ((__packed__));
struct btrfs_file_extent_item { struct btrfs_file_extent_item {
__le64 generation;
/* /*
* disk space consumed by the extent, checksum blocks are included * disk space consumed by the extent, checksum blocks are included
* in these numbers * in these numbers
...@@ -764,6 +765,18 @@ static inline void btrfs_set_file_extent_disk_blocknr(struct ...@@ -764,6 +765,18 @@ static inline void btrfs_set_file_extent_disk_blocknr(struct
e->disk_blocknr = cpu_to_le64(val); 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 static inline u64 btrfs_file_extent_disk_num_blocks(struct
btrfs_file_extent_item *e) btrfs_file_extent_item *e)
{ {
......
...@@ -32,6 +32,7 @@ int btrfs_alloc_file_extent(struct btrfs_trans_handle *trans, ...@@ -32,6 +32,7 @@ int btrfs_alloc_file_extent(struct btrfs_trans_handle *trans,
btrfs_set_file_extent_disk_num_blocks(item, ins.offset); btrfs_set_file_extent_disk_num_blocks(item, ins.offset);
btrfs_set_file_extent_offset(item, 0); btrfs_set_file_extent_offset(item, 0);
btrfs_set_file_extent_num_blocks(item, ins.offset); btrfs_set_file_extent_num_blocks(item, ins.offset);
btrfs_set_file_extent_generation(item, trans->transid);
mark_buffer_dirty(path.nodes[0]); mark_buffer_dirty(path.nodes[0]);
*result = ins.objectid; *result = ins.objectid;
btrfs_release_path(root, &path); btrfs_release_path(root, &path);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment