提交 cf97a348 编写于 作者: G Guoqing Jiang 提交者: NeilBrown

md-cluster: Fix warnings when build with CF=-D__CHECK_ENDIAN__

This patches fixes sparse warnings like incorrect type in assignment
(different base types), cast to restricted __le64.
Reported-by: Nkbuild test robot <fengguang.wu@intel.com>
Signed-off-by: NGuoqing Jiang <gqjiang@suse.com>
Signed-off-by: NNeilBrown <neilb@suse.com>
上级 ba2746b0
...@@ -81,13 +81,13 @@ enum msg_type { ...@@ -81,13 +81,13 @@ enum msg_type {
}; };
struct cluster_msg { struct cluster_msg {
int type; __le32 type;
int slot; __le32 slot;
/* TODO: Unionize this for smaller footprint */ /* TODO: Unionize this for smaller footprint */
sector_t low; __le64 low;
sector_t high; __le64 high;
char uuid[16]; char uuid[16];
int raid_slot; __le32 raid_slot;
}; };
static void sync_ast(void *arg) static void sync_ast(void *arg)
...@@ -215,7 +215,7 @@ static struct suspend_info *read_resync_info(struct mddev *mddev, struct dlm_loc ...@@ -215,7 +215,7 @@ static struct suspend_info *read_resync_info(struct mddev *mddev, struct dlm_loc
dlm_lock_sync(lockres, DLM_LOCK_CR); dlm_lock_sync(lockres, DLM_LOCK_CR);
memcpy(&ri, lockres->lksb.sb_lvbptr, sizeof(struct resync_info)); memcpy(&ri, lockres->lksb.sb_lvbptr, sizeof(struct resync_info));
hi = le64_to_cpu(ri.hi); hi = le64_to_cpu(ri.hi);
if (ri.hi > 0) { if (hi > 0) {
s = kzalloc(sizeof(struct suspend_info), GFP_KERNEL); s = kzalloc(sizeof(struct suspend_info), GFP_KERNEL);
if (!s) if (!s)
goto out; goto out;
...@@ -465,13 +465,14 @@ static void process_recvd_msg(struct mddev *mddev, struct cluster_msg *msg) ...@@ -465,13 +465,14 @@ static void process_recvd_msg(struct mddev *mddev, struct cluster_msg *msg)
if (WARN(mddev->cluster_info->slot_number - 1 == le32_to_cpu(msg->slot), if (WARN(mddev->cluster_info->slot_number - 1 == le32_to_cpu(msg->slot),
"node %d received it's own msg\n", le32_to_cpu(msg->slot))) "node %d received it's own msg\n", le32_to_cpu(msg->slot)))
return; return;
switch (msg->type) { switch (le32_to_cpu(msg->type)) {
case METADATA_UPDATED: case METADATA_UPDATED:
process_metadata_update(mddev, msg); process_metadata_update(mddev, msg);
break; break;
case RESYNCING: case RESYNCING:
process_suspend_info(mddev, msg->slot, process_suspend_info(mddev, le32_to_cpu(msg->slot),
msg->low, msg->high); le64_to_cpu(msg->low),
le64_to_cpu(msg->high));
break; break;
case NEWDISK: case NEWDISK:
process_add_new_disk(mddev, msg); process_add_new_disk(mddev, msg);
...@@ -483,7 +484,7 @@ static void process_recvd_msg(struct mddev *mddev, struct cluster_msg *msg) ...@@ -483,7 +484,7 @@ static void process_recvd_msg(struct mddev *mddev, struct cluster_msg *msg)
process_readd_disk(mddev, msg); process_readd_disk(mddev, msg);
break; break;
case BITMAP_NEEDS_SYNC: case BITMAP_NEEDS_SYNC:
__recover_slot(mddev, msg->slot); __recover_slot(mddev, le32_to_cpu(msg->slot));
break; break;
default: default:
pr_warn("%s:%d Received unknown message from %d\n", pr_warn("%s:%d Received unknown message from %d\n",
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册