linux-fsdevel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jan Kara <jack@suse.cz>
To: reiserfs-list@namesys.com
Cc: linux-fsdevel@vger.kernel.org
Subject: [PATCH] Fix reiserfs oops on small fs
Date: Thu, 18 Nov 2004 12:49:29 +0100	[thread overview]
Message-ID: <20041118114928.GD2767@atrey.karlin.mff.cuni.cz> (raw)

[-- Attachment #1: Type: text/plain, Size: 255 bytes --]

  Hello!

  Attached patch fixes oops of reiserfs on a filesystem with just one
bitmap block - current code always tries to return second bitmap even if
there's not any. Could someone review it please so that it can be merged
in mainline?
	
								Honza

[-- Attachment #2: quota-new-2.6.10-rc2-mm1-4-reisersmall.diff --]
[-- Type: text/plain, Size: 1370 bytes --]

Fix block allocation code of reiserfs to give correct bitmap numbers
for small filesystems (with just one bitmap block).

Signed-off-by: Jan Kara <jack@suse.cz>

diff -rupNX /home/jack/.kerndiffexclude linux-2.6.10-rc2-mm1-3-reiserdebug/fs/reiserfs/bitmap.c linux-2.6.10-rc2-mm1-4-reisersmall/fs/reiserfs/bitmap.c
--- linux-2.6.10-rc2-mm1-3-reiserdebug/fs/reiserfs/bitmap.c	2004-11-16 16:57:33.000000000 +0100
+++ linux-2.6.10-rc2-mm1-4-reisersmall/fs/reiserfs/bitmap.c	2004-11-16 17:01:47.000000000 +0100
@@ -229,6 +229,9 @@ static int bmap_hash_id(struct super_blo
     unsigned long hash;
     unsigned bm;
 
+    /* If there is only one bitmap, we have no choice... */
+    if (SB_BMAP_NR(s) == 1)
+	return 0;
     if (id <= 2) {
 	bm = 1;
     } else {
@@ -613,7 +616,7 @@ dirid_groups (reiserfs_blocknr_hint_t *h
 	/* give a portion of the block group to metadata */
 	if (hint->inode)
 	    hash += sb->s_blocksize/2;
-	hint->search_start = hash;
+	hint->search_start = hash >= SB_BLOCK_COUNT(sb) ? SB_BLOCK_COUNT(sb)-1 : hash;
     }
 }
 
@@ -642,7 +645,7 @@ oid_groups (reiserfs_blocknr_hint_t *hin
 	    bm = bmap_hash_id(hint->inode->i_sb, oid);
 	    hash = bm * (hint->inode->i_sb->s_blocksize << 3);
 	}
-	hint->search_start = hash;
+	hint->search_start = hash >= SB_BLOCK_COUNT(hint->inode->i_sb) ? SB_BLOCK_COUNT(hint->inode->i_sb)-1 : hash;
     }
 }
 

             reply	other threads:[~2004-11-18 11:51 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-11-18 11:49 Jan Kara [this message]
2004-11-18 14:09 ` [PATCH] Fix reiserfs oops on small fs Chris Mason
2004-11-19  9:31   ` Jan Kara

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=20041118114928.GD2767@atrey.karlin.mff.cuni.cz \
    --to=jack@suse.cz \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=reiserfs-list@namesys.com \
    /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 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).