diff options
author | Vignesh Babu BM <vignesh.babu@wipro.com> | 2007-05-08 03:24:30 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@woody.linux-foundation.org> | 2007-05-08 14:14:59 -0400 |
commit | e1b5c1d3da05c91129120d045dfcdfc7761f44f1 (patch) | |
tree | 0d29f32fbad55a9cc90b05ef1974103b6afe4ea9 | |
parent | e7d709c096487078652a1384d7a2d0e4459e18b6 (diff) |
is_power_of_2 in fs/hfs
Replace (n & (n-1)) in the context of power of 2 checks with is_power_of_2
Signed-off-by: vignesh babu <vignesh.babu@wipro.com>
Cc: Roman Zippel <zippel@linux-m68k.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
-rw-r--r-- | fs/hfs/btree.c | 3 | ||||
-rw-r--r-- | fs/hfsplus/btree.c | 3 |
2 files changed, 4 insertions, 2 deletions
diff --git a/fs/hfs/btree.c b/fs/hfs/btree.c index 5fd0ed71f923..8a3a650abc87 100644 --- a/fs/hfs/btree.c +++ b/fs/hfs/btree.c | |||
@@ -9,6 +9,7 @@ | |||
9 | */ | 9 | */ |
10 | 10 | ||
11 | #include <linux/pagemap.h> | 11 | #include <linux/pagemap.h> |
12 | #include <linux/log2.h> | ||
12 | 13 | ||
13 | #include "btree.h" | 14 | #include "btree.h" |
14 | 15 | ||
@@ -76,7 +77,7 @@ struct hfs_btree *hfs_btree_open(struct super_block *sb, u32 id, btree_keycmp ke | |||
76 | tree->depth = be16_to_cpu(head->depth); | 77 | tree->depth = be16_to_cpu(head->depth); |
77 | 78 | ||
78 | size = tree->node_size; | 79 | size = tree->node_size; |
79 | if (!size || size & (size - 1)) | 80 | if (!is_power_of_2(size)) |
80 | goto fail_page; | 81 | goto fail_page; |
81 | if (!tree->node_count) | 82 | if (!tree->node_count) |
82 | goto fail_page; | 83 | goto fail_page; |
diff --git a/fs/hfsplus/btree.c b/fs/hfsplus/btree.c index a9b9e872e29a..90ebab753d30 100644 --- a/fs/hfsplus/btree.c +++ b/fs/hfsplus/btree.c | |||
@@ -10,6 +10,7 @@ | |||
10 | 10 | ||
11 | #include <linux/slab.h> | 11 | #include <linux/slab.h> |
12 | #include <linux/pagemap.h> | 12 | #include <linux/pagemap.h> |
13 | #include <linux/log2.h> | ||
13 | 14 | ||
14 | #include "hfsplus_fs.h" | 15 | #include "hfsplus_fs.h" |
15 | #include "hfsplus_raw.h" | 16 | #include "hfsplus_raw.h" |
@@ -69,7 +70,7 @@ struct hfs_btree *hfs_btree_open(struct super_block *sb, u32 id) | |||
69 | } | 70 | } |
70 | 71 | ||
71 | size = tree->node_size; | 72 | size = tree->node_size; |
72 | if (!size || size & (size - 1)) | 73 | if (!is_power_of_2(size)) |
73 | goto fail_page; | 74 | goto fail_page; |
74 | if (!tree->node_count) | 75 | if (!tree->node_count) |
75 | goto fail_page; | 76 | goto fail_page; |