diff options
author | Josef Bacik <jbacik@fusionio.com> | 2012-10-12 15:27:49 -0400 |
---|---|---|
committer | Josef Bacik <jbacik@fusionio.com> | 2013-02-20 09:37:04 -0500 |
commit | 2ab28f322f9896782da904f5942f3873432addc8 (patch) | |
tree | d8d136d90b96f96d63262f8d2eb11680bed80aab /fs/btrfs/ordered-data.h | |
parent | dfd79829b709af3c2ac55951353a874ae89f41c3 (diff) | |
download | linux-2ab28f322f9896782da904f5942f3873432addc8.tar.gz linux-2ab28f322f9896782da904f5942f3873432addc8.tar.bz2 linux-2ab28f322f9896782da904f5942f3873432addc8.zip |
Btrfs: wait on ordered extents at the last possible moment
Since we don't actually copy the extent information from the source tree in
the fast case we don't need to wait for ordered io to be completed in order
to fsync, we just need to wait for the io to be completed. So when we're
logging our file just attach all of the ordered extents to the log, and then
when the log syncs just wait for IO_DONE on the ordered extents and then
write the super. Thanks,
Signed-off-by: Josef Bacik <jbacik@fusionio.com>
Diffstat (limited to 'fs/btrfs/ordered-data.h')
-rw-r--r-- | fs/btrfs/ordered-data.h | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/fs/btrfs/ordered-data.h b/fs/btrfs/ordered-data.h index efc7c2930c17..d523dbd2314d 100644 --- a/fs/btrfs/ordered-data.h +++ b/fs/btrfs/ordered-data.h @@ -79,6 +79,8 @@ struct btrfs_ordered_sum { #define BTRFS_ORDERED_UPDATED_ISIZE 7 /* indicates wether this ordered extent * has done its due diligence in updating * the isize. */ +#define BTRFS_ORDERED_LOGGED_CSUM 8 /* We've logged the csums on this ordered + ordered extent */ struct btrfs_ordered_extent { /* logical offset in the file */ @@ -96,6 +98,9 @@ struct btrfs_ordered_extent { /* number of bytes that still need writing */ u64 bytes_left; + /* number of bytes that still need csumming */ + u64 csum_bytes_left; + /* * the end of the ordered extent which is behind it but * didn't update disk_i_size. Please see the comment of @@ -118,6 +123,9 @@ struct btrfs_ordered_extent { /* list of checksums for insertion when the extent io is done */ struct list_head list; + /* If we need to wait on this to be done */ + struct list_head log_list; + /* used to wait for the BTRFS_ORDERED_COMPLETE bit */ wait_queue_head_t wait; @@ -194,6 +202,9 @@ void btrfs_add_ordered_operation(struct btrfs_trans_handle *trans, struct btrfs_root *root, struct inode *inode); void btrfs_wait_ordered_extents(struct btrfs_root *root, int delay_iput); +void btrfs_get_logged_extents(struct btrfs_root *log, struct inode *inode); +void btrfs_wait_logged_extents(struct btrfs_root *log, u64 transid); +void btrfs_free_logged_extents(struct btrfs_root *log, u64 transid); int __init ordered_data_init(void); void ordered_data_exit(void); #endif |