Skip to contentSkip to conversation

fs/f2fs: replace open coded nofail allocation in __add_ino_entry

PATCH In review Zhang Zhen 2 participants 3 messages Aug 24, 2015 1 message not in the archive F2FS file system

lore
Share & tools
lore

A message that is not in the archive (sent off-list or not yet received): [email protected]

Zhang Zhen

author
#1 lore raw

PATCH 1/1 fs/f2fs: replace open coded nofail allocation in __add_ino_entry

__add_ino_entry is looping around the allocation request and minics __GFP_NOFAIL behavior without any allocation fallback strategy. Here remove the open coded loop and replace it with __GFP_NOFAIL.

---
 fs/f2fs/checkpoint.c | 7 +------
 1 file changed, 1 insertion(+), 6 deletions(-)
fs/f2fs/checkpoint.c +1 -6
index b70bbe1..d62363b 100644
@@ -337,12 +337,7 @@ retry:
 
 	e = radix_tree_lookup(&im->ino_root, ino);
 	if (!e) {
-		e = kmem_cache_alloc(ino_entry_slab, GFP_ATOMIC);
-		if (!e) {
-			spin_unlock(&im->ino_lock);
-			radix_tree_preload_end();
-			goto retry;
-		}
+		e = kmem_cache_alloc(ino_entry_slab, GFP_ATOMIC|__GFP_NOFAIL);
 		if (radix_tree_insert(&im->ino_root, ino, e)) {
 			spin_unlock(&im->ino_lock);
 			kmem_cache_free(ino_entry_slab, e);
Signature · 10 lines
1.9.1


.





------------------------------------------------------------------------------
maintainer
#2 lore raw

Hi Zhang,

Quoted 14 lines · Zhang Zhen

__add_ino_entry is looping around the allocation request and minics __GFP_NOFAIL behavior without any allocation fallback strategy. Here remove the open coded loop and replace it with __GFP_NOFAIL.

---
 fs/f2fs/checkpoint.c | 7 +------
 1 file changed, 1 insertion(+), 6 deletions(-)
fs/f2fs/checkpoint.c +0 -0
index b70bbe1..d62363b 100644

fs/f2fs/checkpoint.c retry: · line 340

Quoted 10 lines
fs/f2fs/checkpoint.c +1 -6
@@ -337,12 +337,7 @@ retry:
 
 	e = radix_tree_lookup(&im->ino_root, ino);
 	if (!e) {
-		e = kmem_cache_alloc(ino_entry_slab, GFP_ATOMIC);
-		if (!e) {
-			spin_unlock(&im->ino_lock);
-			radix_tree_preload_end();
-			goto retry;
-		}
+		e = kmem_cache_alloc(ino_entry_slab, GFP_ATOMIC|__GFP_NOFAIL);

I submitted a patch to replace GFP_ATOMIC with GFP_NOFS. We can avoid to use GFP_ATOMIC here, right?

Thanks,

Quoted 18 lines
fs/f2fs/checkpoint.c +0 -0
 		if (radix_tree_insert(&im->ino_root, ino, e)) {
 			spin_unlock(&im->ino_lock);
 			kmem_cache_free(ino_entry_slab, e);
Signature · 14 lines
1.9.1


.





------------------------------------------------------------------------------
_______________________________________________
Linux-f2fs-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel

------------------------------------------------------------------------------

author
#3 lore raw
Quoted 18 lines · Jaegeuk Kim

Hi Zhang,

Quoted 15 lines · Zhang Zhen

__add_ino_entry is looping around the allocation request and minics __GFP_NOFAIL behavior without any allocation fallback strategy. Here remove the open coded loop and replace it with __GFP_NOFAIL.

---
 fs/f2fs/checkpoint.c | 7 +------
 1 file changed, 1 insertion(+), 6 deletions(-)
fs/f2fs/checkpoint.c +0 -0
index b70bbe1..d62363b 100644
@@ -337,12 +337,7 @@ retry:
 
Quoted 13 lines

fs/f2fs/checkpoint.c retry: · line 340

Quoted 9 lines
fs/f2fs/checkpoint.c +1 -6
 	e = radix_tree_lookup(&im->ino_root, ino);
 	if (!e) {
-		e = kmem_cache_alloc(ino_entry_slab, GFP_ATOMIC);
-		if (!e) {
-			spin_unlock(&im->ino_lock);
-			radix_tree_preload_end();
-			goto retry;
-		}
+		e = kmem_cache_alloc(ino_entry_slab, GFP_ATOMIC|__GFP_NOFAIL);

I submitted a patch to replace GFP_ATOMIC with GFP_NOFS. We can avoid to use GFP_ATOMIC here, right?

Yes, i think so.

Quoted 22 lines

Thanks,

Quoted 18 lines
fs/f2fs/checkpoint.c +0 -0
 		if (radix_tree_insert(&im->ino_root, ino, e)) {
 			spin_unlock(&im->ino_lock);
 			kmem_cache_free(ino_entry_slab, e);
Signature · 14 lines
1.9.1


.





------------------------------------------------------------------------------
_______________________________________________
Linux-f2fs-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel

------------------------------------------------------------------------------