+ printf("\tUnshared space: \t%s\n",
+ pretty_size(freeable_bytes));
There's no reason to have a local variable:
printf("\tUnshared space: \t%s\n",
pretty_size(get_subvol_freeable_bytes(fd));
this is taken care.
These two fiddly functions only differ in the tree search and what they
do with each item. So replace them with a function that takes a
description of the search and calls the caller's callback for each item.
typedef void (*item_func_t)(struct btrfs_key *key, void *data, void
*arg);
int btrfs_for_each_item(int fd, min and max and junk,
item_func_t func, void *arg);
u64 get_subvol_freeable_bytes(int fd)
{
u64 size_bytes = 0;
btrfs_for_each_item(fd, ...., sum_extents, &size_bytes);
return size_bytes;
}
Etc. You get the idea.
Will fix them. Thanks !
-Anand
this is to avoid duplicate codes, which indeed spans across
most of the search functions that's in there in btrfs-progs.
what you suggest is good, but its better to do that collectively.
Thanks, Anand
--
To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in
the body of a message to majord...@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html