linux-ext4.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* Questions about mballoc's stream allocation
@ 2009-08-07 13:07 Theodore Ts'o
  2009-08-08  7:51 ` Andreas Dilger
                   ` (3 more replies)
  0 siblings, 4 replies; 6+ messages in thread
From: Theodore Ts'o @ 2009-08-07 13:07 UTC (permalink / raw)
  To: Andreas Dilger, Alex Tomas; +Cc: linux-ext4


I've got two questions about mballoc's stream allocation.

First of all, in ext4_mb_regular_allocator(), I'm 99% sure this is a
bug:

	/* if stream allocation is enabled, use global goal */
	size = ac->ac_o_ex.fe_logical + ac->ac_o_ex.fe_len;
	isize = i_size_read(ac->ac_inode) >> bsbits;
	if (size < isize)
		size = isize;

	if (size < sbi->s_mb_stream_request &&
	    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
			(ac->ac_flags & EXT4_MB_HINT_DATA)) {
		/* TBD: may be hot point */
		spin_lock(&sbi->s_md_lock);
		ac->ac_g_ex.fe_group = sbi->s_mb_last_group;
		ac->ac_g_ex.fe_start = sbi->s_mb_last_start;
		spin_unlock(&sbi->s_md_lock);
	}

Shouldn't that be ">=", not "<".  We want to use the values saved in
sbi->s_mb_last_{group,start} only if we are doing a stream allocation,
which would be true only if the file is *larger* than
s_mb_stream_request, no?


The second question I have is with regards to ext4_mb_use_best_found(),
we set sbi->s_mb_last_{group,start} on any data allocation; shouldn't we
only be setting those values only if we were doing a stream allocation
in the first place?

Otherwise, any kind of allocation will end up moving the global goal
block for stream allocations; even if it is a small allocation in the
middle of some block group caused by the flag EXT4_MB_HINT_NO_PREALLOC
being set.

Am I missing anything?

     	   	      	       		     - Ted

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

end of thread, other threads:[~2009-08-11 17:37 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-08-07 13:07 Questions about mballoc's stream allocation Theodore Ts'o
2009-08-08  7:51 ` Andreas Dilger
2009-08-08 22:52 ` [PATCH,RFC 1/2] ext4: Fix bugs in mballoc's stream allocation mode Theodore Ts'o
2009-08-08 22:52 ` [PATCH,RFC 2/2] ext4: Avoid group preallocation for closed files Theodore Ts'o
2009-08-11 15:39 ` Questions about mballoc's stream allocation Aneesh Kumar K.V
2009-08-11 17:37   ` Aneesh Kumar K.V

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).