Help with btrfs_zero_range function

From: Nick Krause
Date: Thu Jul 31 2014 - 23:26:13 EST

Hey Guys,
I need to ask a question again, I am writing the above function and
basing it off the one of punch hole.
I have only started writing the function and have a few questions
about how to write this. Below this message
are my questions so fair and I also posting my written code in case
you guys want to give any feed back.
Regards and Thanks Again,
1. bool no_holes = btrfs_fs_incompat(root->fs_info, NO_HOLES);
How I change this to check for a zero range or do I just remove
this variable;
2. ret = find_first_non_hole(inode, &offset, &len);
How do I modify the called function for ret to be for a zero range?
The other parts of this function are pretty similar to the one for
punch holes and seems pretty easy
to move other the other parts.

static long btrfs_zero_range(struct inode *inode, loff_t loffset,
loff_t len,){
struct btrfs_root *root = BTRF_I(inode)->root;
struct btrfs_path *path;
struct btrfs_block_rsv *rsv;
struct btrfs_trans_handle *trans;
u64 lockstart;
u64 lockend;
u64 tail_start;
u64 tail_len;
u64 orig_start = offset;
u64 cur_offset;
u64 min_size = btrfs_calc_trunc_metadata_size(root, 1);
u64 drop_end;
int ret = 0;
int err = 0;
int rsv_count;
bool same_page;
bool no_holes = btrfs_fs_incompat(root->fs_info, NO_HOLES);
u64 ino_size;
ret=btrfs_wait_ordered_range(inode, offset, len);
return ret;
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at
Please read the FAQ at