reiserfs-devel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH resend 0/6] use little-endian bitops properly
@ 2011-06-26  5:57 Akinobu Mita
  2011-06-26  5:57 ` [PATCH resend 4/6] reiserfs: use proper little-endian bitops Akinobu Mita
  2011-06-26  5:57 ` [PATCH resend 5/6] reiserfs: use hweight_long() Akinobu Mita
  0 siblings, 2 replies; 3+ messages in thread
From: Akinobu Mita @ 2011-06-26  5:57 UTC (permalink / raw)
  To: linux-kernel, akpm
  Cc: Akinobu Mita, Theodore Ts'o, Andreas Dilger, linux-ext4,
	Alasdair Kergon, dm-devel, NeilBrown, linux-raid, reiserfs-devel,
	Joel Becker, Mark Fasheh, ocfs2-devel

All patches in this patch set were sent before. Individual patches
improve little-endian bitops usage in several places.

Akinobu Mita (6):
  ext4: use proper little-endian bitops
  dm: use use proper little-endian bitops
  md: use proper little-endian bitops
  reiserfs: use proper little-endian bitops
  reiserfs: use hweight_long()
  ocfs2: avoid unaligned access to dqc_bitmap

 drivers/md/bitmap.c         |    4 +-
 drivers/md/dm-log.c         |    9 +++----
 fs/ext4/ext4.h              |    7 +++--
 fs/ext4/ialloc.c            |    4 +-
 fs/ocfs2/ocfs2.h            |   47 +++++++++++++++++++++++++++++++++++++++++++
 fs/ocfs2/quota_local.c      |   10 ++++----
 fs/reiserfs/bitmap.c        |    8 +-----
 fs/reiserfs/resize.c        |    6 ++--
 include/linux/reiserfs_fs.h |    2 +
 9 files changed, 71 insertions(+), 26 deletions(-)

Cc: "Theodore Ts'o" <tytso@mit.edu>
Cc: Andreas Dilger <adilger.kernel@dilger.ca>
Cc: linux-ext4@vger.kernel.org
Cc: Alasdair Kergon <agk@redhat.com>
Cc: dm-devel@redhat.com
Cc: NeilBrown <neilb@suse.de>
Cc: linux-raid@vger.kernel.org
Cc: reiserfs-devel@vger.kernel.org
Cc: Joel Becker <jlbec@evilplan.org>
Cc: Mark Fasheh <mfasheh@suse.com>
Cc: ocfs2-devel@oss.oracle.com

-- 
1.7.4.4


^ permalink raw reply	[flat|nested] 3+ messages in thread

* [PATCH resend 4/6] reiserfs: use proper little-endian bitops
  2011-06-26  5:57 [PATCH resend 0/6] use little-endian bitops properly Akinobu Mita
@ 2011-06-26  5:57 ` Akinobu Mita
  2011-06-26  5:57 ` [PATCH resend 5/6] reiserfs: use hweight_long() Akinobu Mita
  1 sibling, 0 replies; 3+ messages in thread
From: Akinobu Mita @ 2011-06-26  5:57 UTC (permalink / raw)
  To: linux-kernel, akpm; +Cc: Akinobu Mita, reiserfs-devel

Using __test_and_{set,clear}_bit_le() with ignoring its return value
can be replaced with __{set,clear}_bit_le().

This introduces reiserfs_{set,clear}_le_bit for __{set,clear}_bit_le
and does the above change with them.

Signed-off-by: Akinobu Mita <akinobu.mita@gmail.com>
Cc: reiserfs-devel@vger.kernel.org
---
 fs/reiserfs/bitmap.c        |    2 +-
 fs/reiserfs/resize.c        |    6 +++---
 include/linux/reiserfs_fs.h |    2 ++
 3 files changed, 6 insertions(+), 4 deletions(-)

diff --git a/fs/reiserfs/bitmap.c b/fs/reiserfs/bitmap.c
index 483442e..567385a 100644
--- a/fs/reiserfs/bitmap.c
+++ b/fs/reiserfs/bitmap.c
@@ -214,7 +214,7 @@ static int scan_bitmap_block(struct reiserfs_transaction_handle *th,
 					}
 					/* otherwise we clear all bit were set ... */
 					while (--i >= *beg)
-						reiserfs_test_and_clear_le_bit
+						reiserfs_clear_le_bit
 						    (i, bh->b_data);
 					reiserfs_restore_prepared_buffer(s, bh);
 					*beg = org;
