diff options
author | Jaegeuk Kim <jaegeuk@kernel.org> | 2015-08-20 08:51:56 -0700 |
---|---|---|
committer | Jaegeuk Kim <jaegeuk@kernel.org> | 2015-08-24 09:37:21 -0700 |
commit | 80c545055dc7c1f7f487176fe0aac17896a4b7af (patch) | |
tree | b8c4ffbb9aa10da0c26ab5f7caf264e68803b685 /fs/f2fs/f2fs.h | |
parent | dac2ddefe62841efc0b6cdcb0bbf3e3594aa01bf (diff) |
f2fs: use __GFP_NOFAIL to avoid infinite loop
__GFP_NOFAIL can avoid retrying the whole path of kmem_cache_alloc and
bio_alloc.
And, it also fixes the use cases of GFP_ATOMIC correctly.
Suggested-by: Chao Yu <chao2.yu@samsung.com>
Reviewed-by: Chao Yu <chao2.yu@samsung.com>
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
Diffstat (limited to 'fs/f2fs/f2fs.h')
-rw-r--r-- | fs/f2fs/f2fs.h | 16 |
1 files changed, 5 insertions, 11 deletions
diff --git a/fs/f2fs/f2fs.h b/fs/f2fs/f2fs.h index 66410178aba1..ece5e704dfd0 100644 --- a/fs/f2fs/f2fs.h +++ b/fs/f2fs/f2fs.h @@ -1252,13 +1252,10 @@ static inline void *f2fs_kmem_cache_alloc(struct kmem_cache *cachep, gfp_t flags) { void *entry; -retry: - entry = kmem_cache_alloc(cachep, flags); - if (!entry) { - cond_resched(); - goto retry; - } + entry = kmem_cache_alloc(cachep, flags); + if (!entry) + entry = kmem_cache_alloc(cachep, flags | __GFP_NOFAIL); return entry; } @@ -1267,12 +1264,9 @@ static inline struct bio *f2fs_bio_alloc(int npages) struct bio *bio; /* No failure on bio allocation */ -retry: bio = bio_alloc(GFP_NOIO, npages); - if (!bio) { - cond_resched(); - goto retry; - } + if (!bio) + bio = bio_alloc(GFP_NOIO | __GFP_NOFAIL, npages); return bio; } |