[PATCH 08/14] PMFS: Fix endian warnings in pmfs_inode_crawl_recursive()

Matthew Wilcox matthew.r.wilcox at intel.com
Mon Oct 7 09:37:12 EDT 2013


From: Matthew Wilcox <willy at linux.intel.com>

Fix the type of 'btype' to be the u8 it actually is on media, and compare
it against the native PMFS_BLOCK_TYPE_* value, instead of byteswapping it
(which would be silly since it's a single byte).  This probably fixes
a bug on big-endian machines.

Signed-off-by: Matthew Wilcox <matthew.r.wilcox at intel.com>
---
 fs/pmfs/bbuild.c | 9 ++++-----
 1 file changed, 4 insertions(+), 5 deletions(-)

diff --git a/fs/pmfs/bbuild.c b/fs/pmfs/bbuild.c
index c57d7ea..c77bd9b 100644
--- a/fs/pmfs/bbuild.c
+++ b/fs/pmfs/bbuild.c
@@ -231,20 +231,19 @@ void pmfs_save_blocknode_mappings(struct super_block *sb)
 
 static void pmfs_inode_crawl_recursive(struct super_block *sb,
 				struct scan_bitmap *bm, unsigned long block,
-				u32 height, u32 btype)
+				u32 height, u8 btype)
 {
-	u64 *node;
+	__le64 *node;
 	unsigned int i;
 
 	if (height == 0) {
 		/* This is the data block */
-		if (btype == cpu_to_le16(PMFS_BLOCK_TYPE_4K)) {
+		if (btype == PMFS_BLOCK_TYPE_4K) {
 			set_bit(block >> PAGE_SHIFT, bm->bitmap_4k);
-		} else if (btype == cpu_to_le16(PMFS_BLOCK_TYPE_2M)) {
+		} else if (btype == PMFS_BLOCK_TYPE_2M) {
 			set_bit(block >> PAGE_SHIFT_2M, bm->bitmap_2M);
 		} else {
 			set_bit(block >> PAGE_SHIFT_1G, bm->bitmap_1G);
-			
 		}
 		return;
 	}
-- 
1.8.4.rc3




More information about the Linux-pmfs mailing list