提交 1ca1a111 编写于 作者: M Mark Fasheh

ocfs2: fix sparse warnings in fs/ocfs2

None of these are actually harmful, but the noise makes looking for real
problems difficult.
Signed-off-by: NMark Fasheh <mark.fasheh@oracle.com>
上级 6e4b0d56
...@@ -2869,7 +2869,7 @@ int ocfs2_complete_truncate_log_recovery(struct ocfs2_super *osb, ...@@ -2869,7 +2869,7 @@ int ocfs2_complete_truncate_log_recovery(struct ocfs2_super *osb,
tl = &tl_copy->id2.i_dealloc; tl = &tl_copy->id2.i_dealloc;
num_recs = le16_to_cpu(tl->tl_used); num_recs = le16_to_cpu(tl->tl_used);
mlog(0, "cleanup %u records from %llu\n", num_recs, mlog(0, "cleanup %u records from %llu\n", num_recs,
(unsigned long long)tl_copy->i_blkno); (unsigned long long)le64_to_cpu(tl_copy->i_blkno));
mutex_lock(&tl_inode->i_mutex); mutex_lock(&tl_inode->i_mutex);
for(i = 0; i < num_recs; i++) { for(i = 0; i < num_recs; i++) {
...@@ -3801,8 +3801,8 @@ int ocfs2_prepare_truncate(struct ocfs2_super *osb, ...@@ -3801,8 +3801,8 @@ int ocfs2_prepare_truncate(struct ocfs2_super *osb,
fe = (struct ocfs2_dinode *) fe_bh->b_data; fe = (struct ocfs2_dinode *) fe_bh->b_data;
mlog(0, "fe->i_clusters = %u, new_i_clusters = %u, fe->i_size =" mlog(0, "fe->i_clusters = %u, new_i_clusters = %u, fe->i_size ="
"%llu\n", fe->i_clusters, new_i_clusters, "%llu\n", le32_to_cpu(fe->i_clusters), new_i_clusters,
(unsigned long long)fe->i_size); (unsigned long long)le64_to_cpu(fe->i_size));
*tc = kzalloc(sizeof(struct ocfs2_truncate_context), GFP_KERNEL); *tc = kzalloc(sizeof(struct ocfs2_truncate_context), GFP_KERNEL);
if (!(*tc)) { if (!(*tc)) {
......
...@@ -78,7 +78,8 @@ static int ocfs2_symlink_get_block(struct inode *inode, sector_t iblock, ...@@ -78,7 +78,8 @@ static int ocfs2_symlink_get_block(struct inode *inode, sector_t iblock,
if (!OCFS2_IS_VALID_DINODE(fe)) { if (!OCFS2_IS_VALID_DINODE(fe)) {
mlog(ML_ERROR, "Invalid dinode #%llu: signature = %.*s\n", mlog(ML_ERROR, "Invalid dinode #%llu: signature = %.*s\n",
(unsigned long long)fe->i_blkno, 7, fe->i_signature); (unsigned long long)le64_to_cpu(fe->i_blkno), 7,
fe->i_signature);
goto bail; goto bail;
} }
......
...@@ -140,7 +140,7 @@ static struct dentry *ocfs2_get_parent(struct dentry *child) ...@@ -140,7 +140,7 @@ static struct dentry *ocfs2_get_parent(struct dentry *child)
return parent; return parent;
} }
static int ocfs2_encode_fh(struct dentry *dentry, __be32 *fh, int *max_len, static int ocfs2_encode_fh(struct dentry *dentry, u32 *fh_in, int *max_len,
int connectable) int connectable)
{ {
struct inode *inode = dentry->d_inode; struct inode *inode = dentry->d_inode;
...@@ -148,6 +148,7 @@ static int ocfs2_encode_fh(struct dentry *dentry, __be32 *fh, int *max_len, ...@@ -148,6 +148,7 @@ static int ocfs2_encode_fh(struct dentry *dentry, __be32 *fh, int *max_len,
int type = 1; int type = 1;
u64 blkno; u64 blkno;
u32 generation; u32 generation;
__le32 *fh = (__force __le32 *) fh_in;
mlog_entry("(0x%p, '%.*s', 0x%p, %d, %d)\n", dentry, mlog_entry("(0x%p, '%.*s', 0x%p, %d, %d)\n", dentry,
dentry->d_name.len, dentry->d_name.name, dentry->d_name.len, dentry->d_name.name,
...@@ -199,7 +200,7 @@ static int ocfs2_encode_fh(struct dentry *dentry, __be32 *fh, int *max_len, ...@@ -199,7 +200,7 @@ static int ocfs2_encode_fh(struct dentry *dentry, __be32 *fh, int *max_len,
return type; return type;
} }
static struct dentry *ocfs2_decode_fh(struct super_block *sb, __be32 *fh, static struct dentry *ocfs2_decode_fh(struct super_block *sb, u32 *fh_in,
int fh_len, int fileid_type, int fh_len, int fileid_type,
int (*acceptable)(void *context, int (*acceptable)(void *context,
struct dentry *de), struct dentry *de),
...@@ -207,6 +208,7 @@ static struct dentry *ocfs2_decode_fh(struct super_block *sb, __be32 *fh, ...@@ -207,6 +208,7 @@ static struct dentry *ocfs2_decode_fh(struct super_block *sb, __be32 *fh,
{ {
struct ocfs2_inode_handle handle, parent; struct ocfs2_inode_handle handle, parent;
struct dentry *ret = NULL; struct dentry *ret = NULL;
__le32 *fh = (__force __le32 *) fh_in;
mlog_entry("(0x%p, 0x%p, %d, %d, 0x%p, 0x%p)\n", mlog_entry("(0x%p, 0x%p, %d, %d, 0x%p, 0x%p)\n",
sb, fh, fh_len, fileid_type, acceptable, context); sb, fh, fh_len, fileid_type, acceptable, context);
......
...@@ -713,7 +713,8 @@ static int ocfs2_extend_allocation(struct inode *inode, ...@@ -713,7 +713,8 @@ static int ocfs2_extend_allocation(struct inode *inode,
} }
mlog(0, "fe: i_clusters = %u, i_size=%llu\n", mlog(0, "fe: i_clusters = %u, i_size=%llu\n",
fe->i_clusters, (unsigned long long)fe->i_size); le32_to_cpu(fe->i_clusters),
(unsigned long long)le64_to_cpu(fe->i_size));
mlog(0, "inode: ip_clusters=%u, i_size=%lld\n", mlog(0, "inode: ip_clusters=%u, i_size=%lld\n",
OCFS2_I(inode)->ip_clusters, i_size_read(inode)); OCFS2_I(inode)->ip_clusters, i_size_read(inode));
......
...@@ -215,7 +215,7 @@ int ocfs2_populate_inode(struct inode *inode, struct ocfs2_dinode *fe, ...@@ -215,7 +215,7 @@ int ocfs2_populate_inode(struct inode *inode, struct ocfs2_dinode *fe,
int status = -EINVAL; int status = -EINVAL;
mlog_entry("(0x%p, size:%llu)\n", inode, mlog_entry("(0x%p, size:%llu)\n", inode,
(unsigned long long)fe->i_size); (unsigned long long)le64_to_cpu(fe->i_size));
sb = inode->i_sb; sb = inode->i_sb;
osb = OCFS2_SB(sb); osb = OCFS2_SB(sb);
...@@ -267,7 +267,7 @@ int ocfs2_populate_inode(struct inode *inode, struct ocfs2_dinode *fe, ...@@ -267,7 +267,7 @@ int ocfs2_populate_inode(struct inode *inode, struct ocfs2_dinode *fe,
mlog(ML_ERROR, mlog(ML_ERROR,
"ip_blkno %llu != i_blkno %llu!\n", "ip_blkno %llu != i_blkno %llu!\n",
(unsigned long long)OCFS2_I(inode)->ip_blkno, (unsigned long long)OCFS2_I(inode)->ip_blkno,
(unsigned long long)fe->i_blkno); (unsigned long long)le64_to_cpu(fe->i_blkno));
inode->i_nlink = le16_to_cpu(fe->i_links_count); inode->i_nlink = le16_to_cpu(fe->i_links_count);
...@@ -320,7 +320,7 @@ int ocfs2_populate_inode(struct inode *inode, struct ocfs2_dinode *fe, ...@@ -320,7 +320,7 @@ int ocfs2_populate_inode(struct inode *inode, struct ocfs2_dinode *fe,
* the generation argument to * the generation argument to
* ocfs2_inode_lock_res_init() will have to change. * ocfs2_inode_lock_res_init() will have to change.
*/ */
BUG_ON(fe->i_flags & cpu_to_le32(OCFS2_SYSTEM_FL)); BUG_ON(le32_to_cpu(fe->i_flags) & OCFS2_SYSTEM_FL);
ocfs2_inode_lock_res_init(&OCFS2_I(inode)->ip_meta_lockres, ocfs2_inode_lock_res_init(&OCFS2_I(inode)->ip_meta_lockres,
OCFS2_LOCK_TYPE_META, 0, inode); OCFS2_LOCK_TYPE_META, 0, inode);
...@@ -456,7 +456,8 @@ static int ocfs2_read_locked_inode(struct inode *inode, ...@@ -456,7 +456,8 @@ static int ocfs2_read_locked_inode(struct inode *inode,
fe = (struct ocfs2_dinode *) bh->b_data; fe = (struct ocfs2_dinode *) bh->b_data;
if (!OCFS2_IS_VALID_DINODE(fe)) { if (!OCFS2_IS_VALID_DINODE(fe)) {
mlog(ML_ERROR, "Invalid dinode #%llu: signature = %.*s\n", mlog(ML_ERROR, "Invalid dinode #%llu: signature = %.*s\n",
(unsigned long long)fe->i_blkno, 7, fe->i_signature); (unsigned long long)le64_to_cpu(fe->i_blkno), 7,
fe->i_signature);
goto bail; goto bail;
} }
...@@ -831,8 +832,8 @@ static int ocfs2_query_inode_wipe(struct inode *inode, ...@@ -831,8 +832,8 @@ static int ocfs2_query_inode_wipe(struct inode *inode,
"Inode %llu (on-disk %llu) not orphaned! " "Inode %llu (on-disk %llu) not orphaned! "
"Disk flags 0x%x, inode flags 0x%x\n", "Disk flags 0x%x, inode flags 0x%x\n",
(unsigned long long)oi->ip_blkno, (unsigned long long)oi->ip_blkno,
(unsigned long long)di->i_blkno, di->i_flags, (unsigned long long)le64_to_cpu(di->i_blkno),
oi->ip_flags); le32_to_cpu(di->i_flags), oi->ip_flags);
goto bail; goto bail;
} }
......
...@@ -435,7 +435,8 @@ static int ocfs2_journal_toggle_dirty(struct ocfs2_super *osb, ...@@ -435,7 +435,8 @@ static int ocfs2_journal_toggle_dirty(struct ocfs2_super *osb,
* handle the errors in a specific manner, so no need * handle the errors in a specific manner, so no need
* to call ocfs2_error() here. */ * to call ocfs2_error() here. */
mlog(ML_ERROR, "Journal dinode %llu has invalid " mlog(ML_ERROR, "Journal dinode %llu has invalid "
"signature: %.*s", (unsigned long long)fe->i_blkno, 7, "signature: %.*s",
(unsigned long long)le64_to_cpu(fe->i_blkno), 7,
fe->i_signature); fe->i_signature);
status = -EIO; status = -EIO;
goto out; goto out;
...@@ -742,7 +743,7 @@ void ocfs2_complete_recovery(struct work_struct *work) ...@@ -742,7 +743,7 @@ void ocfs2_complete_recovery(struct work_struct *work)
la_dinode = item->lri_la_dinode; la_dinode = item->lri_la_dinode;
if (la_dinode) { if (la_dinode) {
mlog(0, "Clean up local alloc %llu\n", mlog(0, "Clean up local alloc %llu\n",
(unsigned long long)la_dinode->i_blkno); (unsigned long long)le64_to_cpu(la_dinode->i_blkno));
ret = ocfs2_complete_local_alloc_recovery(osb, ret = ocfs2_complete_local_alloc_recovery(osb,
la_dinode); la_dinode);
...@@ -755,7 +756,7 @@ void ocfs2_complete_recovery(struct work_struct *work) ...@@ -755,7 +756,7 @@ void ocfs2_complete_recovery(struct work_struct *work)
tl_dinode = item->lri_tl_dinode; tl_dinode = item->lri_tl_dinode;
if (tl_dinode) { if (tl_dinode) {
mlog(0, "Clean up truncate log %llu\n", mlog(0, "Clean up truncate log %llu\n",
(unsigned long long)tl_dinode->i_blkno); (unsigned long long)le64_to_cpu(tl_dinode->i_blkno));
ret = ocfs2_complete_truncate_log_recovery(osb, ret = ocfs2_complete_truncate_log_recovery(osb,
tl_dinode); tl_dinode);
......
...@@ -578,8 +578,9 @@ static int ocfs2_mknod_locked(struct ocfs2_super *osb, ...@@ -578,8 +578,9 @@ static int ocfs2_mknod_locked(struct ocfs2_super *osb,
if (ocfs2_populate_inode(inode, fe, 1) < 0) { if (ocfs2_populate_inode(inode, fe, 1) < 0) {
mlog(ML_ERROR, "populate inode failed! bh->b_blocknr=%llu, " mlog(ML_ERROR, "populate inode failed! bh->b_blocknr=%llu, "
"i_blkno=%llu, i_ino=%lu\n", "i_blkno=%llu, i_ino=%lu\n",
(unsigned long long) (*new_fe_bh)->b_blocknr, (unsigned long long)(*new_fe_bh)->b_blocknr,
(unsigned long long)fe->i_blkno, inode->i_ino); (unsigned long long)le64_to_cpu(fe->i_blkno),
inode->i_ino);
BUG(); BUG();
} }
......
...@@ -363,9 +363,9 @@ static inline int ocfs2_mount_local(struct ocfs2_super *osb) ...@@ -363,9 +363,9 @@ static inline int ocfs2_mount_local(struct ocfs2_super *osb)
typeof(__di) ____di = (__di); \ typeof(__di) ____di = (__di); \
ocfs2_error((__sb), \ ocfs2_error((__sb), \
"Dinode # %llu has bad signature %.*s", \ "Dinode # %llu has bad signature %.*s", \
(unsigned long long)(____di)->i_blkno, 7, \ (unsigned long long)le64_to_cpu((____di)->i_blkno), 7, \
(____di)->i_signature); \ (____di)->i_signature); \
} while (0); } while (0)
#define OCFS2_IS_VALID_EXTENT_BLOCK(ptr) \ #define OCFS2_IS_VALID_EXTENT_BLOCK(ptr) \
(!strcmp((ptr)->h_signature, OCFS2_EXTENT_BLOCK_SIGNATURE)) (!strcmp((ptr)->h_signature, OCFS2_EXTENT_BLOCK_SIGNATURE))
...@@ -374,9 +374,9 @@ static inline int ocfs2_mount_local(struct ocfs2_super *osb) ...@@ -374,9 +374,9 @@ static inline int ocfs2_mount_local(struct ocfs2_super *osb)
typeof(__eb) ____eb = (__eb); \ typeof(__eb) ____eb = (__eb); \
ocfs2_error((__sb), \ ocfs2_error((__sb), \
"Extent Block # %llu has bad signature %.*s", \ "Extent Block # %llu has bad signature %.*s", \
(unsigned long long)(____eb)->h_blkno, 7, \ (unsigned long long)le64_to_cpu((____eb)->h_blkno), 7, \
(____eb)->h_signature); \ (____eb)->h_signature); \
} while (0); } while (0)
#define OCFS2_IS_VALID_GROUP_DESC(ptr) \ #define OCFS2_IS_VALID_GROUP_DESC(ptr) \
(!strcmp((ptr)->bg_signature, OCFS2_GROUP_DESC_SIGNATURE)) (!strcmp((ptr)->bg_signature, OCFS2_GROUP_DESC_SIGNATURE))
...@@ -385,9 +385,9 @@ static inline int ocfs2_mount_local(struct ocfs2_super *osb) ...@@ -385,9 +385,9 @@ static inline int ocfs2_mount_local(struct ocfs2_super *osb)
typeof(__gd) ____gd = (__gd); \ typeof(__gd) ____gd = (__gd); \
ocfs2_error((__sb), \ ocfs2_error((__sb), \
"Group Descriptor # %llu has bad signature %.*s", \ "Group Descriptor # %llu has bad signature %.*s", \
(unsigned long long)(____gd)->bg_blkno, 7, \ (unsigned long long)le64_to_cpu((____gd)->bg_blkno), 7, \
(____gd)->bg_signature); \ (____gd)->bg_signature); \
} while (0); } while (0)
static inline unsigned long ino_from_blkno(struct super_block *sb, static inline unsigned long ino_from_blkno(struct super_block *sb,
u64 blkno) u64 blkno)
......
...@@ -849,9 +849,9 @@ static int ocfs2_relink_block_group(handle_t *handle, ...@@ -849,9 +849,9 @@ static int ocfs2_relink_block_group(handle_t *handle,
} }
mlog(0, "Suballoc %llu, chain %u, move group %llu to top, prev = %llu\n", mlog(0, "Suballoc %llu, chain %u, move group %llu to top, prev = %llu\n",
(unsigned long long)fe->i_blkno, chain, (unsigned long long)le64_to_cpu(fe->i_blkno), chain,
(unsigned long long)bg->bg_blkno, (unsigned long long)le64_to_cpu(bg->bg_blkno),
(unsigned long long)prev_bg->bg_blkno); (unsigned long long)le64_to_cpu(prev_bg->bg_blkno));
fe_ptr = le64_to_cpu(fe->id2.i_chain.cl_recs[chain].c_blkno); fe_ptr = le64_to_cpu(fe->id2.i_chain.cl_recs[chain].c_blkno);
bg_ptr = le64_to_cpu(bg->bg_next_group); bg_ptr = le64_to_cpu(bg->bg_next_group);
...@@ -1162,7 +1162,7 @@ static int ocfs2_search_chain(struct ocfs2_alloc_context *ac, ...@@ -1162,7 +1162,7 @@ static int ocfs2_search_chain(struct ocfs2_alloc_context *ac,
} }
mlog(0, "alloc succeeds: we give %u bits from block group %llu\n", mlog(0, "alloc succeeds: we give %u bits from block group %llu\n",
tmp_bits, (unsigned long long)bg->bg_blkno); tmp_bits, (unsigned long long)le64_to_cpu(bg->bg_blkno));
*num_bits = tmp_bits; *num_bits = tmp_bits;
...@@ -1227,7 +1227,7 @@ static int ocfs2_search_chain(struct ocfs2_alloc_context *ac, ...@@ -1227,7 +1227,7 @@ static int ocfs2_search_chain(struct ocfs2_alloc_context *ac,
} }
mlog(0, "Allocated %u bits from suballocator %llu\n", *num_bits, mlog(0, "Allocated %u bits from suballocator %llu\n", *num_bits,
(unsigned long long)fe->i_blkno); (unsigned long long)le64_to_cpu(fe->i_blkno));
*bg_blkno = le64_to_cpu(bg->bg_blkno); *bg_blkno = le64_to_cpu(bg->bg_blkno);
*bits_left = le16_to_cpu(bg->bg_free_bits_count); *bits_left = le16_to_cpu(bg->bg_free_bits_count);
......
...@@ -1538,7 +1538,7 @@ static int ocfs2_verify_volume(struct ocfs2_dinode *di, ...@@ -1538,7 +1538,7 @@ static int ocfs2_verify_volume(struct ocfs2_dinode *di,
} else if (bh->b_blocknr != le64_to_cpu(di->i_blkno)) { } else if (bh->b_blocknr != le64_to_cpu(di->i_blkno)) {
mlog(ML_ERROR, "bad block number on superblock: " mlog(ML_ERROR, "bad block number on superblock: "
"found %llu, should be %llu\n", "found %llu, should be %llu\n",
(unsigned long long)di->i_blkno, (unsigned long long)le64_to_cpu(di->i_blkno),
(unsigned long long)bh->b_blocknr); (unsigned long long)bh->b_blocknr);
} else if (le32_to_cpu(di->id2.i_super.s_clustersize_bits) < 12 || } else if (le32_to_cpu(di->id2.i_super.s_clustersize_bits) < 12 ||
le32_to_cpu(di->id2.i_super.s_clustersize_bits) > 20) { le32_to_cpu(di->id2.i_super.s_clustersize_bits) > 20) {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册