[Btrfs-devel] Some queries about map_extent_buffer()
Zhu Yanhai
piggestpig at gmail.com
Sun Mar 16 19:31:55 PDT 2008
> So problems like leakage can easily occurred. For example, after the
> map_extent_buffer(), followed by the "continue", the
> unmap_extent_buffer() will not be called, a problem???? I am not sure,
> as I don't fully understand the code yet :-). (And the
> map_extent_buffer will be called again, using KM_USER1, without the
> previous one being unmap?).
First, at the end of all of these (that is to say, the end of function
btrfs_realloc_node), there is:
if (parent->map_token) {
unmap_extent_buffer(parent, parent->map_token,KM_USER1);
parent->map_token = NULL;
}
return err;
It can make sure that we can call unmap_extent_buffer anyway when we
get out of the function (of course, if parent->map_token != NULL).
Also, at the very beginning of map_extent_buffer, there is :
if (eb->map_token) {
unmap_extent_buffer(eb, eb->map_token, km);
eb->map_token = NULL;
save = 1;
}
So if we feed a mapped extent buffer into the function, it will unmap
it at first, and then call map_private_extent_buffer to map it.
Regards,
ZYH
--
- Zhu Yanhai
More information about the Btrfs-devel
mailing list