[PATCH 03/16] dlm: do not byteswap rcom_lock

2008-02-06 Thread David Teigland
From: Al Viro <[EMAIL PROTECTED]>

Signed-off-by: Al Viro <[EMAIL PROTECTED]>
Signed-off-by: David Teigland <[EMAIL PROTECTED]>
---
 fs/dlm/dlm_internal.h |   22 +++---
 fs/dlm/lock.c |   34 +++---
 fs/dlm/rcom.c |   14 +++---
 fs/dlm/util.c |   45 ++---
 4 files changed, 39 insertions(+), 76 deletions(-)

diff --git a/fs/dlm/dlm_internal.h b/fs/dlm/dlm_internal.h
index 65499ce..e73b988 100644
--- a/fs/dlm/dlm_internal.h
+++ b/fs/dlm/dlm_internal.h
@@ -416,21 +416,21 @@ struct rcom_config {
 };
 
 struct rcom_lock {
-   uint32_trl_ownpid;
-   uint32_trl_lkid;
-   uint32_trl_remid;
-   uint32_trl_parent_lkid;
-   uint32_trl_parent_remid;
-   uint32_trl_exflags;
-   uint32_trl_flags;
-   uint32_trl_lvbseq;
-   int rl_result;
+   __le32  rl_ownpid;
+   __le32  rl_lkid;
+   __le32  rl_remid;
+   __le32  rl_parent_lkid;
+   __le32  rl_parent_remid;
+   __le32  rl_exflags;
+   __le32  rl_flags;
+   __le32  rl_lvbseq;
+   __le32  rl_result;
int8_t  rl_rqmode;
int8_t  rl_grmode;
int8_t  rl_status;
int8_t  rl_asts;
-   uint16_trl_wait_type;
-   uint16_trl_namelen;
+   __le16  rl_wait_type;
+   __le16  rl_namelen;
charrl_name[DLM_RESNAME_MAXLEN];
charrl_lvb[0];
 };
