All of lore.kernel.org
 help / color / mirror / Atom feed
From: <stone_wang@sohu.com>
To: <linux-kernel@vger.kernel.org>
Cc: <akpm@osdl.org>
Subject: [patch to 2.6.10-rc2] ext3_find_goal
Date: Sun, 23 Jan 2005 04:16:41 +0800 (CST)	[thread overview]
Message-ID: <31531613.1106425001426.JavaMail.postfix@mx20.mail.sohu.com> (raw)



We found strange blocks layout in our mail server, after careful study,
we got the reason and tried to fix it.

When loading an inode from buffer/disk(ext2/3_read_inode),then allocating the second block(block==1) of the corresponding file: i_next_alloc_block and i_next_alloc_goal are both zero,and in fact are not valid,
but they(i_next_alloc_block/goal) take effect in the former codes. This causes non-contiguous file.

Below patch add a check,and fixes this.

Stone Wang.
2005.01.23

diff -urN linux-2.6.10-rc2/fs/ext2/inode.c linux-2.6.10-rc2-fixed/fs/ext2/inode.c
--- linux-2.6.10-rc2/fs/ext2/inode.c	2005-01-23 03:01:42.000000000 -0500
+++ linux-2.6.10-rc2-fixed/fs/ext2/inode.c	2005-01-23 02:57:41.000000000 -0500
@@ -354,7 +354,7 @@
 {
 	struct ext2_inode_info *ei = EXT2_I(inode);
 	write_lock(&ei->i_meta_lock);
-	if (block == ei->i_next_alloc_block + 1) {
+	if ((block == ei->i_next_alloc_block + 1)&& ei->i_next_alloc_goal) {
 		ei->i_next_alloc_block++;
 		ei->i_next_alloc_goal++;
 	} 
diff -urN linux-2.6.10-rc2/fs/ext3/inode.c linux-2.6.10-rc2-fixed/fs/ext3/inode.c
--- linux-2.6.10-rc2/fs/ext3/inode.c	2005-01-23 03:01:42.000000000 -0500
+++ linux-2.6.10-rc2-fixed/fs/ext3/inode.c	2005-01-23 02:08:58.000000000 -0500
@@ -464,7 +464,7 @@
 {
 	struct ext3_inode_info *ei = EXT3_I(inode);
 	/* Writer: ->i_next_alloc* */
-	if (block == ei->i_next_alloc_block + 1) {
+	if ((block == ei->i_next_alloc_block + 1)&& ei->i_next_alloc_goal) {
 		ei->i_next_alloc_block++;
 		ei->i_next_alloc_goal++;
 	}


             reply	other threads:[~2005-01-22 20:16 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-01-22 20:16 stone_wang [this message]
2005-01-22 22:21 ` [patch to 2.6.10-rc2] ext3_find_goal Jeff Garzik

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=31531613.1106425001426.JavaMail.postfix@mx20.mail.sohu.com \
    --to=stone_wang@sohu.com \
    --cc=akpm@osdl.org \
    --cc=linux-kernel@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.