[PATCH 07/14] PMFS: Fix sparse endianness warnings, part 1
Matthew Wilcox
matthew.r.wilcox at intel.com
Mon Oct 7 09:37:05 EDT 2013
From: Matthew Wilcox <willy at linux.intel.com>
These are the boring fixes which just involve using the right type.
Signed-off-by: Matthew Wilcox <matthew.r.wilcox at intel.com>
---
fs/pmfs/bbuild.c | 10 ++++------
fs/pmfs/inode.c | 28 ++++++++++++++--------------
fs/pmfs/pmfs.h | 15 ++++++++-------
3 files changed, 26 insertions(+), 27 deletions(-)
diff --git a/fs/pmfs/bbuild.c b/fs/pmfs/bbuild.c
index 6be800e..c57d7ea 100644
--- a/fs/pmfs/bbuild.c
+++ b/fs/pmfs/bbuild.c
@@ -89,14 +89,12 @@ static bool pmfs_can_skip_full_scan(struct super_block *sb)
struct pmfs_inode *pi = pmfs_get_inode(sb, PMFS_BLOCKNODE_IN0);
struct pmfs_super_block *super = pmfs_get_super(sb);
struct pmfs_sb_info *sbi = PMFS_SB(sb);
- u64 root;
+ __le64 root;
unsigned int height, btype;
unsigned long last_blocknr;
if (!pi->root)
- {
- return false;
- }
+ return false;
sbi->num_blocknode_allocated =
le64_to_cpu(super->s_num_blocknode_allocated);
@@ -119,7 +117,7 @@ static bool pmfs_can_skip_full_scan(struct super_block *sb)
pmfs_clear_datablock_inode(sb);
pmfs_free_inode_subtree(sb, root, height, btype, last_blocknr);
-
+
return true;
}
@@ -274,7 +272,7 @@ static void pmfs_inode_table_crawl_recursive(struct super_block *sb,
struct scan_bitmap *bm, unsigned long block,
u32 height, u32 btype)
{
- u64 *node;
+ __le64 *node;
unsigned int i;
struct pmfs_inode *pi;
struct pmfs_sb_info *sbi = PMFS_SB(sb);
diff --git a/fs/pmfs/inode.c b/fs/pmfs/inode.c
index 0e20089..e9f4292 100644
--- a/fs/pmfs/inode.c
+++ b/fs/pmfs/inode.c
@@ -96,12 +96,12 @@ u64 pmfs_find_data_block(struct inode *inode, unsigned long file_blocknr)
* @hole_found: indicates whether a hole was found
* hole: whether we are looking for a hole or data
*/
-static int recursive_find_region(struct super_block *sb, unsigned long block,
+static int recursive_find_region(struct super_block *sb, __le64 block,
u32 height, unsigned long first_blocknr, unsigned long last_blocknr,
int *data_found, int *hole_found, int hole)
{
unsigned int meta_bits = META_BLK_SHIFT;
- u64 *node;
+ __le64 *node;
unsigned long first_blk, last_blk, node_bits, blocks = 0;
unsigned int first_index, last_index, i;
@@ -220,7 +220,7 @@ out:
* required to determine if a meta-data block contains no pointers and hence
* can be freed.
*/
-static inline bool is_empty_meta_block(u64 *node, unsigned int start_idx,
+static inline bool is_empty_meta_block(__le64 *node, unsigned int start_idx,
unsigned int end_idx)
{
int i, last_idx = (1 << META_BLK_SHIFT) - 1;
@@ -242,13 +242,13 @@ static inline bool is_empty_meta_block(u64 *node, unsigned int start_idx,
* last_blocknr: last_blocknr in the specified range
* end: last byte offset of the range
*/
-static int recursive_truncate_blocks(struct super_block *sb, u64 block,
+static int recursive_truncate_blocks(struct super_block *sb, __le64 block,
u32 height, u32 btype, unsigned long first_blocknr,
unsigned long last_blocknr, bool *meta_empty)
{
unsigned long blocknr, first_blk, last_blk;
unsigned int node_bits, first_index, last_index, i;
- u64 *node;
+ __le64 *node;
unsigned int freed = 0, bzero;
int start, end;
bool mpty, all_range_freed = true;
@@ -319,7 +319,7 @@ static int recursive_truncate_blocks(struct super_block *sb, u64 block,
}
unsigned int pmfs_free_inode_subtree(struct super_block *sb,
- u64 root, u32 height, u32 btype, unsigned long last_blocknr)
+ __le64 root, u32 height, u32 btype, unsigned long last_blocknr)
{
unsigned long first_blocknr;
unsigned int freed;
@@ -347,11 +347,11 @@ unsigned int pmfs_free_inode_subtree(struct super_block *sb,
}
static void pmfs_decrease_btree_height(struct super_block *sb,
- struct pmfs_inode *pi, unsigned long newsize, u64 newroot)
+ struct pmfs_inode *pi, unsigned long newsize, __le64 newroot)
{
unsigned int height = pi->height, new_height = 0;
unsigned long blocknr, last_blocknr;
- u64 *root;
+ __le64 *root;
char b[8];
if (pi->i_blocks == 0 || newsize == 0) {
@@ -442,7 +442,7 @@ static void __pmfs_truncate_blocks(struct inode *inode, loff_t start,
struct super_block *sb = inode->i_sb;
struct pmfs_inode *pi = pmfs_get_inode(sb, inode->i_ino);
unsigned long first_blocknr, last_blocknr;
- u64 root;
+ __le64 root;
unsigned int freed = 0;
unsigned int data_bits = blk_type_to_shift[pi->i_blk_type];
unsigned int meta_bits = META_BLK_SHIFT;
@@ -522,7 +522,7 @@ static int pmfs_increase_btree_height(struct super_block *sb,
struct pmfs_inode *pi, u32 new_height)
{
u32 height = pi->height;
- u64 *root, prev_root = pi->root;
+ __le64 *root, prev_root = pi->root;
unsigned long blocknr;
int errval = 0;
@@ -560,13 +560,13 @@ static int pmfs_increase_btree_height(struct super_block *sb,
* zero: whether to zero-out the allocated block(s)
*/
static int recursive_alloc_blocks(pmfs_transaction_t *trans,
- struct super_block *sb, struct pmfs_inode *pi, u64 block, u32 height,
+ struct super_block *sb, struct pmfs_inode *pi, __le64 block, u32 height,
unsigned long first_blocknr, unsigned long last_blocknr, bool new_node,
bool zero)
{
int i, errval;
unsigned int meta_bits = META_BLK_SHIFT, node_bits;
- u64 *node;
+ __le64 *node;
bool journal_saved = 0;
unsigned long blocknr, first_blk, last_blk;
unsigned int first_index, last_index;
@@ -698,7 +698,7 @@ int __pmfs_alloc_blocks(pmfs_transaction_t *trans, struct super_block *sb,
if (!pi->root) {
if (height == 0) {
- u64 root;
+ __le64 root;
errval = pmfs_new_data_block(sb, pi, &blocknr, zero);
if (errval) {
pmfs_dbg_verbose("[%s:%d] failed: alloc data"
@@ -1005,7 +1005,7 @@ void pmfs_evict_inode(struct inode *inode)
{
struct super_block *sb = inode->i_sb;
struct pmfs_inode *pi = pmfs_get_inode(sb, inode->i_ino);
- u64 root;
+ __le64 root;
unsigned long last_blocknr;
unsigned int height, btype;
int err = 0;
diff --git a/fs/pmfs/pmfs.h b/fs/pmfs/pmfs.h
index 0031be8..8c7fdd9 100644
--- a/fs/pmfs/pmfs.h
+++ b/fs/pmfs/pmfs.h
@@ -134,7 +134,7 @@ extern struct dentry *pmfs_get_parent(struct dentry *child);
/* inode.c */
extern unsigned int pmfs_free_inode_subtree(struct super_block *sb,
- u64 root, u32 height, u32 btype, unsigned long last_blocknr);
+ __le64 root, u32 height, u32 btype, unsigned long last_blocknr);
extern int __pmfs_alloc_blocks(pmfs_transaction_t *trans,
struct super_block *sb, struct pmfs_inode *pi,
unsigned long file_blocknr, unsigned int num, bool zero);
@@ -239,8 +239,8 @@ static inline int pmfs_calc_checksum(u8 *data, int n)
}
struct pmfs_blocknode_lowhigh {
- unsigned long block_low;
- unsigned long block_high;
+ __le64 block_low;
+ __le64 block_high;
};
struct pmfs_blocknode {
@@ -374,19 +374,19 @@ static inline void pmfs_memcpy_atomic (void *dst, const void *src, u8 size)
break;
}
case 2: {
- volatile u16 *daddr = dst;
+ volatile __le16 *daddr = dst;
const u16 *saddr = src;
*daddr = cpu_to_le16(*saddr);
break;
}
case 4: {
- volatile u32 *daddr = dst;
+ volatile __le32 *daddr = dst;
const u32 *saddr = src;
*daddr = cpu_to_le32(*saddr);
break;
}
case 8: {
- volatile u64 *daddr = dst;
+ volatile __le64 *daddr = dst;
const u64 *saddr = src;
*daddr = cpu_to_le64(*saddr);
break;
@@ -451,7 +451,8 @@ static inline void memset_nt(void *dest, uint32_t dword, size_t length)
static inline u64 __pmfs_find_data_block(struct super_block *sb,
struct pmfs_inode *pi, unsigned long blocknr)
{
- u64 *level_ptr, bp = 0;
+ __le64 *level_ptr;
+ u64 bp = 0;
u32 height, bit_shift;
unsigned int idx;
--
1.8.4.rc3
More information about the Linux-pmfs
mailing list