linux-ext4.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] ext4: check if group has free space
@ 2019-03-07 11:49 Artem Blagodarenko
  2019-03-15  4:31 ` Theodore Ts'o
  0 siblings, 1 reply; 2+ messages in thread
From: Artem Blagodarenko @ 2019-03-07 11:49 UTC (permalink / raw)
  To: linux-ext4; +Cc: adilger.kernel, alexey.lyashkov

Regular allocator make four groups processing loops to
find good group to allocate blocks. On 4th loop it accept any
group, even if there is no free space at all.

This patch adds group free space check to skip full groups.

Sigend-off-by: Artem Blagodarenko <c17828@cray.com>
---
 fs/ext4/mballoc.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/fs/ext4/mballoc.c b/fs/ext4/mballoc.c
index e2248083cdca..4e6c36ff1d55 100644
--- a/fs/ext4/mballoc.c
+++ b/fs/ext4/mballoc.c
@@ -2087,7 +2087,8 @@ static int ext4_mb_good_group(struct ext4_allocation_context *ac,
 			return 1;
 		break;
 	case 3:
-		return 1;
+		/* Skip group without any free space */
+		return free ? 1 : 0;
 	default:
 		BUG();
 	}
-- 
2.14.3


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] ext4: check if group has free space
  2019-03-07 11:49 [PATCH] ext4: check if group has free space Artem Blagodarenko
@ 2019-03-15  4:31 ` Theodore Ts'o
  0 siblings, 0 replies; 2+ messages in thread
From: Theodore Ts'o @ 2019-03-15  4:31 UTC (permalink / raw)
  To: Artem Blagodarenko; +Cc: linux-ext4, adilger.kernel, alexey.lyashkov

On Thu, Mar 07, 2019 at 02:49:14PM +0300, Artem Blagodarenko wrote:
> Regular allocator make four groups processing loops to
> find good group to allocate blocks. On 4th loop it accept any
> group, even if there is no free space at all.
> 
> This patch adds group free space check to skip full groups.
> 
> Sigend-off-by: Artem Blagodarenko <c17828@cray.com>

This patch doesn't change anything.  Note the check that we have at
the very beginning of ext4_mb_good_group():

	free = grp->bb_free;
	if (free == 0)
		return 0;

This is before we even go into the case statement, so your change:

>  	case 3:
> -		return 1;
> +		/* Skip group without any free space */
> +		return free ? 1 : 0;

is a no-op; we will always be returning 1, since if free == 0, we would
have bailed out at the top of the function.

Cheers,

					- Ted

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2019-03-15  4:31 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-03-07 11:49 [PATCH] ext4: check if group has free space Artem Blagodarenko
2019-03-15  4:31 ` Theodore Ts'o

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).