Re: Help with btrfs_zero_range function

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Please forget my other questions , seems the only work to make punch
hole work for zero range is to
make a function like the one I am pasting below for zero range and
change the calls to punch range to
zero range as the other parts of the function can be the same from my reading.
Regards Nick
static int find_first_non_hole(struct inode *inode, u64 *start, u64 *len)
{
    struct extent_map *em;
    int ret = 0;

    em = btrfs_get_extent(inode, NULL, 0, *start, *len, 0);
    if (IS_ERR_OR_NULL(em)) {
        if (!em)
            ret = -ENOMEM;
        else
            ret = PTR_ERR(em);
        return ret;
    }

    /* Hole or vacuum extent(only exists in no-hole mode) */
    if (em->block_start == EXTENT_MAP_HOLE) {
        ret = 1;
        *len = em->start + em->len > *start + *len ?
               0 : *start + *len - em->start - em->len;
        *start = em->start + em->len;
    }
    free_extent_map(em);
    return ret;
}
--
To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Index of Archives]     [Linux Filesystem Development]     [Linux NFS]     [Linux NILFS]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux