From: David Sterba <dsterba@suse.com>
To: linux-btrfs@vger.kernel.org
Cc: David Sterba <dsterba@suse.com>
Subject: [PATCH 5/6] btrfs: do more kmalloc_obj()/kmalloc_objs() conversions
Date: Tue, 14 Apr 2026 17:30:33 +0200 [thread overview]
Message-ID: <546d39cfcc54907cd5cbe5758e2e332d3fb01cc3.1776180388.git.dsterba@suse.com> (raw)
In-Reply-To: <cover.1776180388.git.dsterba@suse.com>
Do a few more (trivial) conversions that started in commit 69050f8d6d075d
("treewide: Replace kmalloc with kmalloc_obj for non-scalar types").
Signed-off-by: David Sterba <dsterba@suse.com>
---
fs/btrfs/relocation.c | 10 +++++-----
1 file changed, 5 insertions(+), 5 deletions(-)
diff --git a/fs/btrfs/relocation.c b/fs/btrfs/relocation.c
index 3ebaf5880125fa..9cbae3cf8bdd1e 100644
--- a/fs/btrfs/relocation.c
+++ b/fs/btrfs/relocation.c
@@ -590,7 +590,7 @@ static struct btrfs_root *create_reloc_root(struct btrfs_trans_handle *trans,
struct btrfs_key root_key;
int ret = 0;
- root_item = kmalloc(sizeof(*root_item), GFP_NOFS);
+ root_item = kmalloc_obj(*root_item, GFP_NOFS);
if (!root_item)
return ERR_PTR(-ENOMEM);
@@ -2944,7 +2944,7 @@ static int relocate_file_extent_cluster(struct reloc_control *rc)
if (!cluster->nr)
return 0;
- ra = kzalloc(sizeof(*ra), GFP_NOFS);
+ ra = kzalloc_obj(*ra, GFP_NOFS);
if (!ra)
return -ENOMEM;
@@ -3863,7 +3863,7 @@ static int add_remap_tree_entries(struct btrfs_trans_handle *trans, struct btrfs
max_items = BTRFS_LEAF_DATA_SIZE(trans->fs_info) / sizeof(struct btrfs_item);
- data_sizes = kzalloc(sizeof(u32) * min_t(u32, num_entries, max_items), GFP_NOFS);
+ data_sizes = kzalloc_objs(u32, min_t(u32, num_entries, max_items), GFP_NOFS);
if (!data_sizes)
return -ENOMEM;
@@ -4454,7 +4454,7 @@ static int create_remap_tree_entries(struct btrfs_trans_handle *trans,
btrfs_release_path(path);
- space_runs = kmalloc(sizeof(*space_runs) * extent_count, GFP_NOFS);
+ space_runs = kmalloc_objs(*space_runs, extent_count, GFP_NOFS);
if (!space_runs) {
mutex_unlock(&bg->free_space_lock);
return -ENOMEM;
@@ -4543,7 +4543,7 @@ static int create_remap_tree_entries(struct btrfs_trans_handle *trans,
mutex_unlock(&bg->free_space_lock);
max_entries = extent_count + 2;
- entries = kmalloc(sizeof(*entries) * max_entries, GFP_NOFS);
+ entries = kmalloc_objs(*entries, max_entries, GFP_NOFS);
if (!entries) {
ret = -ENOMEM;
goto out;
--
2.53.0
next prev parent reply other threads:[~2026-04-14 15:31 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-04-14 15:30 [PATCH 0/6] Debugging macro and kmalloc_obj* cleanups David Sterba
2026-04-14 15:30 ` [PATCH 1/6] btrfs: move condition to WARN_ON in btrfs_set_delalloc_extent() David Sterba
2026-04-14 15:30 ` [PATCH 2/6] btrfs: replace open coded DEBUG_WARN in extent_writepage() David Sterba
2026-04-14 15:30 ` [PATCH 3/6] btrfs: handle unexpected free-space-tree key types David Sterba
2026-04-14 15:30 ` [PATCH 4/6] btrfs: lift assertions to beginning of insert_delayed_ref() David Sterba
2026-04-14 15:30 ` David Sterba [this message]
2026-04-14 15:30 ` [PATCH 6/6] btrfs: convert kmalloc_array to kmalloc_objs in btrfs_calc_avail_data_space() David Sterba
2026-04-14 15:52 ` [PATCH 0/6] Debugging macro and kmalloc_obj* cleanups Johannes Thumshirn
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=546d39cfcc54907cd5cbe5758e2e332d3fb01cc3.1776180388.git.dsterba@suse.com \
--to=dsterba@suse.com \
--cc=linux-btrfs@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox