Commit 687265e5 authored by Yan, Zheng's avatar Yan, Zheng Committed by Ilya Dryomov

ceph: switch some GFP_NOFS memory allocation to GFP_KERNEL

GFP_NOFS memory allocation is required for page writeback path.
But there is no need to use GFP_NOFS in syscall path and readpage
path
Signed-off-by: default avatarYan, Zheng <zyan@redhat.com>
parent f66fd9f0
...@@ -187,10 +187,10 @@ int ceph_pre_init_acls(struct inode *dir, umode_t *mode, ...@@ -187,10 +187,10 @@ int ceph_pre_init_acls(struct inode *dir, umode_t *mode,
val_size2 = posix_acl_xattr_size(default_acl->a_count); val_size2 = posix_acl_xattr_size(default_acl->a_count);
err = -ENOMEM; err = -ENOMEM;
tmp_buf = kmalloc(max(val_size1, val_size2), GFP_NOFS); tmp_buf = kmalloc(max(val_size1, val_size2), GFP_KERNEL);
if (!tmp_buf) if (!tmp_buf)
goto out_err; goto out_err;
pagelist = kmalloc(sizeof(struct ceph_pagelist), GFP_NOFS); pagelist = kmalloc(sizeof(struct ceph_pagelist), GFP_KERNEL);
if (!pagelist) if (!pagelist)
goto out_err; goto out_err;
ceph_pagelist_init(pagelist); ceph_pagelist_init(pagelist);
......
...@@ -350,7 +350,7 @@ static int start_read(struct inode *inode, struct list_head *page_list, int max) ...@@ -350,7 +350,7 @@ static int start_read(struct inode *inode, struct list_head *page_list, int max)
/* build page vector */ /* build page vector */
nr_pages = calc_pages_for(0, len); nr_pages = calc_pages_for(0, len);
pages = kmalloc(sizeof(*pages) * nr_pages, GFP_NOFS); pages = kmalloc(sizeof(*pages) * nr_pages, GFP_KERNEL);
ret = -ENOMEM; ret = -ENOMEM;
if (!pages) if (!pages)
goto out; goto out;
...@@ -362,7 +362,7 @@ static int start_read(struct inode *inode, struct list_head *page_list, int max) ...@@ -362,7 +362,7 @@ static int start_read(struct inode *inode, struct list_head *page_list, int max)
dout("start_read %p adding %p idx %lu\n", inode, page, dout("start_read %p adding %p idx %lu\n", inode, page,
page->index); page->index);
if (add_to_page_cache_lru(page, &inode->i_data, page->index, if (add_to_page_cache_lru(page, &inode->i_data, page->index,
GFP_NOFS)) { GFP_KERNEL)) {
ceph_fscache_uncache_page(inode, page); ceph_fscache_uncache_page(inode, page);
page_cache_release(page); page_cache_release(page);
dout("start_read %p add_to_page_cache failed %p\n", dout("start_read %p add_to_page_cache failed %p\n",
......
...@@ -38,7 +38,7 @@ int ceph_init_dentry(struct dentry *dentry) ...@@ -38,7 +38,7 @@ int ceph_init_dentry(struct dentry *dentry)
if (dentry->d_fsdata) if (dentry->d_fsdata)
return 0; return 0;
di = kmem_cache_alloc(ceph_dentry_cachep, GFP_NOFS | __GFP_ZERO); di = kmem_cache_alloc(ceph_dentry_cachep, GFP_KERNEL | __GFP_ZERO);
if (!di) if (!di)
return -ENOMEM; /* oh well */ return -ENOMEM; /* oh well */
...@@ -231,7 +231,7 @@ static int note_last_dentry(struct ceph_file_info *fi, const char *name, ...@@ -231,7 +231,7 @@ static int note_last_dentry(struct ceph_file_info *fi, const char *name,
int len) int len)
{ {
kfree(fi->last_name); kfree(fi->last_name);
fi->last_name = kmalloc(len+1, GFP_NOFS); fi->last_name = kmalloc(len+1, GFP_KERNEL);
if (!fi->last_name) if (!fi->last_name)
return -ENOMEM; return -ENOMEM;
memcpy(fi->last_name, name, len); memcpy(fi->last_name, name, len);
...@@ -342,7 +342,7 @@ static int ceph_readdir(struct file *file, struct dir_context *ctx) ...@@ -342,7 +342,7 @@ static int ceph_readdir(struct file *file, struct dir_context *ctx)
req->r_direct_hash = ceph_frag_value(frag); req->r_direct_hash = ceph_frag_value(frag);
req->r_direct_is_hash = true; req->r_direct_is_hash = true;
if (fi->last_name) { if (fi->last_name) {
req->r_path2 = kstrdup(fi->last_name, GFP_NOFS); req->r_path2 = kstrdup(fi->last_name, GFP_KERNEL);
if (!req->r_path2) { if (!req->r_path2) {
ceph_mdsc_put_request(req); ceph_mdsc_put_request(req);
return -ENOMEM; return -ENOMEM;
...@@ -764,7 +764,7 @@ static int ceph_symlink(struct inode *dir, struct dentry *dentry, ...@@ -764,7 +764,7 @@ static int ceph_symlink(struct inode *dir, struct dentry *dentry,
err = PTR_ERR(req); err = PTR_ERR(req);
goto out; goto out;
} }
req->r_path2 = kstrdup(dest, GFP_NOFS); req->r_path2 = kstrdup(dest, GFP_KERNEL);
if (!req->r_path2) { if (!req->r_path2) {
err = -ENOMEM; err = -ENOMEM;
ceph_mdsc_put_request(req); ceph_mdsc_put_request(req);
...@@ -1189,7 +1189,7 @@ static ssize_t ceph_read_dir(struct file *file, char __user *buf, size_t size, ...@@ -1189,7 +1189,7 @@ static ssize_t ceph_read_dir(struct file *file, char __user *buf, size_t size,
return -EISDIR; return -EISDIR;
if (!cf->dir_info) { if (!cf->dir_info) {
cf->dir_info = kmalloc(bufsize, GFP_NOFS); cf->dir_info = kmalloc(bufsize, GFP_KERNEL);
if (!cf->dir_info) if (!cf->dir_info)
return -ENOMEM; return -ENOMEM;
cf->dir_info_len = cf->dir_info_len =
......
...@@ -89,7 +89,7 @@ static int ceph_init_file(struct inode *inode, struct file *file, int fmode) ...@@ -89,7 +89,7 @@ static int ceph_init_file(struct inode *inode, struct file *file, int fmode)
case S_IFDIR: case S_IFDIR:
dout("init_file %p %p 0%o (regular)\n", inode, file, dout("init_file %p %p 0%o (regular)\n", inode, file,
inode->i_mode); inode->i_mode);
cf = kmem_cache_alloc(ceph_file_cachep, GFP_NOFS | __GFP_ZERO); cf = kmem_cache_alloc(ceph_file_cachep, GFP_KERNEL | __GFP_ZERO);
if (cf == NULL) { if (cf == NULL) {
ceph_put_fmode(ceph_inode(inode), fmode); /* clean up */ ceph_put_fmode(ceph_inode(inode), fmode); /* clean up */
return -ENOMEM; return -ENOMEM;
...@@ -483,7 +483,7 @@ static ssize_t ceph_sync_read(struct kiocb *iocb, struct iov_iter *i, ...@@ -483,7 +483,7 @@ static ssize_t ceph_sync_read(struct kiocb *iocb, struct iov_iter *i,
} }
} else { } else {
num_pages = calc_pages_for(off, len); num_pages = calc_pages_for(off, len);
pages = ceph_alloc_page_vector(num_pages, GFP_NOFS); pages = ceph_alloc_page_vector(num_pages, GFP_KERNEL);
if (IS_ERR(pages)) if (IS_ERR(pages))
return PTR_ERR(pages); return PTR_ERR(pages);
ret = striped_read(inode, off, len, pages, ret = striped_read(inode, off, len, pages,
...@@ -734,7 +734,7 @@ ceph_sync_write(struct kiocb *iocb, struct iov_iter *from, loff_t pos, ...@@ -734,7 +734,7 @@ ceph_sync_write(struct kiocb *iocb, struct iov_iter *from, loff_t pos,
*/ */
num_pages = (len + PAGE_CACHE_SIZE - 1) >> PAGE_CACHE_SHIFT; num_pages = (len + PAGE_CACHE_SIZE - 1) >> PAGE_CACHE_SHIFT;
pages = ceph_alloc_page_vector(num_pages, GFP_NOFS); pages = ceph_alloc_page_vector(num_pages, GFP_KERNEL);
if (IS_ERR(pages)) { if (IS_ERR(pages)) {
ret = PTR_ERR(pages); ret = PTR_ERR(pages);
goto out; goto out;
...@@ -858,7 +858,7 @@ static ssize_t ceph_read_iter(struct kiocb *iocb, struct iov_iter *to) ...@@ -858,7 +858,7 @@ static ssize_t ceph_read_iter(struct kiocb *iocb, struct iov_iter *to)
struct page *page = NULL; struct page *page = NULL;
loff_t i_size; loff_t i_size;
if (retry_op == READ_INLINE) { if (retry_op == READ_INLINE) {
page = __page_cache_alloc(GFP_NOFS); page = __page_cache_alloc(GFP_KERNEL);
if (!page) if (!page)
return -ENOMEM; return -ENOMEM;
} }
......
...@@ -1668,7 +1668,8 @@ int ceph_alloc_readdir_reply_buffer(struct ceph_mds_request *req, ...@@ -1668,7 +1668,8 @@ int ceph_alloc_readdir_reply_buffer(struct ceph_mds_request *req,
order = get_order(size * num_entries); order = get_order(size * num_entries);
while (order >= 0) { while (order >= 0) {
rinfo->dir_in = (void*)__get_free_pages(GFP_NOFS | __GFP_NOWARN, rinfo->dir_in = (void*)__get_free_pages(GFP_KERNEL |
__GFP_NOWARN,
order); order);
if (rinfo->dir_in) if (rinfo->dir_in)
break; break;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment