Browse Source

ntfs: use is_power_of_2() function for clarity.

Signed-off-by: Robert P. J. Day <rpjday@crashcourse.ca>
Cc: Anton Altaparmakov <aia21@cantab.net>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Robert P. J. Day 16 years ago
parent
commit
02d5341ae5
2 changed files with 4 additions and 2 deletions
  1. 2 1
      fs/ntfs/inode.c
  2. 2 1
      fs/ntfs/logfile.c

+ 2 - 1
fs/ntfs/inode.c

@@ -27,6 +27,7 @@
 #include <linux/pagemap.h>
 #include <linux/pagemap.h>
 #include <linux/quotaops.h>
 #include <linux/quotaops.h>
 #include <linux/slab.h>
 #include <linux/slab.h>
+#include <linux/log2.h>
 
 
 #include "aops.h"
 #include "aops.h"
 #include "attrib.h"
 #include "attrib.h"
@@ -1570,7 +1571,7 @@ static int ntfs_read_locked_index_inode(struct inode *base_vi, struct inode *vi)
 	ntfs_debug("Index collation rule is 0x%x.",
 	ntfs_debug("Index collation rule is 0x%x.",
 			le32_to_cpu(ir->collation_rule));
 			le32_to_cpu(ir->collation_rule));
 	ni->itype.index.block_size = le32_to_cpu(ir->index_block_size);
 	ni->itype.index.block_size = le32_to_cpu(ir->index_block_size);
-	if (ni->itype.index.block_size & (ni->itype.index.block_size - 1)) {
+	if (!is_power_of_2(ni->itype.index.block_size)) {
 		ntfs_error(vi->i_sb, "Index block size (%u) is not a power of "
 		ntfs_error(vi->i_sb, "Index block size (%u) is not a power of "
 				"two.", ni->itype.index.block_size);
 				"two.", ni->itype.index.block_size);
 		goto unm_err_out;
 		goto unm_err_out;

+ 2 - 1
fs/ntfs/logfile.c

@@ -26,6 +26,7 @@
 #include <linux/highmem.h>
 #include <linux/highmem.h>
 #include <linux/buffer_head.h>
 #include <linux/buffer_head.h>
 #include <linux/bitops.h>
 #include <linux/bitops.h>
+#include <linux/log2.h>
 
 
 #include "attrib.h"
 #include "attrib.h"
 #include "aops.h"
 #include "aops.h"
@@ -65,7 +66,7 @@ static bool ntfs_check_restart_page_header(struct inode *vi,
 			logfile_log_page_size < NTFS_BLOCK_SIZE ||
 			logfile_log_page_size < NTFS_BLOCK_SIZE ||
 			logfile_system_page_size &
 			logfile_system_page_size &
 			(logfile_system_page_size - 1) ||
 			(logfile_system_page_size - 1) ||
-			logfile_log_page_size & (logfile_log_page_size - 1)) {
+			!is_power_of_2(logfile_log_page_size)) {
 		ntfs_error(vi->i_sb, "$LogFile uses unsupported page size.");
 		ntfs_error(vi->i_sb, "$LogFile uses unsupported page size.");
 		return false;
 		return false;
 	}
 	}