summaryrefslogtreecommitdiff
path: root/fs/btrfs/send.c
diff options
context:
space:
mode:
Diffstat (limited to 'fs/btrfs/send.c')
-rw-r--r--fs/btrfs/send.c30
1 files changed, 15 insertions, 15 deletions
diff --git a/fs/btrfs/send.c b/fs/btrfs/send.c
index 3dcfdba018b5..23b0b06ac71c 100644
--- a/fs/btrfs/send.c
+++ b/fs/btrfs/send.c
@@ -450,7 +450,7 @@ static struct fs_path *fs_path_alloc(void)
{
struct fs_path *p;
- p = kmalloc(sizeof(*p), GFP_KERNEL);
+ p = kmalloc_obj(*p, GFP_KERNEL);
if (!p)
return NULL;
init_path(p);
@@ -1429,7 +1429,7 @@ static void store_backref_cache(u64 leaf_bytenr, const struct ulist *root_ids,
* fs_info->commit_root_sem (at iterate_extent_inodes()), so must do a
* NOFS allocation.
*/
- new_entry = kmalloc(sizeof(struct backref_cache_entry), GFP_NOFS);
+ new_entry = kmalloc_obj(struct backref_cache_entry, GFP_NOFS);
/* No worries, cache is optional. */
if (!new_entry)
return;
@@ -2743,7 +2743,7 @@ static int cache_dir_utimes(struct send_ctx *sctx, u64 dir, u64 gen)
return 0;
/* Caching is optional, don't fail if we can't allocate memory. */
- entry = kmalloc(sizeof(*entry), GFP_KERNEL);
+ entry = kmalloc_obj(*entry, GFP_KERNEL);
if (!entry)
return send_utimes(sctx, dir, gen);
@@ -2870,7 +2870,7 @@ static void cache_dir_created(struct send_ctx *sctx, u64 dir)
int ret;
/* Caching is optional, ignore any failures. */
- entry = kmalloc(sizeof(*entry), GFP_KERNEL);
+ entry = kmalloc_obj(*entry, GFP_KERNEL);
if (!entry)
return;
@@ -2974,7 +2974,7 @@ static struct recorded_ref *recorded_ref_alloc(void)
{
struct recorded_ref *ref;
- ref = kzalloc(sizeof(*ref), GFP_KERNEL);
+ ref = kzalloc_obj(*ref, GFP_KERNEL);
if (!ref)
return NULL;
RB_CLEAR_NODE(&ref->node);
@@ -3083,7 +3083,7 @@ static struct orphan_dir_info *add_orphan_dir_info(struct send_ctx *sctx,
return entry;
}
- odi = kmalloc(sizeof(*odi), GFP_KERNEL);
+ odi = kmalloc_obj(*odi, GFP_KERNEL);
if (!odi)
return ERR_PTR(-ENOMEM);
odi->ino = dir_ino;
@@ -3284,7 +3284,7 @@ static int add_waiting_dir_move(struct send_ctx *sctx, u64 ino, bool orphanized)
struct rb_node *parent = NULL;
struct waiting_dir_move *entry, *dm;
- dm = kmalloc(sizeof(*dm), GFP_KERNEL);
+ dm = kmalloc_obj(*dm, GFP_KERNEL);
if (!dm)
return -ENOMEM;
dm->ino = ino;
@@ -3352,7 +3352,7 @@ static int add_pending_dir_move(struct send_ctx *sctx,
int exists = 0;
int ret;
- pm = kmalloc(sizeof(*pm), GFP_KERNEL);
+ pm = kmalloc_obj(*pm, GFP_KERNEL);
if (!pm)
return -ENOMEM;
pm->parent_ino = parent_ino;
@@ -8035,7 +8035,7 @@ long btrfs_ioctl_send(struct btrfs_root *send_root, const struct btrfs_ioctl_sen
goto out;
}
- sctx = kzalloc(sizeof(struct send_ctx), GFP_KERNEL);
+ sctx = kzalloc_obj(struct send_ctx, GFP_KERNEL);
if (!sctx) {
ret = -ENOMEM;
goto out;
@@ -8097,9 +8097,9 @@ long btrfs_ioctl_send(struct btrfs_root *send_root, const struct btrfs_ioctl_sen
goto out;
}
send_buf_num_pages = sctx->send_max_size >> PAGE_SHIFT;
- sctx->send_buf_pages = kcalloc(send_buf_num_pages,
- sizeof(*sctx->send_buf_pages),
- GFP_KERNEL);
+ sctx->send_buf_pages = kzalloc_objs(*sctx->send_buf_pages,
+ send_buf_num_pages,
+ GFP_KERNEL);
if (!sctx->send_buf_pages) {
ret = -ENOMEM;
goto out;
@@ -8117,9 +8117,9 @@ long btrfs_ioctl_send(struct btrfs_root *send_root, const struct btrfs_ioctl_sen
goto out;
}
- sctx->clone_roots = kvcalloc(arg->clone_sources_count + 1,
- sizeof(*sctx->clone_roots),
- GFP_KERNEL);
+ sctx->clone_roots = kvzalloc_objs(*sctx->clone_roots,
+ arg->clone_sources_count + 1,
+ GFP_KERNEL);
if (!sctx->clone_roots) {
ret = -ENOMEM;
goto out;