[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: |
|
||||
| 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 |
| Comment by Gerrit Updater [ 27/Apr/16 ] |
|
Fan Yong (fan.yong@intel.com) uploaded a new patch: http://review.whamcloud.com/19812 |
| Comment by Gerrit Updater [ 27/May/16 ] |
|
Oleg Drokin (oleg.drokin@intel.com) merged in patch http://review.whamcloud.com/19812/ |
| Comment by nasf (Inactive) [ 27/May/16 ] |
|
The patch has been landed to master. |