md-cluster: make other members of cluster_msg is handled by little endian funcs

Signed-off-by: Guoqing Jiang <gqjiang@suse.com>
This commit is contained in:
Guoqing Jiang 2015-10-12 17:21:21 +08:00 коммит произвёл Goldwyn Rodrigues
Родитель d216711bed
Коммит faeff83fa4
1 изменённых файлов: 14 добавлений и 10 удалений

Просмотреть файл

@ -418,7 +418,7 @@ static void process_add_new_disk(struct mddev *mddev, struct cluster_msg *cmsg)
len = snprintf(disk_uuid, 64, "DEVICE_UUID="); len = snprintf(disk_uuid, 64, "DEVICE_UUID=");
sprintf(disk_uuid + len, "%pU", cmsg->uuid); sprintf(disk_uuid + len, "%pU", cmsg->uuid);
snprintf(raid_slot, 16, "RAID_DISK=%d", cmsg->raid_slot); snprintf(raid_slot, 16, "RAID_DISK=%d", le32_to_cpu(cmsg->raid_slot));
pr_info("%s:%d Sending kobject change with %s and %s\n", __func__, __LINE__, disk_uuid, raid_slot); pr_info("%s:%d Sending kobject change with %s and %s\n", __func__, __LINE__, disk_uuid, raid_slot);
init_completion(&cinfo->newdisk_completion); init_completion(&cinfo->newdisk_completion);
set_bit(MD_CLUSTER_WAITING_FOR_NEWDISK, &cinfo->state); set_bit(MD_CLUSTER_WAITING_FOR_NEWDISK, &cinfo->state);
@ -438,22 +438,26 @@ static void process_metadata_update(struct mddev *mddev, struct cluster_msg *msg
static void process_remove_disk(struct mddev *mddev, struct cluster_msg *msg) static void process_remove_disk(struct mddev *mddev, struct cluster_msg *msg)
{ {
struct md_rdev *rdev = md_find_rdev_nr_rcu(mddev, msg->raid_slot); struct md_rdev *rdev = md_find_rdev_nr_rcu(mddev,
le32_to_cpu(msg->raid_slot));
if (rdev) if (rdev)
md_kick_rdev_from_array(rdev); md_kick_rdev_from_array(rdev);
else else
pr_warn("%s: %d Could not find disk(%d) to REMOVE\n", __func__, __LINE__, msg->raid_slot); pr_warn("%s: %d Could not find disk(%d) to REMOVE\n",
__func__, __LINE__, le32_to_cpu(msg->raid_slot));
} }
static void process_readd_disk(struct mddev *mddev, struct cluster_msg *msg) static void process_readd_disk(struct mddev *mddev, struct cluster_msg *msg)
{ {
struct md_rdev *rdev = md_find_rdev_nr_rcu(mddev, msg->raid_slot); struct md_rdev *rdev = md_find_rdev_nr_rcu(mddev,
le32_to_cpu(msg->raid_slot));
if (rdev && test_bit(Faulty, &rdev->flags)) if (rdev && test_bit(Faulty, &rdev->flags))
clear_bit(Faulty, &rdev->flags); clear_bit(Faulty, &rdev->flags);
else else
pr_warn("%s: %d Could not find disk(%d) which is faulty", __func__, __LINE__, msg->raid_slot); pr_warn("%s: %d Could not find disk(%d) which is faulty",
__func__, __LINE__, le32_to_cpu(msg->raid_slot));
} }
static void process_recvd_msg(struct mddev *mddev, struct cluster_msg *msg) static void process_recvd_msg(struct mddev *mddev, struct cluster_msg *msg)
@ -936,7 +940,7 @@ static int add_new_disk(struct mddev *mddev, struct md_rdev *rdev)
memset(&cmsg, 0, sizeof(cmsg)); memset(&cmsg, 0, sizeof(cmsg));
cmsg.type = cpu_to_le32(NEWDISK); cmsg.type = cpu_to_le32(NEWDISK);
memcpy(cmsg.uuid, uuid, 16); memcpy(cmsg.uuid, uuid, 16);
cmsg.raid_slot = rdev->desc_nr; cmsg.raid_slot = cpu_to_le32(rdev->desc_nr);
lock_comm(cinfo); lock_comm(cinfo);
ret = __sendmsg(cinfo, &cmsg); ret = __sendmsg(cinfo, &cmsg);
if (ret) if (ret)
@ -979,8 +983,8 @@ static int remove_disk(struct mddev *mddev, struct md_rdev *rdev)
{ {
struct cluster_msg cmsg; struct cluster_msg cmsg;
struct md_cluster_info *cinfo = mddev->cluster_info; struct md_cluster_info *cinfo = mddev->cluster_info;
cmsg.type = REMOVE; cmsg.type = cpu_to_le32(REMOVE);
cmsg.raid_slot = rdev->desc_nr; cmsg.raid_slot = cpu_to_le32(rdev->desc_nr);
return __sendmsg(cinfo, &cmsg); return __sendmsg(cinfo, &cmsg);
} }
@ -992,8 +996,8 @@ static int gather_bitmaps(struct md_rdev *rdev)
struct mddev *mddev = rdev->mddev; struct mddev *mddev = rdev->mddev;
struct md_cluster_info *cinfo = mddev->cluster_info; struct md_cluster_info *cinfo = mddev->cluster_info;
cmsg.type = RE_ADD; cmsg.type = cpu_to_le32(RE_ADD);
cmsg.raid_slot = rdev->desc_nr; cmsg.raid_slot = cpu_to_le32(rdev->desc_nr);
err = sendmsg(cinfo, &cmsg); err = sendmsg(cinfo, &cmsg);
if (err) if (err)
goto out; goto out;