All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Aneesh Kumar K.V" <aneesh.kumar@linux.vnet.ibm.com>
To: "Theodore Ts'o" <tytso@mit.edu>
Cc: Andreas Dilger <adilger@sun.com>, Alex Tomas <bzzz@sun.com>,
	linux-ext4@vger.kernel.org
Subject: Re: Questions about mballoc's stream allocation
Date: Tue, 11 Aug 2009 21:09:05 +0530	[thread overview]
Message-ID: <20090811153905.GA2914@skywalker> (raw)
In-Reply-To: <E1MZPAn-0001Y0-TQ@closure.thunk.org>

On Fri, Aug 07, 2009 at 09:07:53AM -0400, Theodore Ts'o wrote:
> 
> 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?
> 

I guess we should be setting the sbi->s_mb_last_{group,start} only when doing
small file allocation. We want to make sure small file allocation always
use the goal block near to the previous small file allocation request. So
(size <  sbi->s_mb_stream_request) is correct. But we should not be doing

         sbi->s_mb_last_group = ac->ac_f_ex.fe_group;  
always.

For large file allocation we wanted the new blocks to closer to that files previous
allocated block which ext4_ext_find_goal return as the goal value. So for
large files the goal value passed should represent the correct value.

NOTE: I am still behind ext4 list mails due to other commitments. Will start looking
at the mails, but mostly would be slow in replies

-aneesh

  parent reply	other threads:[~2009-08-11 15:39 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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 ` Aneesh Kumar K.V [this message]
2009-08-11 17:37   ` Questions about mballoc's stream allocation Aneesh Kumar K.V

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20090811153905.GA2914@skywalker \
    --to=aneesh.kumar@linux.vnet.ibm.com \
    --cc=adilger@sun.com \
    --cc=bzzz@sun.com \
    --cc=linux-ext4@vger.kernel.org \
    --cc=tytso@mit.edu \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.