Skip to content

Commit fc07d2a

Browse files
zhaohemakpm00
authored andcommitted
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/[email protected] Signed-off-by: Heming Zhao <[email protected]> Reviewed-by: Joseph Qi <[email protected]> Cc: Changwei Ge <[email protected]> Cc: Gang He <[email protected]> Cc: Joel Becker <[email protected]> Cc: Jun Piao <[email protected]> Cc: Junxiao Bi <[email protected]> Cc: Mark Fasheh <[email protected]> Signed-off-by: Andrew Morton <[email protected]>
1 parent 5253502 commit fc07d2a

File tree

5 files changed

+16
-15
lines changed

5 files changed

+16
-15
lines changed

fs/ocfs2/dlm/dlmdomain.c

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1274,7 +1274,7 @@ static int dlm_query_nodeinfo_handler(struct o2net_msg *msg, u32 len,
12741274
{
12751275
struct dlm_query_nodeinfo *qn;
12761276
struct dlm_ctxt *dlm = NULL;
1277-
int locked = 0, status = -EINVAL;
1277+
int status = -EINVAL;
12781278

12791279
qn = (struct dlm_query_nodeinfo *) msg->buf;
12801280

@@ -1290,12 +1290,11 @@ static int dlm_query_nodeinfo_handler(struct o2net_msg *msg, u32 len,
12901290
}
12911291

12921292
spin_lock(&dlm->spinlock);
1293-
locked = 1;
12941293
if (dlm->joining_node != qn->qn_nodenum) {
12951294
mlog(ML_ERROR, "Node %d queried nodes on domain %s but "
12961295
"joining node is %d\n", qn->qn_nodenum, qn->qn_domain,
12971296
dlm->joining_node);
1298-
goto bail;
1297+
goto unlock;
12991298
}
13001299

13011300
/* Support for node query was added in 1.1 */
@@ -1305,14 +1304,14 @@ static int dlm_query_nodeinfo_handler(struct o2net_msg *msg, u32 len,
13051304
"but active dlm protocol is %d.%d\n", qn->qn_nodenum,
13061305
qn->qn_domain, dlm->dlm_locking_proto.pv_major,
13071306
dlm->dlm_locking_proto.pv_minor);
1308-
goto bail;
1307+
goto unlock;
13091308
}
13101309

13111310
status = dlm_match_nodes(dlm, qn);
13121311

1312+
unlock:
1313+
spin_unlock(&dlm->spinlock);
13131314
bail:
1314-
if (locked)
1315-
spin_unlock(&dlm->spinlock);
13161315
spin_unlock(&dlm_domain_lock);
13171316

13181317
return status;

fs/ocfs2/export.c

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -255,9 +255,9 @@ static struct dentry *ocfs2_fh_to_dentry(struct super_block *sb,
255255
if (fh_len < 3 || fh_type > 2)
256256
return NULL;
257257

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]);
261261
return ocfs2_get_dentry(sb, &handle);
262262
}
263263

@@ -269,9 +269,9 @@ static struct dentry *ocfs2_fh_to_parent(struct super_block *sb,
269269
if (fh_type != 2 || fh_len < 6)
270270
return NULL;
271271

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]);
275275
return ocfs2_get_dentry(sb, &parent);
276276
}
277277

fs/ocfs2/inode.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1621,13 +1621,15 @@ static struct super_block *ocfs2_inode_cache_get_super(struct ocfs2_caching_info
16211621
}
16221622

16231623
static void ocfs2_inode_cache_lock(struct ocfs2_caching_info *ci)
1624+
__acquires(&oi->ip_lock)
16241625
{
16251626
struct ocfs2_inode_info *oi = cache_info_to_inode(ci);
16261627

16271628
spin_lock(&oi->ip_lock);
16281629
}
16291630

16301631
static void ocfs2_inode_cache_unlock(struct ocfs2_caching_info *ci)
1632+
__releases(&oi->ip_lock)
16311633
{
16321634
struct ocfs2_inode_info *oi = cache_info_to_inode(ci);
16331635

fs/ocfs2/localalloc.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -336,7 +336,7 @@ int ocfs2_load_local_alloc(struct ocfs2_super *osb)
336336
"found = %u, set = %u, taken = %u, off = %u\n",
337337
num_used, le32_to_cpu(alloc->id1.bitmap1.i_used),
338338
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));
340340

341341
status = -EINVAL;
342342
goto bail;
@@ -1214,7 +1214,7 @@ static int ocfs2_local_alloc_new_window(struct ocfs2_super *osb,
12141214
OCFS2_LOCAL_ALLOC(alloc)->la_bitmap);
12151215

12161216
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),
12181218
le32_to_cpu(alloc->id1.bitmap1.i_total));
12191219

12201220
bail:

fs/ocfs2/refcounttree.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -630,7 +630,7 @@ static int ocfs2_create_refcount_tree(struct inode *inode,
630630
rb->rf_records.rl_count =
631631
cpu_to_le16(ocfs2_refcount_recs_per_rb(osb->sb));
632632
spin_lock(&osb->osb_lock);
633-
rb->rf_generation = osb->s_next_generation++;
633+
rb->rf_generation = cpu_to_le32(osb->s_next_generation++);
634634
spin_unlock(&osb->osb_lock);
635635

636636
ocfs2_journal_dirty(handle, new_bh);

0 commit comments

Comments
 (0)