summaryrefslogtreecommitdiff
path: root/fs/fuse
diff options
context:
space:
mode:
Diffstat (limited to 'fs/fuse')
-rw-r--r--fs/fuse/backing.c2
-rw-r--r--fs/fuse/cuse.c6
-rw-r--r--fs/fuse/dax.c8
-rw-r--r--fs/fuse/dev.c5
-rw-r--r--fs/fuse/dev_uring.c12
-rw-r--r--fs/fuse/dir.c4
-rw-r--r--fs/fuse/file.c10
-rw-r--r--fs/fuse/inode.c20
-rw-r--r--fs/fuse/virtio_fs.c22
9 files changed, 44 insertions, 45 deletions
diff --git a/fs/fuse/backing.c b/fs/fuse/backing.c
index 4afda419dd14..45a78ee15e3c 100644
--- a/fs/fuse/backing.c
+++ b/fs/fuse/backing.c
@@ -112,7 +112,7 @@ int fuse_backing_open(struct fuse_conn *fc, struct fuse_backing_map *map)
if (backing_sb->s_stack_depth >= fc->max_stack_depth)
goto out_fput;
- fb = kmalloc(sizeof(struct fuse_backing), GFP_KERNEL);
+ fb = kmalloc_obj(struct fuse_backing, GFP_KERNEL);
res = -ENOMEM;
if (!fb)
goto out_fput;
diff --git a/fs/fuse/cuse.c b/fs/fuse/cuse.c
index 28c96961e85d..0aace951541b 100644
--- a/fs/fuse/cuse.c
+++ b/fs/fuse/cuse.c
@@ -362,7 +362,7 @@ static void cuse_process_init_reply(struct fuse_mount *fm,
/* devt determined, create device */
rc = -ENOMEM;
- dev = kzalloc(sizeof(*dev), GFP_KERNEL);
+ dev = kzalloc_obj(*dev, GFP_KERNEL);
if (!dev)
goto err_region;
@@ -443,7 +443,7 @@ static int cuse_send_init(struct cuse_conn *cc)
if (!folio)
goto err;
- ia = kzalloc(sizeof(*ia), GFP_KERNEL);
+ ia = kzalloc_obj(*ia, GFP_KERNEL);
if (!ia)
goto err_free_folio;
@@ -505,7 +505,7 @@ static int cuse_channel_open(struct inode *inode, struct file *file)
int rc;
/* set up cuse_conn */
- cc = kzalloc(sizeof(*cc), GFP_KERNEL);
+ cc = kzalloc_obj(*cc, GFP_KERNEL);
if (!cc)
return -ENOMEM;
diff --git a/fs/fuse/dax.c b/fs/fuse/dax.c
index ac6d4c1064cc..7d11eac4f629 100644
--- a/fs/fuse/dax.c
+++ b/fs/fuse/dax.c
@@ -257,7 +257,7 @@ static int dmap_removemapping_list(struct inode *inode, unsigned int num,
int ret, i = 0, nr_alloc;
nr_alloc = min_t(unsigned int, num, FUSE_REMOVEMAPPING_MAX_ENTRY);
- remove_one = kmalloc_array(nr_alloc, sizeof(*remove_one), GFP_NOFS);
+ remove_one = kmalloc_objs(*remove_one, nr_alloc, GFP_NOFS);
if (!remove_one)
return -ENOMEM;
@@ -1219,7 +1219,7 @@ static int fuse_dax_mem_range_init(struct fuse_conn_dax *fcd)
__func__, nr_pages, nr_ranges);
for (i = 0; i < nr_ranges; i++) {
- range = kzalloc(sizeof(struct fuse_dax_mapping), GFP_KERNEL);
+ range = kzalloc_obj(struct fuse_dax_mapping, GFP_KERNEL);
ret = -ENOMEM;
if (!range)
goto out_err;
@@ -1255,7 +1255,7 @@ int fuse_dax_conn_alloc(struct fuse_conn *fc, enum fuse_dax_mode dax_mode,
if (!dax_dev)
return 0;
- fcd = kzalloc(sizeof(*fcd), GFP_KERNEL);
+ fcd = kzalloc_obj(*fcd, GFP_KERNEL);
if (!fcd)
return -ENOMEM;
@@ -1277,7 +1277,7 @@ bool fuse_dax_inode_alloc(struct super_block *sb, struct fuse_inode *fi)
fi->dax = NULL;
if (fc->dax) {
- fi->dax = kzalloc(sizeof(*fi->dax), GFP_KERNEL_ACCOUNT);
+ fi->dax = kzalloc_obj(*fi->dax, GFP_KERNEL_ACCOUNT);
if (!fi->dax)
return false;
diff --git a/fs/fuse/dev.c b/fs/fuse/dev.c
index a30c8b57d478..3ec0fa236da0 100644
--- a/fs/fuse/dev.c
+++ b/fs/fuse/dev.c
@@ -1598,8 +1598,7 @@ static ssize_t fuse_dev_splice_read(struct file *in, loff_t *ppos,
if (IS_ERR(fud))
return PTR_ERR(fud);
- bufs = kvmalloc_array(pipe->max_usage, sizeof(struct pipe_buffer),
- GFP_KERNEL);
+ bufs = kvmalloc_objs(struct pipe_buffer, pipe->max_usage, GFP_KERNEL);
if (!bufs)
return -ENOMEM;
@@ -2311,7 +2310,7 @@ static ssize_t fuse_dev_splice_write(struct pipe_inode_info *pipe,
tail = pipe->tail;
count = pipe_occupancy(head, tail);
- bufs = kvmalloc_array(count, sizeof(struct pipe_buffer), GFP_KERNEL);
+ bufs = kvmalloc_objs(struct pipe_buffer, count, GFP_KERNEL);
if (!bufs) {
pipe_unlock(pipe);
return -ENOMEM;
diff --git a/fs/fuse/dev_uring.c b/fs/fuse/dev_uring.c
index 5ceb217ced1b..aee37347b652 100644
--- a/fs/fuse/dev_uring.c
+++ b/fs/fuse/dev_uring.c
@@ -231,12 +231,12 @@ static struct fuse_ring *fuse_uring_create(struct fuse_conn *fc)
struct fuse_ring *res = NULL;
size_t max_payload_size;
- ring = kzalloc(sizeof(*fc->ring), GFP_KERNEL_ACCOUNT);
+ ring = kzalloc_obj(*fc->ring, GFP_KERNEL_ACCOUNT);
if (!ring)
return NULL;
- ring->queues = kcalloc(nr_queues, sizeof(struct fuse_ring_queue *),
- GFP_KERNEL_ACCOUNT);
+ ring->queues = kzalloc_objs(struct fuse_ring_queue *, nr_queues,
+ GFP_KERNEL_ACCOUNT);
if (!ring->queues)
goto out_err;
@@ -274,10 +274,10 @@ static struct fuse_ring_queue *fuse_uring_create_queue(struct fuse_ring *ring,
struct fuse_ring_queue *queue;
struct list_head *pq;
- queue = kzalloc(sizeof(*queue), GFP_KERNEL_ACCOUNT);
+ queue = kzalloc_obj(*queue, GFP_KERNEL_ACCOUNT);
if (!queue)
return NULL;
- pq = kcalloc(FUSE_PQ_HASH_SIZE, sizeof(struct list_head), GFP_KERNEL);
+ pq = kzalloc_objs(struct list_head, FUSE_PQ_HASH_SIZE, GFP_KERNEL);
if (!pq) {
kfree(queue);
return NULL;
@@ -1062,7 +1062,7 @@ fuse_uring_create_ring_ent(struct io_uring_cmd *cmd,
}
err = -ENOMEM;
- ent = kzalloc(sizeof(*ent), GFP_KERNEL_ACCOUNT);
+ ent = kzalloc_obj(*ent, GFP_KERNEL_ACCOUNT);
if (!ent)
return ERR_PTR(err);
diff --git a/fs/fuse/dir.c b/fs/fuse/dir.c
index f25ee47822ad..7ac6b232ef12 100644
--- a/fs/fuse/dir.c
+++ b/fs/fuse/dir.c
@@ -473,8 +473,8 @@ static int fuse_dentry_init(struct dentry *dentry)
{
struct fuse_dentry *fd;
- fd = kzalloc(sizeof(struct fuse_dentry),
- GFP_KERNEL_ACCOUNT | __GFP_RECLAIMABLE);
+ fd = kzalloc_obj(struct fuse_dentry,
+ GFP_KERNEL_ACCOUNT | __GFP_RECLAIMABLE);
if (!fd)
return -ENOMEM;
diff --git a/fs/fuse/file.c b/fs/fuse/file.c
index 80765ab6d04a..e29aecdab97e 100644
--- a/fs/fuse/file.c
+++ b/fs/fuse/file.c
@@ -56,13 +56,13 @@ struct fuse_file *fuse_file_alloc(struct fuse_mount *fm, bool release)
{
struct fuse_file *ff;
- ff = kzalloc(sizeof(struct fuse_file), GFP_KERNEL_ACCOUNT);
+ ff = kzalloc_obj(struct fuse_file, GFP_KERNEL_ACCOUNT);
if (unlikely(!ff))
return NULL;
ff->fm = fm;
if (release) {
- ff->args = kzalloc(sizeof(*ff->args), GFP_KERNEL_ACCOUNT);
+ ff->args = kzalloc_obj(*ff->args, GFP_KERNEL_ACCOUNT);
if (!ff->args) {
kfree(ff);
return NULL;
@@ -684,7 +684,7 @@ static struct fuse_io_args *fuse_io_alloc(struct fuse_io_priv *io,
{
struct fuse_io_args *ia;
- ia = kzalloc(sizeof(*ia), GFP_KERNEL);
+ ia = kzalloc_obj(*ia, GFP_KERNEL);
if (ia) {
ia->io = io;
ia->ap.folios = fuse_folios_alloc(nfolios, GFP_KERNEL,
@@ -2045,7 +2045,7 @@ static struct fuse_writepage_args *fuse_writepage_args_alloc(void)
struct fuse_writepage_args *wpa;
struct fuse_args_pages *ap;
- wpa = kzalloc(sizeof(*wpa), GFP_NOFS);
+ wpa = kzalloc_obj(*wpa, GFP_NOFS);
if (wpa) {
ap = &wpa->ia.ap;
ap->num_folios = 0;
@@ -2834,7 +2834,7 @@ fuse_direct_IO(struct kiocb *iocb, struct iov_iter *iter)
if ((iov_iter_rw(iter) == READ) && (offset >= i_size))
return 0;
- io = kmalloc(sizeof(struct fuse_io_priv), GFP_KERNEL);
+ io = kmalloc_obj(struct fuse_io_priv, GFP_KERNEL);
if (!io)
return -ENOMEM;
spin_lock_init(&io->lock);
diff --git a/fs/fuse/inode.c b/fs/fuse/inode.c
index 819e50d66622..3db0fe0d764b 100644
--- a/fs/fuse/inode.c
+++ b/fs/fuse/inode.c
@@ -74,14 +74,14 @@ static struct file_system_type fuseblk_fs_type;
struct fuse_forget_link *fuse_alloc_forget(void)
{
- return kzalloc(sizeof(struct fuse_forget_link), GFP_KERNEL_ACCOUNT);
+ return kzalloc_obj(struct fuse_forget_link, GFP_KERNEL_ACCOUNT);
}
static struct fuse_submount_lookup *fuse_alloc_submount_lookup(void)
{
struct fuse_submount_lookup *sl;
- sl = kzalloc(sizeof(struct fuse_submount_lookup), GFP_KERNEL_ACCOUNT);
+ sl = kzalloc_obj(struct fuse_submount_lookup, GFP_KERNEL_ACCOUNT);
if (!sl)
return NULL;
sl->forget = fuse_alloc_forget();
@@ -684,7 +684,7 @@ static struct fuse_sync_bucket *fuse_sync_bucket_alloc(void)
{
struct fuse_sync_bucket *bucket;
- bucket = kzalloc(sizeof(*bucket), GFP_KERNEL | __GFP_NOFAIL);
+ bucket = kzalloc_obj(*bucket, GFP_KERNEL | __GFP_NOFAIL);
if (bucket) {
init_waitqueue_head(&bucket->waitq);
/* Initial active count */
@@ -1487,7 +1487,7 @@ static struct fuse_init_args *fuse_new_init(struct fuse_mount *fm)
struct fuse_init_args *ia;
u64 flags;
- ia = kzalloc(sizeof(*ia), GFP_KERNEL | __GFP_NOFAIL);
+ ia = kzalloc_obj(*ia, GFP_KERNEL | __GFP_NOFAIL);
ia->in.major = FUSE_KERNEL_VERSION;
ia->in.minor = FUSE_KERNEL_MINOR_VERSION;
@@ -1618,11 +1618,11 @@ struct fuse_dev *fuse_dev_alloc(void)
struct fuse_dev *fud;
struct list_head *pq;
- fud = kzalloc(sizeof(struct fuse_dev), GFP_KERNEL);
+ fud = kzalloc_obj(struct fuse_dev, GFP_KERNEL);
if (!fud)
return NULL;
- pq = kcalloc(FUSE_PQ_HASH_SIZE, sizeof(struct list_head), GFP_KERNEL);
+ pq = kzalloc_objs(struct list_head, FUSE_PQ_HASH_SIZE, GFP_KERNEL);
if (!pq) {
kfree(fud);
return NULL;
@@ -1780,7 +1780,7 @@ static int fuse_get_tree_submount(struct fs_context *fsc)
struct super_block *sb;
int err;
- fm = kzalloc(sizeof(struct fuse_mount), GFP_KERNEL);
+ fm = kzalloc_obj(struct fuse_mount, GFP_KERNEL);
if (!fm)
return -ENOMEM;
@@ -1981,11 +1981,11 @@ static int fuse_get_tree(struct fs_context *fsc)
struct super_block *sb;
int err;
- fc = kmalloc(sizeof(*fc), GFP_KERNEL);
+ fc = kmalloc_obj(*fc, GFP_KERNEL);
if (!fc)
return -ENOMEM;
- fm = kzalloc(sizeof(*fm), GFP_KERNEL);
+ fm = kzalloc_obj(*fm, GFP_KERNEL);
if (!fm) {
kfree(fc);
return -ENOMEM;
@@ -2047,7 +2047,7 @@ static int fuse_init_fs_context(struct fs_context *fsc)
{
struct fuse_fs_context *ctx;
- ctx = kzalloc(sizeof(struct fuse_fs_context), GFP_KERNEL);
+ ctx = kzalloc_obj(struct fuse_fs_context, GFP_KERNEL);
if (!ctx)
return -ENOMEM;
diff --git a/fs/fuse/virtio_fs.c b/fs/fuse/virtio_fs.c
index b2f6486fe1d5..dc96ee0b952a 100644
--- a/fs/fuse/virtio_fs.c
+++ b/fs/fuse/virtio_fs.c
@@ -839,7 +839,7 @@ static void virtio_fs_requests_done_work(struct work_struct *work)
if (req->args->may_block) {
struct virtio_fs_req_work *w;
- w = kzalloc(sizeof(*w), GFP_NOFS | __GFP_NOFAIL);
+ w = kzalloc_obj(*w, GFP_NOFS | __GFP_NOFAIL);
INIT_WORK(&w->done_work, virtio_fs_complete_req_work);
w->fsvq = fsvq;
w->req = req;
@@ -947,14 +947,14 @@ static int virtio_fs_setup_vqs(struct virtio_device *vdev,
fs->num_request_queues = min_t(unsigned int, fs->num_request_queues,
nr_cpu_ids);
fs->nvqs = VQ_REQUEST + fs->num_request_queues;
- fs->vqs = kcalloc(fs->nvqs, sizeof(fs->vqs[VQ_HIPRIO]), GFP_KERNEL);
+ fs->vqs = kzalloc_objs(fs->vqs[VQ_HIPRIO], fs->nvqs, GFP_KERNEL);
if (!fs->vqs)
return -ENOMEM;
- vqs = kmalloc_array(fs->nvqs, sizeof(vqs[VQ_HIPRIO]), GFP_KERNEL);
+ vqs = kmalloc_objs(vqs[VQ_HIPRIO], fs->nvqs, GFP_KERNEL);
fs->mq_map = kcalloc_node(nr_cpu_ids, sizeof(*fs->mq_map), GFP_KERNEL,
dev_to_node(&vdev->dev));
- vqs_info = kcalloc(fs->nvqs, sizeof(*vqs_info), GFP_KERNEL);
+ vqs_info = kzalloc_objs(*vqs_info, fs->nvqs, GFP_KERNEL);
if (!vqs || !vqs_info || !fs->mq_map) {
ret = -ENOMEM;
goto out;
@@ -1120,7 +1120,7 @@ static int virtio_fs_probe(struct virtio_device *vdev)
struct virtio_fs *fs;
int ret;
- fs = kzalloc(sizeof(*fs), GFP_KERNEL);
+ fs = kzalloc_obj(*fs, GFP_KERNEL);
if (!fs)
return -ENOMEM;
kobject_init(&fs->kobj, &virtio_fs_ktype);
@@ -1240,7 +1240,7 @@ static void virtio_fs_send_forget(struct fuse_iqueue *fiq, struct fuse_forget_li
u64 unique = fuse_get_unique(fiq);
/* Allocate a buffer for the request */
- forget = kmalloc(sizeof(*forget), GFP_NOFS | __GFP_NOFAIL);
+ forget = kmalloc_obj(*forget, GFP_NOFS | __GFP_NOFAIL);
req = &forget->req;
req->ih = (struct fuse_in_header){
@@ -1390,8 +1390,8 @@ static int virtio_fs_enqueue_req(struct virtio_fs_vq *fsvq,
/* Does the sglist fit on the stack? */
total_sgs = sg_count_fuse_req(req);
if (total_sgs > ARRAY_SIZE(stack_sgs)) {
- sgs = kmalloc_array(total_sgs, sizeof(sgs[0]), gfp);
- sg = kmalloc_array(total_sgs, sizeof(sg[0]), gfp);
+ sgs = kmalloc_objs(sgs[0], total_sgs, gfp);
+ sg = kmalloc_objs(sg[0], total_sgs, gfp);
if (!sgs || !sg) {
ret = -ENOMEM;
goto out;
@@ -1684,11 +1684,11 @@ static int virtio_fs_get_tree(struct fs_context *fsc)
goto out_err;
err = -ENOMEM;
- fc = kzalloc(sizeof(struct fuse_conn), GFP_KERNEL);
+ fc = kzalloc_obj(struct fuse_conn, GFP_KERNEL);
if (!fc)
goto out_err;
- fm = kzalloc(sizeof(struct fuse_mount), GFP_KERNEL);
+ fm = kzalloc_obj(struct fuse_mount, GFP_KERNEL);
if (!fm)
goto out_err;
@@ -1743,7 +1743,7 @@ static int virtio_fs_init_fs_context(struct fs_context *fsc)
if (fsc->purpose == FS_CONTEXT_FOR_SUBMOUNT)
return fuse_init_fs_context_submount(fsc);
- ctx = kzalloc(sizeof(struct fuse_fs_context), GFP_KERNEL);
+ ctx = kzalloc_obj(struct fuse_fs_context, GFP_KERNEL);
if (!ctx)
return -ENOMEM;
fsc->fs_private = ctx;