This patch removes unaligned memory access handling for receiving midcomms messages. The allocated receive buffer is always memory aligned as the code shows, but each dlm message length and their structure fields are always aligned to 4 bytes addresses so it should be fine to remove this special handling.
Signed-off-by: Alexander Aring <[email protected]> --- fs/dlm/midcomms.c | 12 +----------- 1 file changed, 1 insertion(+), 11 deletions(-) diff --git a/fs/dlm/midcomms.c b/fs/dlm/midcomms.c index e058e017c77d..b146842be54a 100644 --- a/fs/dlm/midcomms.c +++ b/fs/dlm/midcomms.c @@ -22,8 +22,6 @@ * into packets and sends them to the comms layer. */ -#include <asm/unaligned.h> - #include "dlm_internal.h" #include "lowcomms.h" #include "config.h" @@ -96,7 +94,7 @@ int dlm_process_incoming_buffer(int nodeid, unsigned char *buf, int len) /* no message should be more than this otherwise we * cannot deliver this message to upper layers */ - msglen = get_unaligned_le16(&hd->h_length); + msglen = le16_to_cpu(hd->h_length); if (msglen > DEFAULT_BUFFER_SIZE) { log_print("received invalid length header: %u, will abort message parsing", msglen); @@ -132,14 +130,6 @@ int dlm_process_incoming_buffer(int nodeid, unsigned char *buf, int len) goto skip; } - /* for aligned memory access, we just copy current message - * to begin of the buffer which contains already parsed buffer - * data and should provide align access for upper layers - * because the start address of the buffer has a aligned - * address. This memmove can be removed when the upperlayer - * is capable of unaligned memory access. - */ - memmove(buf, ptr, msglen); dlm_receive_buffer((union dlm_packet *)buf, nodeid); skip: -- 2.26.2