diff --git a/fs/dlm/lock.c b/fs/dlm/lock.c
index 2a28048..75176b5 100644
--- a/fs/dlm/lock.c
+++ b/fs/dlm/lock.c
@@ -4273,12 +4273,12 @@ static int receive_rcom_lock_args(struct dlm_ls *ls, 
struct dlm_lkb *lkb,
int lvblen;
 
lkb->lkb_nodeid = rc->rc_header.h_nodeid;
-   lkb->lkb_ownpid = rl->rl_ownpid;
-   lkb->lkb_remid = rl->rl_lkid;
-   lkb->lkb_exflags = rl->rl_exflags;
-   lkb->lkb_flags = rl->rl_flags & 0x;
+   lkb->lkb_ownpid = le32_to_cpu(rl->rl_ownpid);
+   lkb->lkb_remid = le32_to_cpu(rl->rl_lkid);
+   lkb->lkb_exflags = le32_to_cpu(rl->rl_exflags);
+   lkb->lkb_flags = le32_to_cpu(rl->rl_flags) & 0x;
lkb->lkb_flags |= DLM_IFL_MSTCPY;
-   lkb->lkb_lvbseq = rl->rl_lvbseq;
+   lkb->lkb_lvbseq = le32_to_cpu(rl->rl_lvbseq);
lkb->lkb_rqmode = rl->rl_rqmode;
lkb->lkb_grmode = rl->rl_grmode;
/* don't set lkb_status because add_lkb wants to itself */
@@ -4299,7 +4299,8 @@ static int receive_rcom_lock_args(struct dlm_ls *ls, 
struct dlm_lkb *lkb,
   The real granted mode of these converting locks cannot be determined
   until all locks have been rebuilt on the rsb (recover_conversion) */
 
-   if (rl->rl_wait_type == DLM_MSG_CONVERT && middle_conversion(lkb)) {
+   if (rl->rl_wait_type == cpu_to_le16(DLM_MSG_CONVERT) &&
+   middle_conversion(lkb)) {
rl->rl_status = DLM_LKSTS_CONVERT;
lkb->lkb_grmode = DLM_LOCK_IV;
rsb_set_flag(r, RSB_RECOVER_CONVERT);
@@ -4326,13 +4327,14 @@ int dlm_recover_master_copy(struct dlm_ls *ls, struct 
dlm_rcom *rc)
goto out;
}
 
-   error = find_rsb(ls, rl->rl_name, rl->rl_namelen, R_MASTER, );
+   error = find_rsb(ls, rl->rl_name, le16_to_cpu(rl->rl_namelen),
+R_MASTER, );
if (error)
goto out;
 
lock_rsb(r);
 
-   lkb = search_remid(r, rc->rc_header.h_nodeid, rl->rl_lkid);
+   lkb = search_remid(r, rc->rc_header.h_nodeid, le32_to_cpu(rl->rl_lkid));
if (lkb) {
error = -EEXIST;
goto out_remid;
@@ -4355,15 +4357,16 @@ int dlm_recover_master_copy(struct dlm_ls *ls, struct 
dlm_rcom *rc)
  out_remid:
/* this is the new value returned to the lock holder for
   saving in its process-copy lkb */
-   rl->rl_remid = lkb->lkb_id;
+   rl->rl_remid = cpu_to_le32(lkb->lkb_id);
 
  out_unlock:
unlock_rsb(r);
put_rsb(r);
  out:
if (error)
-   log_debug(ls, "recover_master_copy %d %x", error, rl->rl_lkid);
-   rl->rl_result = error;
+   log_debug(ls, "recover_master_copy %d %x", error,
+ le32_to_cpu(rl->rl_lkid));
+   rl->rl_result = cpu_to_le32(error);
return error;
 }
 
@@ -4374,15 +4377,16 @@ int dlm_recover_process_copy(struct dlm_ls *ls, struct 
dlm_rcom *rc)
struct dlm_lkb *lkb;
int error;
 
-   error = find_lkb(ls, rl->rl_lkid, );
+   error = find_lkb(ls, le32_to_cpu(rl->rl_lkid), );
 

[PATCH 03/16] dlm: do not byteswap rcom_lock

2008-02-06 Thread David Teigland
From: Al Viro [EMAIL PROTECTED]

Signed-off-by: Al Viro [EMAIL PROTECTED]
Signed-off-by: David Teigland [EMAIL PROTECTED]
---
 fs/dlm/dlm_internal.h |   22 +++---
 fs/dlm/lock.c |   34 +++---
 fs/dlm/rcom.c |   14 +++---
 fs/dlm/util.c |   45 ++---
 4 files changed, 39 insertions(+), 76 deletions(-)

diff --git a/fs/dlm/dlm_internal.h b/fs/dlm/dlm_internal.h
index 65499ce..e73b988 100644
--- a/fs/dlm/dlm_internal.h
+++ b/fs/dlm/dlm_internal.h
@@ -416,21 +416,21 @@ struct rcom_config {
 };
 
 struct rcom_lock {
-   uint32_trl_ownpid;
-   uint32_trl_lkid;
-   uint32_trl_remid;
-   uint32_trl_parent_lkid;
-   uint32_trl_parent_remid;
-   uint32_trl_exflags;
-   uint32_trl_flags;
-   uint32_trl_lvbseq;
-   int rl_result;
+   __le32  rl_ownpid;
+   __le32  rl_lkid;
+   __le32  rl_remid;
+   __le32  rl_parent_lkid;
+   __le32  rl_parent_remid;
+   __le32  rl_exflags;
+   __le32  rl_flags;
+   __le32  rl_lvbseq;
+   __le32  rl_result;
int8_t  rl_rqmode;
int8_t  rl_grmode;
int8_t  rl_status;
int8_t  rl_asts;
-   uint16_trl_wait_type;
-   uint16_trl_namelen;
+   __le16  rl_wait_type;
+   __le16  rl_namelen;
charrl_name[DLM_RESNAME_MAXLEN];
charrl_lvb[0];
 };
diff --git a/fs/dlm/lock.c b/fs/dlm/lock.c
index 2a28048..75176b5 100644
--- a/fs/dlm/lock.c
+++ b/fs/dlm/lock.c
@@ -4273,12 +4273,12 @@ static int receive_rcom_lock_args(struct dlm_ls *ls, 
struct dlm_lkb *lkb,
int lvblen;
 
lkb-lkb_nodeid = rc-rc_header.h_nodeid;
-   lkb-lkb_ownpid = rl-rl_ownpid;
-   lkb-lkb_remid = rl-rl_lkid;
-   lkb-lkb_exflags = rl-rl_exflags;
-   lkb-lkb_flags = rl-rl_flags  0x;
+   lkb-lkb_ownpid = le32_to_cpu(rl-rl_ownpid);
+   lkb-lkb_remid = le32_to_cpu(rl-rl_lkid);
+   lkb-lkb_exflags = le32_to_cpu(rl-rl_exflags);
+   lkb-lkb_flags = le32_to_cpu(rl-rl_flags)  0x;
lkb-lkb_flags |= DLM_IFL_MSTCPY;
-   lkb-lkb_lvbseq = rl-rl_lvbseq;
+   lkb-lkb_lvbseq = le32_to_cpu(rl-rl_lvbseq);
lkb-lkb_rqmode = rl-rl_rqmode;
lkb-lkb_grmode = rl-rl_grmode;
/* don't set lkb_status because add_lkb wants to itself */
@@ -4299,7 +4299,8 @@ static int receive_rcom_lock_args(struct dlm_ls *ls, 
struct dlm_lkb *lkb,
   The real granted mode of these converting locks cannot be determined
   until all locks have been rebuilt on the rsb (recover_conversion) */
 
-   if (rl-rl_wait_type == DLM_MSG_CONVERT  middle_conversion(lkb)) {
+   if (rl-rl_wait_type == cpu_to_le16(DLM_MSG_CONVERT) 
+   middle_conversion(lkb)) {
rl-rl_status = DLM_LKSTS_CONVERT;
lkb-lkb_grmode = DLM_LOCK_IV;
rsb_set_flag(r, RSB_RECOVER_CONVERT);
@@ -4326,13 +4327,14 @@ int dlm_recover_master_copy(struct dlm_ls *ls, struct 
dlm_rcom *rc)
goto out;
}
 
-   error = find_rsb(ls, rl-rl_name, rl-rl_namelen, R_MASTER, r);
+   error = find_rsb(ls, rl-rl_name, le16_to_cpu(rl-rl_namelen),
+R_MASTER, r);
if (error)
goto out;
 
lock_rsb(r);
 
-   lkb = search_remid(r, rc-rc_header.h_nodeid, rl-rl_lkid);
+   lkb = search_remid(r, rc-rc_header.h_nodeid, le32_to_cpu(rl-rl_lkid));
if (lkb) {
error = -EEXIST;
goto out_remid;
@@ -4355,15 +4357,16 @@ int dlm_recover_master_copy(struct dlm_ls *ls, struct 
dlm_rcom *rc)
  out_remid:
/* this is the new value returned to the lock holder for
   saving in its process-copy lkb */
-   rl-rl_remid = lkb-lkb_id;
+   rl-rl_remid = cpu_to_le32(lkb-lkb_id);
 
  out_unlock:
unlock_rsb(r);
put_rsb(r);
  out:
if (error)
-   log_debug(ls, recover_master_copy %d %x, error, rl-rl_lkid);
-   rl-rl_result = error;
+   log_debug(ls, recover_master_copy %d %x, error,
+ le32_to_cpu(rl-rl_lkid));
+   rl-rl_result = cpu_to_le32(error);
return error;
 }
 
@@ -4374,15 +4377,16 @@ int dlm_recover_process_copy(struct dlm_ls *ls, struct 
dlm_rcom *rc)
struct dlm_lkb *lkb;
int error;
 
-   error = find_lkb(ls, rl-rl_lkid, lkb);
+   error = find_lkb(ls, le32_to_cpu(rl-rl_lkid), lkb);
if (error) {
-   log_error(ls,