aboutsummaryrefslogtreecommitdiffstats
path: root/fs/btrfs/ordered-data.h
diff options
context:
space:
mode:
authorBoris Burkov <[email protected]>2023-03-28 05:19:47 +0000
committerDavid Sterba <[email protected]>2023-04-17 16:01:21 +0000
commitcf6d1aa482fb17b9d04d6bc8f134f7ec4425398f (patch)
tree8e17ef6cf0b67fb8bfac2cc692ffb6d7f0359eab /fs/btrfs/ordered-data.h
parentbtrfs: use __bio_add_page to add single a page in rbio_add_io_sector (diff)
downloadkernel-cf6d1aa482fb17b9d04d6bc8f134f7ec4425398f.tar.gz
kernel-cf6d1aa482fb17b9d04d6bc8f134f7ec4425398f.zip
btrfs: add function to create and return an ordered extent
Currently, btrfs_add_ordered_extent allocates a new ordered extent, adds it to the rb_tree, but doesn't return a referenced pointer to the caller. There are cases where it is useful for the creator of a new ordered_extent to hang on to such a pointer, so add a new function btrfs_alloc_ordered_extent which is the same as btrfs_add_ordered_extent, except it takes an additional reference count and returns a pointer to the ordered_extent. Implement btrfs_add_ordered_extent as btrfs_alloc_ordered_extent followed by dropping the new reference and handling the IS_ERR case. The type of flags in btrfs_alloc_ordered_extent and btrfs_add_ordered_extent is changed from unsigned int to unsigned long so it's unified with the other ordered extent functions. Reviewed-by: Filipe Manana <[email protected]> Reviewed-by: Christoph Hellwig <[email protected]> Reviewed-by: Naohiro Aota <[email protected]> Reviewed-by: Josef Bacik <[email protected]> Tested-by: Johannes Thumshirn <[email protected]> Signed-off-by: Boris Burkov <[email protected]> Signed-off-by: Christoph Hellwig <[email protected]> Reviewed-by: David Sterba <[email protected]> Signed-off-by: David Sterba <[email protected]>
Diffstat (limited to 'fs/btrfs/ordered-data.h')
-rw-r--r--fs/btrfs/ordered-data.h5
1 files changed, 5 insertions, 0 deletions
diff --git a/fs/btrfs/ordered-data.h b/fs/btrfs/ordered-data.h
index eb40cb39f842..c00a5a3f060f 100644
--- a/fs/btrfs/ordered-data.h
+++ b/fs/btrfs/ordered-data.h
@@ -178,6 +178,11 @@ void btrfs_mark_ordered_io_finished(struct btrfs_inode *inode,
bool btrfs_dec_test_ordered_pending(struct btrfs_inode *inode,
struct btrfs_ordered_extent **cached,
u64 file_offset, u64 io_size);
+struct btrfs_ordered_extent *btrfs_alloc_ordered_extent(
+ struct btrfs_inode *inode, u64 file_offset,
+ u64 num_bytes, u64 ram_bytes, u64 disk_bytenr,
+ u64 disk_num_bytes, u64 offset, unsigned long flags,
+ int compress_type);
int btrfs_add_ordered_extent(struct btrfs_inode *inode, u64 file_offset,
u64 num_bytes, u64 ram_bytes, u64 disk_bytenr,
u64 disk_num_bytes, u64 offset, unsigned flags,