All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Aneesh Kumar K. V" <aneesh.kumar@linux.vnet.ibm.com>
To: Andreas Dilger <adilger@sun.com>,
	Ext4 Developers List <linux-ext4@vger.kernel.org>
Cc: "Theodore Ts'o" <tytso@mit.edu>
Subject: Re: [PATCH] avoid scanning bitmaps for group preallocation
Date: Fri, 26 Mar 2010 15:58:12 +0530	[thread overview]
Message-ID: <87y6hfwf5v.fsf@linux.vnet.ibm.com> (raw)
In-Reply-To: <A2A61325-CB7F-40E0-B9B9-A918135BCBC6@sun.com>

On Mon, 22 Mar 2010 16:03:10 -0600, Andreas Dilger <adilger@sun.com> wrote:
> Here is the patch I mentioned today on the call.  It avoids (or at  
> least reduces) serious latency (10 minutes or more) on a large  
> filesystem (8TB+) on the first write, if the filesystem is nearly  
> full.  The latency is entirely due to seeking to read the block  
> bitmaps, so is considerably less serious on flex_bg formatted  
> filesystems.
> 
> A better long-term approach would be to store in the superblock the  
> last group that had space to allocate a stripe-sized chunk and/or flag  
> in the group descriptor if there is not a large amount of contiguous  
> free space therein (cleared on freeing blocks in the group).
> 
> Having the mount-time buddy-bitmap (and checksum verifying) scanning  
> thread start at mount would only help if the first write to the  
> filesystem is not immediately after mount (which it is in Lustre at  
> least).  Having a filesystem-wide (r)btree for the freespace (ala XFS)  
> would also only help if the btree could be (at least partially) built  
> from bitmaps before the first write, unless we cache the bitmap on  
> disk, which caused Lustre plenty in the past and I'm leery to do it.
> 
> 

@@ -125,8 +125,7 @@
  * list. In case of inode preallocation we follow a list of heuristics
  * based on file size. This can be found in ext4_mb_normalize_request. If
  * we are doing a group prealloc we try to normalize the request to
- * sbi->s_mb_group_prealloc. Default value of s_mb_group_prealloc is
- * 512 blocks. This can be tuned via
+ * sbi->s_mb_group_prealloc.  This can be tuned via
  * /sys/fs/ext4/<partition/mb_group_prealloc. The value is represented in
  * terms of number of blocks. If we have mounted the file system with -O
  * stripe=<value> option the group prealloc request is normalized to the
@@ -2029,9 +2028,12 @@ repeat:
			if (group == ngroups)
				group = 0;
 
-			/* quick check to skip empty groups */
+			/* If there's no chance that this group has a better
+			 * extent, just skip it instead of seeking to read
+			 * block bitmap from disk. Initially ac_b_ex.fe_len = 0,
+			 * so this always skips groups with no free space. */
			grp = ext4_get_group_info(sb, group);
-			if (grp->bb_free == 0)
+			if (grp->bb_free <= ac->ac_b_ex.fe_len)
				continue;
 
			err = ext4_mb_load_buddy(sb, group, &e4b);

I was wondering whether we need to make sure we also use criteria value
when checking for bb_free. If we are really low on space we may want to
return what is left right ?. Or does ac_b_ex take care of that ?

-aneesh

  reply	other threads:[~2010-03-26 10:28 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-03-22 22:03 [PATCH] avoid scanning bitmaps for group preallocation Andreas Dilger
2010-03-26 10:28 ` Aneesh Kumar K. V [this message]
2010-03-26 17:58   ` Andreas Dilger

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=87y6hfwf5v.fsf@linux.vnet.ibm.com \
    --to=aneesh.kumar@linux.vnet.ibm.com \
    --cc=adilger@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.