path: root/ctree.h
diff options
authorQu Wenruo <>2015-01-02 15:12:30 +0800
committerDavid Sterba <>2015-02-02 14:16:38 +0100
commitaae2c8421bb39014ed606b7bd9f37641c27d5a52 (patch)
treeb78b33e993cfb5cea578eb77472f2cf9578c75dc /ctree.h
parent0ddf63c09f2e24cd8f94e662c93055099fff2e2c (diff)
btrfs-progs: Add btrfs_get_extent() and btrfs_punch_hole().
Add btrfs_get_extent() and btrfs_punch_hole() for btrfs-progs. Btrfs_get_extent() will act much like kernel one, return the first extent that covers the given range. The difference will be that progs btrfs_get_extent() can't handle no-holes feature, which means caller should handle it carefully. Btrfs_punch_hole() will punch a hole in given range of given inode, however it differs from kernel one since it won't zero any page or drop any extents if there is any extent in the hole range. These functions are mainly used for later I_ERR_FILE_EXTENT_DISCOUNT repair function. Signed-off-by: Qu Wenruo <> Signed-off-by: David Sterba <>
Diffstat (limited to 'ctree.h')
1 files changed, 9 insertions, 0 deletions
diff --git a/ctree.h b/ctree.h
index a8b99422..2d2988b1 100644
--- a/ctree.h
+++ b/ctree.h
@@ -2468,4 +2468,13 @@ int btrfs_add_orphan_item(struct btrfs_trans_handle *trans,
u64 ino);
int btrfs_mkdir(struct btrfs_trans_handle *trans, struct btrfs_root *root,
char *name, int namelen, u64 parent_ino, u64 *ino, int mode);
+/* file.c */
+int btrfs_get_extent(struct btrfs_trans_handle *trans,
+ struct btrfs_root *root,
+ struct btrfs_path *path,
+ u64 ino, u64 offset, u64 len, int ins_len);
+int btrfs_punch_hole(struct btrfs_trans_handle *trans,
+ struct btrfs_root *root,
+ u64 ino, u64 offset, u64 len);