Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

ocfs2: fix sparse warnings

1.
fs/ocfs2/localalloc.c:1224:41: warning: incorrect type in argument 1 (different base types)
fs/ocfs2/localalloc.c:1224:41: expected unsigned long long val1
fs/ocfs2/localalloc.c:1224:41: got restricted __le32 [usertype] la_bm_off

2.
fs/ocfs2/export.c:258:32: warning: cast to restricted __le32
fs/ocfs2/export.c:259:33: warning: cast to restricted __le32
fs/ocfs2/export.c:260:32: warning: cast to restricted __le32
fs/ocfs2/export.c:272:32: warning: cast to restricted __le32
fs/ocfs2/export.c:273:33: warning: cast to restricted __le32
fs/ocfs2/export.c:274:32: warning: cast to restricted __le32

3.
fs/ocfs2/inode.c:1623:13: warning: context imbalance in 'ocfs2_inode_cache_lock' - wrong count at exit
fs/ocfs2/inode.c:1630:13: warning: context imbalance in 'ocfs2_inode_cache_unlock' - unexpected unlock

4.
fs/ocfs2/refcounttree.c:633:27: warning: incorrect type in assignment (different base types)
fs/ocfs2/refcounttree.c:633:27: expected restricted __le32 [usertype] rf_generation
fs/ocfs2/refcounttree.c:633:27: got unsigned int

5.
fs/ocfs2/dlm/dlmdomain.c:1316:20: warning: context imbalance in 'dlm_query_nodeinfo_handler' - different lock contexts for basic block

Link: https://lkml.kernel.org/r/20240328125203.20892-5-heming.zhao@suse.com
Signed-off-by: Heming Zhao <heming.zhao@suse.com>
Reviewed-by: Joseph Qi <joseph.qi@linux.alibaba.com>
Cc: Changwei Ge <gechangwei@live.cn>
Cc: Gang He <ghe@suse.com>
Cc: Joel Becker <jlbec@evilplan.org>
Cc: Jun Piao <piaojun@huawei.com>
Cc: Junxiao Bi <junxiao.bi@oracle.com>
Cc: Mark Fasheh <mark@fasheh.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>

authored by

Heming Zhao and committed by
Andrew Morton
fc07d2a2 52535022

