[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAPDOMVjF_6mRWDLbZLXsr5F2PT3H-GW=rQdF7Yt9LYdKayGdVQ@mail.gmail.com>
Date: Fri, 1 Aug 2014 12:58:16 -0400
From: Nick Krause <xerofoify@...il.com>
To: "linux-btrfs@...r.kernel.org SYSTEM list:BTRFS FILE"
<linux-btrfs@...r.kernel.org>,
"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>
Subject: Re: Help with btrfs_zero_range function
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-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists