From: Tomas Racek <tracek@redhat.com>
To: linux-ext4@vger.kernel.org
Cc: lczerner@redhat.com, Tomas Racek <tracek@redhat.com>
Subject: [PATCH] ext4: Automatic setting of {INODE,BLOCK}_UNINIT flags
Date: Thu, 25 Oct 2012 09:25:43 +0200 [thread overview]
Message-ID: <1351149943-4827-1-git-send-email-tracek@redhat.com> (raw)
When last inode from bg is freed, set the INODE_UNINIT flag, similarly
when last block is freed, set BLOCK_UNINIT flag. This can speed up
subsequent fsck run.
Signed-off-by: Tomas Racek <tracek@redhat.com>
---
fs/ext4/ialloc.c | 4 ++++
fs/ext4/mballoc.c | 4 ++++
2 files changed, 8 insertions(+)
diff --git a/fs/ext4/ialloc.c b/fs/ext4/ialloc.c
index 4facdd2..6e4b982 100644
--- a/fs/ext4/ialloc.c
+++ b/fs/ext4/ialloc.c
@@ -289,6 +289,10 @@ void ext4_free_inode(handle_t *handle, struct inode *inode)
count = ext4_free_inodes_count(sb, gdp) + 1;
ext4_free_inodes_set(sb, gdp, count);
+
+ if (count == EXT4_INODES_PER_GROUP(sb))
+ gdp->bg_flags |= cpu_to_le16(EXT4_BG_INODE_UNINIT);
+
if (is_directory) {
count = ext4_used_dirs_count(sb, gdp) - 1;
ext4_used_dirs_set(sb, gdp, count);
diff --git a/fs/ext4/mballoc.c b/fs/ext4/mballoc.c
index 526e553..28bce35 100644
--- a/fs/ext4/mballoc.c
+++ b/fs/ext4/mballoc.c
@@ -4665,6 +4665,10 @@ do_more:
ret = ext4_free_group_clusters(sb, gdp) + count_clusters;
ext4_free_group_clusters_set(sb, gdp, ret);
+
+ if(ret == EXT4_BLOCKS_PER_GROUP(sb))
+ gdp->bg_flags |= cpu_to_le16(EXT4_BG_BLOCK_UNINIT);
+
ext4_block_bitmap_csum_set(sb, block_group, gdp, bitmap_bh);
ext4_group_desc_csum_set(sb, block_group, gdp);
ext4_unlock_group(sb, block_group);
--
1.7.11.7
next reply other threads:[~2012-10-25 7:25 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-10-25 7:25 Tomas Racek [this message]
2012-10-25 7:44 ` [PATCH] ext4: Automatic setting of {INODE,BLOCK}_UNINIT flags Yongqiang Yang
2012-10-25 9:44 ` Lukáš Czerner
2012-10-25 11:39 ` Yongqiang Yang
2012-10-25 12:54 ` Zheng Liu
2012-10-25 13:59 ` Lukáš Czerner
2012-10-25 14:37 ` Andreas Dilger
2012-11-08 17:48 ` Theodore Ts'o
2012-12-20 9:48 ` Tomas Racek
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=1351149943-4827-1-git-send-email-tracek@redhat.com \
--to=tracek@redhat.com \
--cc=lczerner@redhat.com \
--cc=linux-ext4@vger.kernel.org \
/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.