ext4: flex_bg ialloc, don't pick "best_flex" with 0 inodes
RFC PATCH 1/1 ext4: flex_bg ialloc, don't pick "best_flex" with 0 inodes
I've got a case where I have a 99G fs with 17G free, as well as 400k free inodes, and yet I cannot create a new inode.
The find_group_flex() function starts with best_flex as the parent_fbg_group, which happens to have 0 inodes free.
Some of the flex groups searched have free blocks and free inodes, but the flex_freeb_ratio is < 10, so they're skipped.
Then when a group is compared to the current "best" flex group, it does not have more free blocks than "best", so it is skipped as well.
This continues until no flex group with free inodes is found which has a proper ratio or which has more free blocks than the "best" group, and we're left with a "best" group that has 0 inodes free, and we return -ENOSPC.
It seems like adjusting the following test is a better plan; for starters I do not see that best_flex can ever be < 0, so that test is replaced, and if the current "best" flex group has no inodes free, and the current one does have room, it is promoted to the next "best."
Comments?
---
fs/ext4/ialloc.c +1 -1
@@ -351,7 +351,7 @@ find_close_to_parent: goto found_flexbg; } -if (best_flex <0 || +if (flex_group[best_flex].free_inodes ==0 || (flex_group[i].free_blocks > flex_group[best_flex].free_blocks && flex_group[i].free_inodes))
Theodore Tso
maintainerQuoted 2 lines · Eric Sandeen
It seems like adjusting the following test is a better plan; for starters I do not see that
best_flexcan ever be < 0, so
Given that ext4_group_t is an unsigned long, that's certainly true. :-)
Quoted 3 lines
that test is replaced, and if the current "best" flex group has no inodes free, and the current one does have room, it is promoted to the next "best."
Looks good to me. I've added it to the patch queue.
Quoted 1 line
Signed-of-by Eric Sandeen <[email protected]>
(forgot an 'f' :-)
- Ted
Quoted 6 lines · Theodore Tso
Quoted 2 lines · Eric Sandeen
It seems like adjusting the following test is a better plan; for starters I do not see that
best_flexcan ever be < 0, soGiven that
ext4_group_tis an unsigned long, that's certainly true. :-)
Heh, that too!
Quoted 9 lines
Quoted 3 lines
that test is replaced, and if the current "best" flex group has no inodes free, and the current one does have room, it is promoted to the next "best."
Looks good to me. I've added it to the patch queue.
Quoted 1 line
Signed-of-by Eric Sandeen <[email protected]>(forgot an 'f' :-)
Urk...
Thanks!
-Eric
Quoted 3 lines
Signed-off-by "Theodore Ts'o" <[email protected]>- Ted