diff options
author | Akinobu Mita <akinobu.mita@gmail.com> | 2011-12-28 20:32:07 -0500 |
---|---|---|
committer | Theodore Ts'o <tytso@mit.edu> | 2011-12-28 20:32:07 -0500 |
commit | 597d508c17a6dcd17770f4dd9da873d93cc15493 (patch) | |
tree | e977644fd79c2f73bd90b78c08075cb53cc65196 /fs/ext4 | |
parent | ccb4d7af914e0fe9b2f1022f8ea6c300463fd5e6 (diff) |
ext4: use proper little-endian bitops
ext4_{set,clear}_bit() is defined as __test_and_{set,clear}_bit_le() for
ext4. Only two ext4_{set,clear}_bit() calls check the return value. The
rest of calls ignore the return value and they can be replaced with
__{set,clear}_bit_le().
This changes ext4_{set,clear}_bit() from __test_and_{set,clear}_bit_le()
to __{set,clear}_bit_le() and introduces ext4_test_and_{set,clear}_bit()
for the two places where old bit needs to be returned.
This ext4_{set,clear}_bit() change is considered safe, because if someone
uses these macros without noticing the change, new ext4_{set,clear}_bit
don't have return value and causes compiler errors where the return value
is used.
This also removes unused ext4_find_first_zero_bit().
Signed-off-by: Akinobu Mita <akinobu.mita@gmail.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
Diffstat (limited to 'fs/ext4')
-rw-r--r-- | fs/ext4/ext4.h | 7 | ||||
-rw-r--r-- | fs/ext4/ialloc.c | 4 |
2 files changed, 6 insertions, 5 deletions
diff --git a/fs/ext4/ext4.h b/fs/ext4/ext4.h index ae2407f4502..0e43bba049a 100644 --- a/fs/ext4/ext4.h +++ b/fs/ext4/ext4.h | |||
@@ -957,12 +957,13 @@ struct ext4_inode_info { | |||
957 | #define test_opt2(sb, opt) (EXT4_SB(sb)->s_mount_opt2 & \ | 957 | #define test_opt2(sb, opt) (EXT4_SB(sb)->s_mount_opt2 & \ |
958 | EXT4_MOUNT2_##opt) | 958 | EXT4_MOUNT2_##opt) |
959 | 959 | ||
960 | #define ext4_set_bit __test_and_set_bit_le | 960 | #define ext4_test_and_set_bit __test_and_set_bit_le |
961 | #define ext4_set_bit __set_bit_le | ||
961 | #define ext4_set_bit_atomic ext2_set_bit_atomic | 962 | #define ext4_set_bit_atomic ext2_set_bit_atomic |
962 | #define ext4_clear_bit __test_and_clear_bit_le | 963 | #define ext4_test_and_clear_bit __test_and_clear_bit_le |
964 | #define ext4_clear_bit __clear_bit_le | ||
963 | #define ext4_clear_bit_atomic ext2_clear_bit_atomic | 965 | #define ext4_clear_bit_atomic ext2_clear_bit_atomic |
964 | #define ext4_test_bit test_bit_le | 966 | #define ext4_test_bit test_bit_le |
965 | #define ext4_find_first_zero_bit find_first_zero_bit_le | ||
966 | #define ext4_find_next_zero_bit find_next_zero_bit_le | 967 | #define ext4_find_next_zero_bit find_next_zero_bit_le |
967 | #define ext4_find_next_bit find_next_bit_le | 968 | #define ext4_find_next_bit find_next_bit_le |
968 | 969 | ||
diff --git a/fs/ext4/ialloc.c b/fs/ext4/ialloc.c index cdafc05d79c..72fc9892231 100644 --- a/fs/ext4/ialloc.c +++ b/fs/ext4/ialloc.c | |||
@@ -252,7 +252,7 @@ void ext4_free_inode(handle_t *handle, struct inode *inode) | |||
252 | fatal = ext4_journal_get_write_access(handle, bh2); | 252 | fatal = ext4_journal_get_write_access(handle, bh2); |
253 | } | 253 | } |
254 | ext4_lock_group(sb, block_group); | 254 | ext4_lock_group(sb, block_group); |
255 | cleared = ext4_clear_bit(bit, bitmap_bh->b_data); | 255 | cleared = ext4_test_and_clear_bit(bit, bitmap_bh->b_data); |
256 | if (fatal || !cleared) { | 256 | if (fatal || !cleared) { |
257 | ext4_unlock_group(sb, block_group); | 257 | ext4_unlock_group(sb, block_group); |
258 | goto out; | 258 | goto out; |
@@ -618,7 +618,7 @@ static int ext4_claim_inode(struct super_block *sb, | |||
618 | */ | 618 | */ |
619 | down_read(&grp->alloc_sem); | 619 | down_read(&grp->alloc_sem); |
620 | ext4_lock_group(sb, group); | 620 | ext4_lock_group(sb, group); |
621 | if (ext4_set_bit(ino, inode_bitmap_bh->b_data)) { | 621 | if (ext4_test_and_set_bit(ino, inode_bitmap_bh->b_data)) { |
622 | /* not a free inode */ | 622 | /* not a free inode */ |
623 | retval = 1; | 623 | retval = 1; |
624 | goto err_ret; | 624 | goto err_ret; |