diff --git a/fs/reiserfs/resize.c b/fs/reiserfs/resize.c
index b3a94d2..b6b9b1f 100644
--- a/fs/reiserfs/resize.c
+++ b/fs/reiserfs/resize.c
@@ -136,7 +136,7 @@ int reiserfs_resize(struct super_block *s, unsigned long block_count_new)
 				return -EIO;
 			}
 			memset(bh->b_data, 0, sb_blocksize(sb));
-			reiserfs_test_and_set_le_bit(0, bh->b_data);
+			reiserfs_set_le_bit(0, bh->b_data);
 			reiserfs_cache_bitmap_metadata(s, bh, bitmap + i);
 
 			set_buffer_uptodate(bh);
@@ -172,7 +172,7 @@ int reiserfs_resize(struct super_block *s, unsigned long block_count_new)
 
 	reiserfs_prepare_for_journal(s, bh, 1);
 	for (i = block_r; i < s->s_blocksize * 8; i++)
-		reiserfs_test_and_clear_le_bit(i, bh->b_data);
+		reiserfs_clear_le_bit(i, bh->b_data);
 	info->free_count += s->s_blocksize * 8 - block_r;
 
 	journal_mark_dirty(&th, s, bh);
@@ -190,7 +190,7 @@ int reiserfs_resize(struct super_block *s, unsigned long block_count_new)
 
 	reiserfs_prepare_for_journal(s, bh, 1);
 	for (i = block_r_new; i < s->s_blocksize * 8; i++)
-		reiserfs_test_and_set_le_bit(i, bh->b_data);
+		reiserfs_set_le_bit(i, bh->b_data);
 	journal_mark_dirty(&th, s, bh);
 	brelse(bh);
 
diff --git a/include/linux/reiserfs_fs.h b/include/linux/reiserfs_fs.h
index eca75df..96d465f 100644
--- a/include/linux/reiserfs_fs.h
+++ b/include/linux/reiserfs_fs.h
@@ -2332,7 +2332,9 @@ __u32 keyed_hash(const signed char *msg, int len);
 __u32 yura_hash(const signed char *msg, int len);
 __u32 r5_hash(const signed char *msg, int len);
 
+#define reiserfs_set_le_bit		__set_bit_le
 #define reiserfs_test_and_set_le_bit	__test_and_set_bit_le
+#define reiserfs_clear_le_bit		__clear_bit_le
 #define reiserfs_test_and_clear_le_bit	__test_and_clear_bit_le
 #define reiserfs_test_le_bit		test_bit_le
 #define reiserfs_find_next_zero_le_bit	find_next_zero_bit_le
-- 
1.7.4.4


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* [PATCH resend 5/6] reiserfs: use hweight_long()
  2011-06-26  5:57 [PATCH resend 0/6] use little-endian bitops properly Akinobu Mita
  2011-06-26  5:57 ` [PATCH resend 4/6] reiserfs: use proper little-endian bitops Akinobu Mita
@ 2011-06-26  5:57 ` Akinobu Mita
  1 sibling, 0 replies; 3+ messages in thread
From: Akinobu Mita @ 2011-06-26  5:57 UTC (permalink / raw)
  To: linux-kernel, akpm; +Cc: Akinobu Mita, reiserfs-devel

Use hweight_long() to count free bits in the bitmap.

Signed-off-by: Akinobu Mita <akinobu.mita@gmail.com>
Cc: reiserfs-devel@vger.kernel.org
---
 fs/reiserfs/bitmap.c |    6 +-----
 1 files changed, 1 insertions(+), 5 deletions(-)

diff --git a/fs/reiserfs/bitmap.c b/fs/reiserfs/bitmap.c
index 567385a..d1aca1d 100644
--- a/fs/reiserfs/bitmap.c
+++ b/fs/reiserfs/bitmap.c
@@ -1222,15 +1222,11 @@ void reiserfs_cache_bitmap_metadata(struct super_block *sb,
 	info->free_count = 0;
 
 	while (--cur >= (unsigned long *)bh->b_data) {
-		int i;
-
 		/* 0 and ~0 are special, we can optimize for them */
 		if (*cur == 0)
 			info->free_count += BITS_PER_LONG;
 		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++;
+			info->free_count += BITS_PER_LONG - hweight_long(*cur);
 	}
 }
 
-- 
1.7.4.4


^ permalink raw reply related	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2011-06-26  5:57 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-06-26  5:57 [PATCH resend 0/6] use little-endian bitops properly Akinobu Mita
2011-06-26  5:57 ` [PATCH resend 4/6] reiserfs: use proper little-endian bitops Akinobu Mita
2011-06-26  5:57 ` [PATCH resend 5/6] reiserfs: use hweight_long() Akinobu Mita

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).