From: Jeff Mahoney <jeffm@suse.com>
To: Andrew Morton <akpm@linux-foundation.org>,
Linux Torvalds <torvalds@linux-foundation.org>
Cc: ReiserFS Development Mailing List <reiserfs-devel@vger.kernel.org>
Subject: [patch 6/7] reiserfs: remove first_zero_hint
Date: Tue, 16 Oct 2007 19:02:16 -0400 [thread overview]
Message-ID: <20071016230258.926802000@suse.com> (raw)
In-Reply-To: 20071016230210.779927000@suse.com
[-- Attachment #1: patches.suse/reiserfs-remove-first-zero-hint.diff --]
[-- Type: text/plain, Size: 4117 bytes --]
The first_zero_hint metadata caching was never actually used, and it's
of dubious optimization quality. This patch removes it.
It doesn't actually shrink the size of the reiserfs_bitmap_info struct,
since that doesn't work with block sizes larger than 8K. There was a big
fixme in there, and with all the work lately in allowing block size >
page size, I might as well kill the fixme as well.
Signed-off-by: Jeff Mahoney <jeffm@suse.com>
---
fs/reiserfs/bitmap.c | 27 +++++++++++----------------
fs/reiserfs/resize.c | 6 ------
include/linux/reiserfs_fs_sb.h | 4 +---
3 files changed, 12 insertions(+), 25 deletions(-)
--- a/fs/reiserfs/bitmap.c 2007-10-16 18:55:51.029160630 -0400
+++ b/fs/reiserfs/bitmap.c 2007-10-16 18:55:56.205787201 -0400
@@ -273,7 +273,7 @@ static inline int block_group_used(struc
* to make a better decision. This favors long-term performace gain
* with a better on-disk layout vs. a short term gain of skipping the
* read and potentially having a bad placement. */
- if (info->first_zero_hint == 0) {
+ if (info->free_count == UINT_MAX) {
struct buffer_head *bh = reiserfs_read_bitmap_block(s, bm);
brelse(bh);
}
@@ -1271,27 +1271,22 @@ void reiserfs_cache_bitmap_metadata(stru
{
unsigned long *cur = (unsigned long *)(bh->b_data + bh->b_size);
- info->first_zero_hint = 1 << (sb->s_blocksize_bits + 3);
+ /* The first bit must ALWAYS be 1 */
+ BUG_ON (!reiserfs_test_le_bit(0, (unsigned long)bh->b_data))
+
+ info->free_count = 0;
while (--cur >= (unsigned long *)bh->b_data) {
- int base = ((char *)cur - bh->b_data) << 3;
+ int i;
/* 0 and ~0 are special, we can optimize for them */
- if (*cur == 0) {
- info->first_zero_hint = base;
+ if (*cur == 0)
info->free_count += BITS_PER_LONG;
- } else if (*cur != ~0L) { /* A mix, investigate */
- int b;
- for (b = BITS_PER_LONG - 1; b >= 0; b--) {
- if (!reiserfs_test_le_bit(b, cur)) {
- info->first_zero_hint = base + b;
+ else if (*cur != ~0L) /* A mix, investigate */
+ for (i = BITS_PER_LONG - 1; i >= 0; i--)
+ if (!reiserfs_test_le_bit(i, cur))
info->free_count++;
- }
- }
- }
}
- /* The first bit must ALWAYS be 1 */
- BUG_ON(info->first_zero_hint == 0);
}
struct buffer_head *reiserfs_read_bitmap_block(struct super_block *sb,
@@ -1321,7 +1316,7 @@ struct buffer_head *reiserfs_read_bitmap
BUG_ON(!buffer_uptodate(bh));
BUG_ON(atomic_read(&bh->b_count) == 0);
- if (info->first_zero_hint == 0)
+ if (info->free_count == UINT_MAX)
reiserfs_cache_bitmap_metadata(sb, bh, info);
}
--- a/fs/reiserfs/resize.c 2007-10-16 18:55:51.029160630 -0400
+++ b/fs/reiserfs/resize.c 2007-10-16 18:55:56.206787129 -0400
@@ -143,7 +143,6 @@ int reiserfs_resize(struct super_block *
mark_buffer_dirty(bh);
sync_dirty_buffer(bh);
// update bitmap_info stuff
- bitmap[i].first_zero_hint = 1;
bitmap[i].free_count = sb_blocksize(sb) * 8 - 1;
brelse(bh);
}
@@ -173,8 +172,6 @@ int reiserfs_resize(struct super_block *
for (i = block_r; i < s->s_blocksize * 8; i++)
reiserfs_test_and_clear_le_bit(i, bh->b_data);
info->free_count += s->s_blocksize * 8 - block_r;
- if (!info->first_zero_hint)
- info->first_zero_hint = block_r;
journal_mark_dirty(&th, s, bh);
brelse(bh);
@@ -196,9 +193,6 @@ int reiserfs_resize(struct super_block *
brelse(bh);
info->free_count -= s->s_blocksize * 8 - block_r_new;
- /* Extreme case where last bitmap is the only valid block in itself. */
- if (!info->free_count)
- info->first_zero_hint = 0;
/* update super */
reiserfs_prepare_for_journal(s, SB_BUFFER_WITH_SB(s), 1);
free_blocks = SB_FREE_BLOCKS(s);
--- a/include/linux/reiserfs_fs_sb.h 2007-10-16 18:55:51.030160558 -0400
+++ b/include/linux/reiserfs_fs_sb.h 2007-10-16 18:55:53.964948838 -0400
@@ -265,9 +265,7 @@ enum journal_state_bits {
typedef __u32(*hashf_t) (const signed char *, int);
struct reiserfs_bitmap_info {
- // FIXME: Won't work with block sizes > 8K
- __u16 first_zero_hint;
- __u16 free_count;
+ __u32 free_count;
};
struct proc_dir_entry;
--
next prev parent reply other threads:[~2007-10-16 23:02 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-10-16 23:02 [patch 0/7] reiserfs fixes patch set Jeff Mahoney
2007-10-16 23:02 ` [patch 1/7] reiserfs: fix up lockdep warnings Jeff Mahoney
2007-10-16 23:02 ` [patch 2/7] reiserfs: dont use BUG when panicking Jeff Mahoney
2007-10-16 23:02 ` [patch 3/7] reiserfs: use is_reusable to catch corruption Jeff Mahoney
2007-10-16 23:02 ` [patch 4/7] reiserfs: fix usage of signed ints for block numbers Jeff Mahoney
2007-10-16 23:02 ` [patch 5/7] reiserfs: fix memset byte count during resize Jeff Mahoney
2007-10-16 23:02 ` Jeff Mahoney [this message]
2007-10-18 18:02 ` [patch 6/7] reiserfs: remove first_zero_hint Jeff Mahoney
2007-10-16 23:02 ` [patch 7/7] reiserfs: ignore on disk s_bmap_nr value Jeff Mahoney
2007-10-17 22:19 ` Andrew Morton
2007-10-17 22:11 ` [patch 0/7] reiserfs fixes patch set Andrew Morton
2007-10-17 22:19 ` Linus Torvalds
2007-10-17 23:23 ` Jeff Mahoney
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=20071016230258.926802000@suse.com \
--to=jeffm@suse.com \
--cc=akpm@linux-foundation.org \
--cc=reiserfs-devel@vger.kernel.org \
--cc=torvalds@linux-foundation.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.