forked from Mirrors/btrfs-progs
btrfs-progs: use standard allocation functions in non-kenrel code
Signed-off-by: David Sterba <dsterba@suse.com>master
parent
b80a4641e5
commit
1ed3426d3f
|
@ -2598,7 +2598,7 @@ static int may_rollback(struct btrfs_root *root)
|
|||
|
||||
num_stripes = multi->num_stripes;
|
||||
physical = multi->stripes[0].physical;
|
||||
kfree(multi);
|
||||
free(multi);
|
||||
|
||||
if (num_stripes != 1) {
|
||||
error("num stripes for bytenr %llu is not 1", bytenr);
|
||||
|
|
|
@ -65,7 +65,7 @@ static int debug_corrupt_block(struct extent_buffer *eb,
|
|||
"mirror %d logical %llu physical %llu device %s\n",
|
||||
mirror_num, (unsigned long long)bytenr,
|
||||
(unsigned long long)eb->dev_bytenr, device->name);
|
||||
kfree(multi);
|
||||
free(multi);
|
||||
|
||||
if (!copy || mirror_num == copy) {
|
||||
ret = read_extent_from_disk(eb, 0, eb->len);
|
||||
|
|
|
@ -125,7 +125,7 @@ static int __print_mapping_info(struct btrfs_fs_info *fs_info, u64 logical,
|
|||
multi->stripes[0].physical,
|
||||
device->name);
|
||||
}
|
||||
kfree(multi);
|
||||
free(multi);
|
||||
multi = NULL;
|
||||
cur_offset += cur_len;
|
||||
}
|
||||
|
|
|
@ -968,7 +968,7 @@ static int build_device_map_by_chunk_record(struct btrfs_root *root,
|
|||
map->stripes[i].dev = btrfs_find_device(root, devid,
|
||||
uuid, NULL);
|
||||
if (!map->stripes[i].dev) {
|
||||
kfree(map);
|
||||
free(map);
|
||||
return -EIO;
|
||||
}
|
||||
}
|
||||
|
|
10
cmds-check.c
10
cmds-check.c
|
@ -3210,7 +3210,7 @@ static void free_root_record(struct cache_extent *cache)
|
|||
free(backref);
|
||||
}
|
||||
|
||||
kfree(rec);
|
||||
free(rec);
|
||||
}
|
||||
|
||||
FREE_EXTENT_CACHE_BASED_TREE(root_recs, free_root_record);
|
||||
|
@ -5474,7 +5474,7 @@ static int check_cache_range(struct btrfs_root *root,
|
|||
continue;
|
||||
if (logical[nr] == offset) {
|
||||
if (stripe_len >= bytes) {
|
||||
kfree(logical);
|
||||
free(logical);
|
||||
return 0;
|
||||
}
|
||||
bytes -= stripe_len;
|
||||
|
@ -5482,7 +5482,7 @@ static int check_cache_range(struct btrfs_root *root,
|
|||
} else if (logical[nr] < offset) {
|
||||
if (logical[nr] + stripe_len >=
|
||||
offset + bytes) {
|
||||
kfree(logical);
|
||||
free(logical);
|
||||
return 0;
|
||||
}
|
||||
bytes = (offset + bytes) -
|
||||
|
@ -5505,7 +5505,7 @@ static int check_cache_range(struct btrfs_root *root,
|
|||
offset,
|
||||
logical[nr] - offset);
|
||||
if (ret) {
|
||||
kfree(logical);
|
||||
free(logical);
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
@ -5516,7 +5516,7 @@ static int check_cache_range(struct btrfs_root *root,
|
|||
}
|
||||
}
|
||||
|
||||
kfree(logical);
|
||||
free(logical);
|
||||
}
|
||||
|
||||
entry = btrfs_find_free_space(cache->free_space_ctl, offset, bytes);
|
||||
|
|
|
@ -495,7 +495,7 @@ static int btrfs_scan_kernel(void *search, unsigned unit_mode)
|
|||
if ((fd != -1) && !get_df(fd, &space_info_arg)) {
|
||||
print_one_fs(&fs_info_arg, dev_info_arg,
|
||||
space_info_arg, label, unit_mode);
|
||||
kfree(space_info_arg);
|
||||
free(space_info_arg);
|
||||
memset(label, 0, sizeof(label));
|
||||
found = 1;
|
||||
}
|
||||
|
|
|
@ -356,7 +356,7 @@ again:
|
|||
dev_fd = device->fd;
|
||||
device->total_ios++;
|
||||
dev_bytenr = multi->stripes[0].physical;
|
||||
kfree(multi);
|
||||
free(multi);
|
||||
|
||||
if (size_left < length)
|
||||
length = size_left;
|
||||
|
|
10
utils.c
10
utils.c
|
@ -1621,12 +1621,12 @@ int btrfs_add_to_fsid(struct btrfs_trans_handle *trans,
|
|||
|
||||
device_total_bytes = (device_total_bytes / sectorsize) * sectorsize;
|
||||
|
||||
device = kzalloc(sizeof(*device), GFP_NOFS);
|
||||
device = calloc(1, sizeof(*device));
|
||||
if (!device) {
|
||||
ret = -ENOMEM;
|
||||
goto out;
|
||||
}
|
||||
buf = kzalloc(sectorsize, GFP_NOFS);
|
||||
buf = calloc(1, sectorsize);
|
||||
if (!buf) {
|
||||
ret = -ENOMEM;
|
||||
goto out;
|
||||
|
@ -1679,14 +1679,14 @@ int btrfs_add_to_fsid(struct btrfs_trans_handle *trans,
|
|||
ret = pwrite(fd, buf, sectorsize, BTRFS_SUPER_INFO_OFFSET);
|
||||
BUG_ON(ret != sectorsize);
|
||||
|
||||
kfree(buf);
|
||||
free(buf);
|
||||
list_add(&device->dev_list, &root->fs_info->fs_devices->devices);
|
||||
device->fs_devices = root->fs_info->fs_devices;
|
||||
return 0;
|
||||
|
||||
out:
|
||||
kfree(device);
|
||||
kfree(buf);
|
||||
free(device);
|
||||
free(buf);
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue