aboutsummaryrefslogtreecommitdiffstats
path: root/fs/btrfs
diff options
context:
space:
mode:
authorChris Mason <chris.mason@oracle.com>2007-03-27 09:16:29 -0400
committerDavid Woodhouse <dwmw2@hera.kernel.org>2007-03-27 09:16:29 -0400
commit71951f35a6e413f2bfbd41829af8cf10a890aeb6 (patch)
treeeef4dd2ab8dd6af6353c9600b6613b8ca50691c4 /fs/btrfs
parent9a6f11ed8f421fb1cc7b37390e32316ff4701f5d (diff)
Btrfs: add generation field to file extent
Signed-off-by: Chris Mason <chris.mason@oracle.com>
Diffstat (limited to 'fs/btrfs')
-rw-r--r--fs/btrfs/ctree.h13
-rw-r--r--fs/btrfs/file-item.c1
2 files changed, 14 insertions, 0 deletions
diff --git a/fs/btrfs/ctree.h b/fs/btrfs/ctree.h
index a4ad39b58a4b..c3fa12a6b59e 100644
--- a/fs/btrfs/ctree.h
+++ b/fs/btrfs/ctree.h
@@ -192,6 +192,7 @@ struct btrfs_root_item {
192} __attribute__ ((__packed__)); 192} __attribute__ ((__packed__));
193 193
194struct btrfs_file_extent_item { 194struct btrfs_file_extent_item {
195 __le64 generation;
195 /* 196 /*
196 * disk space consumed by the extent, checksum blocks are included 197 * disk space consumed by the extent, checksum blocks are included
197 * in these numbers 198 * in these numbers
@@ -764,6 +765,18 @@ static inline void btrfs_set_file_extent_disk_blocknr(struct
764 e->disk_blocknr = cpu_to_le64(val); 765 e->disk_blocknr = cpu_to_le64(val);
765} 766}
766 767
768static inline u64 btrfs_file_extent_generation(struct btrfs_file_extent_item *e)
769{
770 return le64_to_cpu(e->generation);
771}
772
773static inline void btrfs_set_file_extent_generation(struct
774 btrfs_file_extent_item *e,
775 u64 val)
776{
777 e->generation = cpu_to_le64(val);
778}
779
767static inline u64 btrfs_file_extent_disk_num_blocks(struct 780static inline u64 btrfs_file_extent_disk_num_blocks(struct
768 btrfs_file_extent_item *e) 781 btrfs_file_extent_item *e)
769{ 782{
diff --git a/fs/btrfs/file-item.c b/fs/btrfs/file-item.c
index 4a0367d702b7..09de270c5a52 100644
--- a/fs/btrfs/file-item.c
+++ b/fs/btrfs/file-item.c
@@ -32,6 +32,7 @@ int btrfs_alloc_file_extent(struct btrfs_trans_handle *trans,
32 btrfs_set_file_extent_disk_num_blocks(item, ins.offset); 32 btrfs_set_file_extent_disk_num_blocks(item, ins.offset);
33 btrfs_set_file_extent_offset(item, 0); 33 btrfs_set_file_extent_offset(item, 0);
34 btrfs_set_file_extent_num_blocks(item, ins.offset); 34 btrfs_set_file_extent_num_blocks(item, ins.offset);
35 btrfs_set_file_extent_generation(item, trans->transid);
35 mark_buffer_dirty(path.nodes[0]); 36 mark_buffer_dirty(path.nodes[0]);
36 *result = ins.objectid; 37 *result = ins.objectid;
37 btrfs_release_path(root, &path); 38 btrfs_release_path(root, &path);