[LU-8049] Do not use LUSTRE_MSG_MAGIC to check local endianness Created: 21/Apr/16  Updated: 27/May/16  Resolved: 27/May/16

Status: Resolved
Project: Lustre
Component/s: None
Affects Version/s: None
Fix Version/s: Lustre 2.9.0

Type: Bug Priority: Minor
Reporter: nasf (Inactive) Assignee: nasf (Inactive)
Resolution: Fixed Votes: 0
Labels: None

Issue Links:
Blocker
Severity: 3
Rank (Obsolete): 9223372036854775807

 Description   

There are some code using LUSTRE_MSG_MAGIC to check local endianness, such as:

void lustre_lma_swab(struct lustre_mdt_attrs *lma)
{
        /* Use LUSTRE_MSG_MAGIC to detect local endianess. */
        if (LUSTRE_MSG_MAGIC != cpu_to_le32(LUSTRE_MSG_MAGIC)) {
                __swab32s(&lma->lma_compat);
                __swab32s(&lma->lma_incompat);
                lustre_swab_lu_fid(&lma->lma_self_fid);
        }
};

It is not a good way of determining the CPU endianness, it is gratuitously confusing for no reason not only because it has nothing specific to do with LUSTRE_MSG_MAGIC, but also because this is a compile-time check that looks like a runtime check. Instead, we can fix it with checking "__BIG_ENDIAN".



 Comments   
Comment by Gerrit Updater [ 26/Apr/16 ]

Fan Yong (fan.yong@intel.com) uploaded a new patch: http://review.whamcloud.com/19783
Subject: LU-8049 obdclass: use __BIG_ENDIAN to detect local endianness
Project: fs/lustre-dev
Branch: pfl
Current Patch Set: 1
Commit: c23061e37e670314e38ccdf4f37a3830fdc6b239

Comment by Gerrit Updater [ 27/Apr/16 ]

Fan Yong (fan.yong@intel.com) uploaded a new patch: http://review.whamcloud.com/19812
Subject: LU-8049 obdclass: use __BIG_ENDIAN to detect local endianness
Project: fs/lustre-release
Branch: master
Current Patch Set: 1
Commit: 082ced32c90769dee03de1185c863418b21c9408

Comment by Gerrit Updater [ 27/May/16 ]

Oleg Drokin (oleg.drokin@intel.com) merged in patch http://review.whamcloud.com/19812/
Subject: LU-8049 obdclass: use __BIG_ENDIAN to detect local endianness
Project: fs/lustre-release
Branch: master
Current Patch Set:
Commit: 82fcdd9b16aad0b1cd840383c6f3b18c40be00bd

Comment by nasf (Inactive) [ 27/May/16 ]

The patch has been landed to master.

Generated at Sat Feb 10 02:14:11 UTC 2024 using Jira 9.4.14#940014-sha1:734e6822bbf0d45eff9af51f82432957f73aa32c.