+16 -15
+5 -6
fs/ocfs2/dlm/dlmdomain.c
··· 1274 1274 { 1275 1275 struct dlm_query_nodeinfo *qn; 1276 1276 struct dlm_ctxt *dlm = NULL; 1277 - int locked = 0, status = -EINVAL; 1277 + int status = -EINVAL; 1278 1278 1279 1279 qn = (struct dlm_query_nodeinfo *) msg->buf; 1280 1280 ··· 1290 1290 } 1291 1291 1292 1292 spin_lock(&dlm->spinlock); 1293 - locked = 1; 1294 1293 if (dlm->joining_node != qn->qn_nodenum) { 1295 1294 mlog(ML_ERROR, "Node %d queried nodes on domain %s but " 1296 1295 "joining node is %d\n", qn->qn_nodenum, qn->qn_domain, 1297 1296 dlm->joining_node); 1298 - goto bail; 1297 + goto unlock; 1299 1298 } 1300 1299 1301 1300 /* Support for node query was added in 1.1 */ ··· 1304 1305 "but active dlm protocol is %d.%d\n", qn->qn_nodenum, 1305 1306 qn->qn_domain, dlm->dlm_locking_proto.pv_major, 1306 1307 dlm->dlm_locking_proto.pv_minor); 1307 - goto bail; 1308 + goto unlock; 1308 1309 } 1309 1310 1310 1311 status = dlm_match_nodes(dlm, qn); 1311 1312 1313 + unlock: 1314 + spin_unlock(&dlm->spinlock); 1312 1315 bail: 1313 - if (locked) 1314 - spin_unlock(&dlm->spinlock); 1315 1316 spin_unlock(&dlm_domain_lock); 1316 1317 1317 1318 return status;
+6 -6
fs/ocfs2/export.c
··· 255 255 if (fh_len < 3 || fh_type > 2) 256 256 return NULL; 257 257 258 - handle.ih_blkno = (u64)le32_to_cpu(fid->raw[0]) << 32; 259 - handle.ih_blkno |= (u64)le32_to_cpu(fid->raw[1]); 260 - handle.ih_generation = le32_to_cpu(fid->raw[2]); 258 + handle.ih_blkno = (u64)le32_to_cpu((__force __le32)fid->raw[0]) << 32; 259 + handle.ih_blkno |= (u64)le32_to_cpu((__force __le32)fid->raw[1]); 260 + handle.ih_generation = le32_to_cpu((__force __le32)fid->raw[2]); 261 261 return ocfs2_get_dentry(sb, &handle); 262 262 } 263 263 ··· 269 269 if (fh_type != 2 || fh_len < 6) 270 270 return NULL; 271 271 272 - parent.ih_blkno = (u64)le32_to_cpu(fid->raw[3]) << 32; 273 - parent.ih_blkno |= (u64)le32_to_cpu(fid->raw[4]); 274 - parent.ih_generation = le32_to_cpu(fid->raw[5]); 272 + parent.ih_blkno = (u64)le32_to_cpu((__force __le32)fid->raw[3]) << 32; 273 + parent.ih_blkno |= (u64)le32_to_cpu((__force __le32)fid->raw[4]); 274 + parent.ih_generation = le32_to_cpu((__force __le32)fid->raw[5]); 275 275 return ocfs2_get_dentry(sb, &parent); 276 276 } 277 277
+2
fs/ocfs2/inode.c
··· 1621 1621 } 1622 1622 1623 1623 static void ocfs2_inode_cache_lock(struct ocfs2_caching_info *ci) 1624 + __acquires(&oi->ip_lock) 1624 1625 { 1625 1626 struct ocfs2_inode_info *oi = cache_info_to_inode(ci); 1626 1627 ··· 1629 1628 } 1630 1629 1631 1630 static void ocfs2_inode_cache_unlock(struct ocfs2_caching_info *ci) 1631 + __releases(&oi->ip_lock) 1632 1632 { 1633 1633 struct ocfs2_inode_info *oi = cache_info_to_inode(ci); 1634 1634
+2 -2
fs/ocfs2/localalloc.c
··· 336 336 "found = %u, set = %u, taken = %u, off = %u\n", 337 337 num_used, le32_to_cpu(alloc->id1.bitmap1.i_used), 338 338 le32_to_cpu(alloc->id1.bitmap1.i_total), 339 - OCFS2_LOCAL_ALLOC(alloc)->la_bm_off); 339 + le32_to_cpu(OCFS2_LOCAL_ALLOC(alloc)->la_bm_off)); 340 340 341 341 status = -EINVAL; 342 342 goto bail; ··· 1214 1214 OCFS2_LOCAL_ALLOC(alloc)->la_bitmap); 1215 1215 1216 1216 trace_ocfs2_local_alloc_new_window_result( 1217 - OCFS2_LOCAL_ALLOC(alloc)->la_bm_off, 1217 + le32_to_cpu(OCFS2_LOCAL_ALLOC(alloc)->la_bm_off), 1218 1218 le32_to_cpu(alloc->id1.bitmap1.i_total)); 1219 1219 1220 1220 bail:
+1 -1
fs/ocfs2/refcounttree.c
··· 630 630 rb->rf_records.rl_count = 631 631 cpu_to_le16(ocfs2_refcount_recs_per_rb(osb->sb)); 632 632 spin_lock(&osb->osb_lock); 633 - rb->rf_generation = osb->s_next_generation++; 633 + rb->rf_generation = cpu_to_le32(osb->s_next_generation++); 634 634 spin_unlock(&osb->osb_lock); 635 635 636 636 ocfs2_journal_dirty(handle, new_bh);