2016-03-13 07:26:45

by Geliang Tang

[permalink] [raw]
Subject: [PATCH 1/2] aio: use kmem_cache_zalloc

Use kmem_cache_zalloc() instead of kmem_cache_alloc() with flag GFP_ZERO.

Signed-off-by: Geliang Tang <[email protected]>
---
fs/aio.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/fs/aio.c b/fs/aio.c
index 56bcdf4..9844ea1 100644
--- a/fs/aio.c
+++ b/fs/aio.c
@@ -1053,7 +1053,7 @@ static inline struct aio_kiocb *aio_get_req(struct kioctx *ctx)
return NULL;
}

- req = kmem_cache_alloc(kiocb_cachep, GFP_KERNEL|__GFP_ZERO);
+ req = kmem_cache_zalloc(kiocb_cachep, GFP_KERNEL);
if (unlikely(!req))
goto out_put;

--
2.5.0



2016-03-13 07:27:03

by Geliang Tang

[permalink] [raw]
Subject: [PATCH 2/2] ceph: use kmem_cache_zalloc

Use kmem_cache_zalloc() instead of kmem_cache_alloc() with flag GFP_ZERO.

Signed-off-by: Geliang Tang <[email protected]>
---
fs/ceph/dir.c | 2 +-
fs/ceph/file.c | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/fs/ceph/dir.c b/fs/ceph/dir.c
index fd11fb2..ba01851 100644
--- a/fs/ceph/dir.c
+++ b/fs/ceph/dir.c
@@ -38,7 +38,7 @@ int ceph_init_dentry(struct dentry *dentry)
if (dentry->d_fsdata)
return 0;

- di = kmem_cache_alloc(ceph_dentry_cachep, GFP_KERNEL | __GFP_ZERO);
+ di = kmem_cache_zalloc(ceph_dentry_cachep, GFP_KERNEL);
if (!di)
return -ENOMEM; /* oh well */

diff --git a/fs/ceph/file.c b/fs/ceph/file.c
index eb9028e..bb4950a 100644
--- a/fs/ceph/file.c
+++ b/fs/ceph/file.c
@@ -157,7 +157,7 @@ static int ceph_init_file(struct inode *inode, struct file *file, int fmode)
case S_IFDIR:
dout("init_file %p %p 0%o (regular)\n", inode, file,
inode->i_mode);
- cf = kmem_cache_alloc(ceph_file_cachep, GFP_KERNEL | __GFP_ZERO);
+ cf = kmem_cache_zalloc(ceph_file_cachep, GFP_KERNEL);
if (cf == NULL) {
ceph_put_fmode(ceph_inode(inode), fmode); /* clean up */
return -ENOMEM;
--
2.5.0


2016-03-22 16:56:18

by Ilya Dryomov

[permalink] [raw]
Subject: Re: [PATCH 2/2] ceph: use kmem_cache_zalloc

On Sun, Mar 13, 2016 at 8:26 AM, Geliang Tang <[email protected]> wrote:
> Use kmem_cache_zalloc() instead of kmem_cache_alloc() with flag GFP_ZERO.
>
> Signed-off-by: Geliang Tang <[email protected]>
> ---
> fs/ceph/dir.c | 2 +-
> fs/ceph/file.c | 2 +-
> 2 files changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/fs/ceph/dir.c b/fs/ceph/dir.c
> index fd11fb2..ba01851 100644
> --- a/fs/ceph/dir.c
> +++ b/fs/ceph/dir.c
> @@ -38,7 +38,7 @@ int ceph_init_dentry(struct dentry *dentry)
> if (dentry->d_fsdata)
> return 0;
>
> - di = kmem_cache_alloc(ceph_dentry_cachep, GFP_KERNEL | __GFP_ZERO);
> + di = kmem_cache_zalloc(ceph_dentry_cachep, GFP_KERNEL);
> if (!di)
> return -ENOMEM; /* oh well */
>
> diff --git a/fs/ceph/file.c b/fs/ceph/file.c
> index eb9028e..bb4950a 100644
> --- a/fs/ceph/file.c
> +++ b/fs/ceph/file.c
> @@ -157,7 +157,7 @@ static int ceph_init_file(struct inode *inode, struct file *file, int fmode)
> case S_IFDIR:
> dout("init_file %p %p 0%o (regular)\n", inode, file,
> inode->i_mode);
> - cf = kmem_cache_alloc(ceph_file_cachep, GFP_KERNEL | __GFP_ZERO);
> + cf = kmem_cache_zalloc(ceph_file_cachep, GFP_KERNEL);
> if (cf == NULL) {
> ceph_put_fmode(ceph_inode(inode), fmode); /* clean up */
> return -ENOMEM;

Applied.

Thanks,

Ilya