diff options
author | Yan, Zheng <zyan@redhat.com> | 2015-06-13 05:27:05 -0400 |
---|---|---|
committer | Ilya Dryomov <idryomov@gmail.com> | 2015-06-25 04:49:31 -0400 |
commit | 687265e5a885d6308f5d73e738efe3c2674fa218 (patch) | |
tree | 65f9c44df4ed4c391b7f7f67d5f7643b703e8d47 /fs/ceph | |
parent | f66fd9f0952187d274c13c136b74548f792c1925 (diff) |
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: Yan, Zheng <zyan@redhat.com>
Diffstat (limited to 'fs/ceph')
-rw-r--r-- | fs/ceph/acl.c | 4 | ||||
-rw-r--r-- | fs/ceph/addr.c | 4 | ||||
-rw-r--r-- | fs/ceph/dir.c | 10 | ||||
-rw-r--r-- | fs/ceph/file.c | 8 | ||||
-rw-r--r-- | fs/ceph/mds_client.c | 3 |
5 files changed, 15 insertions, 14 deletions
diff --git a/fs/ceph/acl.c b/fs/ceph/acl.c index 64fa248343f6..8f84646f10e9 100644 --- a/fs/ceph/acl.c +++ b/fs/ceph/acl.c | |||
@@ -187,10 +187,10 @@ int ceph_pre_init_acls(struct inode *dir, umode_t *mode, | |||
187 | val_size2 = posix_acl_xattr_size(default_acl->a_count); | 187 | val_size2 = posix_acl_xattr_size(default_acl->a_count); |
188 | 188 | ||
189 | err = -ENOMEM; | 189 | err = -ENOMEM; |
190 | tmp_buf = kmalloc(max(val_size1, val_size2), GFP_NOFS); | 190 | tmp_buf = kmalloc(max(val_size1, val_size2), GFP_KERNEL); |
191 | if (!tmp_buf) | 191 | if (!tmp_buf) |
192 | goto out_err; | 192 | goto out_err; |
193 | pagelist = kmalloc(sizeof(struct ceph_pagelist), GFP_NOFS); | 193 | pagelist = kmalloc(sizeof(struct ceph_pagelist), GFP_KERNEL); |
194 | if (!pagelist) | 194 | if (!pagelist) |
195 | goto out_err; | 195 | goto out_err; |
196 | ceph_pagelist_init(pagelist); | 196 | ceph_pagelist_init(pagelist); |
diff --git a/fs/ceph/addr.c b/fs/ceph/addr.c index 7edf3c49e661..97102038fe03 100644 --- a/fs/ceph/addr.c +++ b/fs/ceph/addr.c | |||
@@ -350,7 +350,7 @@ static int start_read(struct inode *inode, struct list_head *page_list, int max) | |||
350 | 350 | ||
351 | /* build page vector */ | 351 | /* build page vector */ |
352 | nr_pages = calc_pages_for(0, len); | 352 | nr_pages = calc_pages_for(0, len); |
353 | pages = kmalloc(sizeof(*pages) * nr_pages, GFP_NOFS); | 353 | pages = kmalloc(sizeof(*pages) * nr_pages, GFP_KERNEL); |
354 | ret = -ENOMEM; | 354 | ret = -ENOMEM; |
355 | if (!pages) | 355 | if (!pages) |
356 | goto out; | 356 | goto out; |
@@ -362,7 +362,7 @@ static int start_read(struct inode *inode, struct list_head *page_list, int max) | |||
362 | dout("start_read %p adding %p idx %lu\n", inode, page, | 362 | dout("start_read %p adding %p idx %lu\n", inode, page, |
363 | page->index); | 363 | page->index); |
364 | if (add_to_page_cache_lru(page, &inode->i_data, page->index, | 364 | if (add_to_page_cache_lru(page, &inode->i_data, page->index, |
365 | GFP_NOFS)) { | 365 | GFP_KERNEL)) { |
366 | ceph_fscache_uncache_page(inode, page); | 366 | ceph_fscache_uncache_page(inode, page); |
367 | page_cache_release(page); | 367 | page_cache_release(page); |
368 | dout("start_read %p add_to_page_cache failed %p\n", | 368 | dout("start_read %p add_to_page_cache failed %p\n", |
diff --git a/fs/ceph/dir.c b/fs/ceph/dir.c index 424e23138c59..b99f2ff8189d 100644 --- a/fs/ceph/dir.c +++ b/fs/ceph/dir.c | |||
@@ -38,7 +38,7 @@ int ceph_init_dentry(struct dentry *dentry) | |||
38 | if (dentry->d_fsdata) | 38 | if (dentry->d_fsdata) |
39 | return 0; | 39 | return 0; |
40 | 40 | ||
41 | di = kmem_cache_alloc(ceph_dentry_cachep, GFP_NOFS | __GFP_ZERO); | 41 | di = kmem_cache_alloc(ceph_dentry_cachep, GFP_KERNEL | __GFP_ZERO); |
42 | if (!di) | 42 | if (!di) |
43 | return -ENOMEM; /* oh well */ | 43 | return -ENOMEM; /* oh well */ |
44 | 44 | ||
@@ -231,7 +231,7 @@ static int note_last_dentry(struct ceph_file_info *fi, const char *name, | |||
231 | int len) | 231 | int len) |
232 | { | 232 | { |
233 | kfree(fi->last_name); | 233 | kfree(fi->last_name); |
234 | fi->last_name = kmalloc(len+1, GFP_NOFS); | 234 | fi->last_name = kmalloc(len+1, GFP_KERNEL); |
235 | if (!fi->last_name) | 235 | if (!fi->last_name) |
236 | return -ENOMEM; | 236 | return -ENOMEM; |
237 | memcpy(fi->last_name, name, len); | 237 | memcpy(fi->last_name, name, len); |
@@ -342,7 +342,7 @@ more: | |||
342 | req->r_direct_hash = ceph_frag_value(frag); | 342 | req->r_direct_hash = ceph_frag_value(frag); |
343 | req->r_direct_is_hash = true; | 343 | req->r_direct_is_hash = true; |
344 | if (fi->last_name) { | 344 | if (fi->last_name) { |
345 | req->r_path2 = kstrdup(fi->last_name, GFP_NOFS); | 345 | req->r_path2 = kstrdup(fi->last_name, GFP_KERNEL); |
346 | if (!req->r_path2) { | 346 | if (!req->r_path2) { |
347 | ceph_mdsc_put_request(req); | 347 | ceph_mdsc_put_request(req); |
348 | return -ENOMEM; | 348 | return -ENOMEM; |
@@ -764,7 +764,7 @@ static int ceph_symlink(struct inode *dir, struct dentry *dentry, | |||
764 | err = PTR_ERR(req); | 764 | err = PTR_ERR(req); |
765 | goto out; | 765 | goto out; |
766 | } | 766 | } |
767 | req->r_path2 = kstrdup(dest, GFP_NOFS); | 767 | req->r_path2 = kstrdup(dest, GFP_KERNEL); |
768 | if (!req->r_path2) { | 768 | if (!req->r_path2) { |
769 | err = -ENOMEM; | 769 | err = -ENOMEM; |
770 | ceph_mdsc_put_request(req); | 770 | 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 | return -EISDIR; | 1189 | return -EISDIR; |
1190 | 1190 | ||
1191 | if (!cf->dir_info) { | 1191 | if (!cf->dir_info) { |
1192 | cf->dir_info = kmalloc(bufsize, GFP_NOFS); | 1192 | cf->dir_info = kmalloc(bufsize, GFP_KERNEL); |
1193 | if (!cf->dir_info) | 1193 | if (!cf->dir_info) |
1194 | return -ENOMEM; | 1194 | return -ENOMEM; |
1195 | cf->dir_info_len = | 1195 | cf->dir_info_len = |
diff --git a/fs/ceph/file.c b/fs/ceph/file.c index 8a4eb4d21d3c..424b5b540207 100644 --- a/fs/ceph/file.c +++ b/fs/ceph/file.c | |||
@@ -89,7 +89,7 @@ static int ceph_init_file(struct inode *inode, struct file *file, int fmode) | |||
89 | case S_IFDIR: | 89 | case S_IFDIR: |
90 | dout("init_file %p %p 0%o (regular)\n", inode, file, | 90 | dout("init_file %p %p 0%o (regular)\n", inode, file, |
91 | inode->i_mode); | 91 | inode->i_mode); |
92 | cf = kmem_cache_alloc(ceph_file_cachep, GFP_NOFS | __GFP_ZERO); | 92 | cf = kmem_cache_alloc(ceph_file_cachep, GFP_KERNEL | __GFP_ZERO); |
93 | if (cf == NULL) { | 93 | if (cf == NULL) { |
94 | ceph_put_fmode(ceph_inode(inode), fmode); /* clean up */ | 94 | ceph_put_fmode(ceph_inode(inode), fmode); /* clean up */ |
95 | return -ENOMEM; | 95 | return -ENOMEM; |
@@ -483,7 +483,7 @@ static ssize_t ceph_sync_read(struct kiocb *iocb, struct iov_iter *i, | |||
483 | } | 483 | } |
484 | } else { | 484 | } else { |
485 | num_pages = calc_pages_for(off, len); | 485 | num_pages = calc_pages_for(off, len); |
486 | pages = ceph_alloc_page_vector(num_pages, GFP_NOFS); | 486 | pages = ceph_alloc_page_vector(num_pages, GFP_KERNEL); |
487 | if (IS_ERR(pages)) | 487 | if (IS_ERR(pages)) |
488 | return PTR_ERR(pages); | 488 | return PTR_ERR(pages); |
489 | ret = striped_read(inode, off, len, pages, | 489 | 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 | */ | 734 | */ |
735 | num_pages = (len + PAGE_CACHE_SIZE - 1) >> PAGE_CACHE_SHIFT; | 735 | num_pages = (len + PAGE_CACHE_SIZE - 1) >> PAGE_CACHE_SHIFT; |
736 | 736 | ||
737 | pages = ceph_alloc_page_vector(num_pages, GFP_NOFS); | 737 | pages = ceph_alloc_page_vector(num_pages, GFP_KERNEL); |
738 | if (IS_ERR(pages)) { | 738 | if (IS_ERR(pages)) { |
739 | ret = PTR_ERR(pages); | 739 | ret = PTR_ERR(pages); |
740 | goto out; | 740 | goto out; |
@@ -858,7 +858,7 @@ again: | |||
858 | struct page *page = NULL; | 858 | struct page *page = NULL; |
859 | loff_t i_size; | 859 | loff_t i_size; |
860 | if (retry_op == READ_INLINE) { | 860 | if (retry_op == READ_INLINE) { |
861 | page = __page_cache_alloc(GFP_NOFS); | 861 | page = __page_cache_alloc(GFP_KERNEL); |
862 | if (!page) | 862 | if (!page) |
863 | return -ENOMEM; | 863 | return -ENOMEM; |
864 | } | 864 | } |
diff --git a/fs/ceph/mds_client.c b/fs/ceph/mds_client.c index 8d73fe9d488b..6aa07af67603 100644 --- a/fs/ceph/mds_client.c +++ b/fs/ceph/mds_client.c | |||
@@ -1668,7 +1668,8 @@ int ceph_alloc_readdir_reply_buffer(struct ceph_mds_request *req, | |||
1668 | 1668 | ||
1669 | order = get_order(size * num_entries); | 1669 | order = get_order(size * num_entries); |
1670 | while (order >= 0) { | 1670 | while (order >= 0) { |
1671 | rinfo->dir_in = (void*)__get_free_pages(GFP_NOFS | __GFP_NOWARN, | 1671 | rinfo->dir_in = (void*)__get_free_pages(GFP_KERNEL | |
1672 | __GFP_NOWARN, | ||
1672 | order); | 1673 | order); |
1673 | if (rinfo->dir_in) | 1674 | if (rinfo->dir_in) |
1674 | break; | 1675 | break; |