fs: dlm: rename socket and app buffer defines
This patch renames DEFAULT_BUFFER_SIZE to DLM_MAX_SOCKET_BUFSIZE and LOWCOMMS_MAX_TX_BUFFER_LEN to DLM_MAX_APP_BUFSIZE as they are proper names to define what's behind those values. The DLM_MAX_SOCKET_BUFSIZE defines the maximum size of buffer which can be handled on socket layer, the DLM_MAX_APP_BUFSIZE defines the maximum size of buffer which can be handled by the DLM application layer. Signed-off-by: Alexander Aring <aahringo@redhat.com> Signed-off-by: David Teigland <teigland@redhat.com>
This commit is contained in:
parent
ac7d5d036d
commit
d10a0b8875
|
@ -208,7 +208,7 @@ static int dlm_check_zero(unsigned int x)
|
|||
|
||||
static int dlm_check_buffer_size(unsigned int x)
|
||||
{
|
||||
if (x < DEFAULT_BUFFER_SIZE)
|
||||
if (x < DLM_MAX_SOCKET_BUFSIZE)
|
||||
return -EINVAL;
|
||||
|
||||
return 0;
|
||||
|
@ -962,7 +962,7 @@ int dlm_our_addr(struct sockaddr_storage *addr, int num)
|
|||
|
||||
struct dlm_config_info dlm_config = {
|
||||
.ci_tcp_port = DEFAULT_TCP_PORT,
|
||||
.ci_buffer_size = DEFAULT_BUFFER_SIZE,
|
||||
.ci_buffer_size = DLM_MAX_SOCKET_BUFSIZE,
|
||||
.ci_rsbtbl_size = DEFAULT_RSBTBL_SIZE,
|
||||
.ci_recover_timer = DEFAULT_RECOVER_TIMER,
|
||||
.ci_toss_secs = DEFAULT_TOSS_SECS,
|
||||
|
|
|
@ -12,7 +12,7 @@
|
|||
#ifndef __CONFIG_DOT_H__
|
||||
#define __CONFIG_DOT_H__
|
||||
|
||||
#define DEFAULT_BUFFER_SIZE 4096
|
||||
#define DLM_MAX_SOCKET_BUFSIZE 4096
|
||||
|
||||
struct dlm_config_node {
|
||||
int nodeid;
|
||||
|
|
|
@ -572,7 +572,7 @@ static int new_lockspace(const char *name, const char *cluster,
|
|||
* not having out of bounds issues. However on sending side 3.2
|
||||
* might send less.
|
||||
*/
|
||||
ls->ls_recover_buf = kmalloc(DEFAULT_BUFFER_SIZE, GFP_NOFS);
|
||||
ls->ls_recover_buf = kmalloc(DLM_MAX_SOCKET_BUFSIZE, GFP_NOFS);
|
||||
if (!ls->ls_recover_buf)
|
||||
goto out_lkbidr;
|
||||
|
||||
|
|
|
@ -1556,9 +1556,9 @@ struct dlm_msg *dlm_lowcomms_new_msg(int nodeid, int len, gfp_t allocation,
|
|||
struct dlm_msg *msg;
|
||||
int idx;
|
||||
|
||||
if (len > DEFAULT_BUFFER_SIZE ||
|
||||
if (len > DLM_MAX_SOCKET_BUFSIZE ||
|
||||
len < sizeof(struct dlm_header)) {
|
||||
BUILD_BUG_ON(PAGE_SIZE < DEFAULT_BUFFER_SIZE);
|
||||
BUILD_BUG_ON(PAGE_SIZE < DLM_MAX_SOCKET_BUFSIZE);
|
||||
log_print("failed to allocate a buffer of size %d", len);
|
||||
WARN_ON(1);
|
||||
return NULL;
|
||||
|
|
|
@ -15,7 +15,7 @@
|
|||
#include "dlm_internal.h"
|
||||
|
||||
#define DLM_MIDCOMMS_OPT_LEN sizeof(struct dlm_opts)
|
||||
#define LOWCOMMS_MAX_TX_BUFFER_LEN (DEFAULT_BUFFER_SIZE - \
|
||||
#define DLM_MAX_APP_BUFSIZE (DLM_MAX_SOCKET_BUFSIZE - \
|
||||
DLM_MIDCOMMS_OPT_LEN)
|
||||
|
||||
#define CONN_HASH_SIZE 32
|
||||
|
|
|
@ -271,7 +271,7 @@ int dlm_slots_assign(struct dlm_ls *ls, int *num_slots, int *slots_size,
|
|||
|
||||
log_slots(ls, gen, num, NULL, array, array_size);
|
||||
|
||||
max_slots = (LOWCOMMS_MAX_TX_BUFFER_LEN - sizeof(struct dlm_rcom) -
|
||||
max_slots = (DLM_MAX_APP_BUFSIZE - sizeof(struct dlm_rcom) -
|
||||
sizeof(struct rcom_config)) / sizeof(struct rcom_slot);
|
||||
|
||||
if (num > max_slots) {
|
||||
|
|
|
@ -865,7 +865,7 @@ int dlm_process_incoming_buffer(int nodeid, unsigned char *buf, int len)
|
|||
while (len >= sizeof(struct dlm_header)) {
|
||||
hd = (struct dlm_header *)ptr;
|
||||
|
||||
/* no message should be more than DEFAULT_BUFFER_SIZE or
|
||||
/* no message should be more than DLM_MAX_SOCKET_BUFSIZE or
|
||||
* less than dlm_header size.
|
||||
*
|
||||
* Some messages does not have a 8 byte length boundary yet
|
||||
|
@ -877,7 +877,7 @@ int dlm_process_incoming_buffer(int nodeid, unsigned char *buf, int len)
|
|||
* the next major version bump.
|
||||
*/
|
||||
msglen = le16_to_cpu(hd->h_length);
|
||||
if (msglen > DEFAULT_BUFFER_SIZE ||
|
||||
if (msglen > DLM_MAX_SOCKET_BUFSIZE ||
|
||||
msglen < sizeof(struct dlm_header)) {
|
||||
log_print("received invalid length header: %u from node %d, will abort message parsing",
|
||||
msglen, nodeid);
|
||||
|
|
|
@ -202,7 +202,7 @@ int dlm_rcom_status(struct dlm_ls *ls, int nodeid, uint32_t status_flags)
|
|||
set_rcom_status(ls, (struct rcom_status *)rc->rc_buf, status_flags);
|
||||
|
||||
allow_sync_reply(ls, &rc->rc_id);
|
||||
memset(ls->ls_recover_buf, 0, DEFAULT_BUFFER_SIZE);
|
||||
memset(ls->ls_recover_buf, 0, DLM_MAX_SOCKET_BUFSIZE);
|
||||
|
||||
send_rcom_stateless(ls, msg, rc);
|
||||
|
||||
|
@ -325,7 +325,7 @@ int dlm_rcom_names(struct dlm_ls *ls, int nodeid, char *last_name, int last_len)
|
|||
memcpy(rc->rc_buf, last_name, last_len);
|
||||
|
||||
allow_sync_reply(ls, &rc->rc_id);
|
||||
memset(ls->ls_recover_buf, 0, DEFAULT_BUFFER_SIZE);
|
||||
memset(ls->ls_recover_buf, 0, DLM_MAX_SOCKET_BUFSIZE);
|
||||
|
||||
send_rcom_stateless(ls, msg, rc);
|
||||
|
||||
|
@ -345,7 +345,7 @@ static void receive_rcom_names(struct dlm_ls *ls, struct dlm_rcom *rc_in)
|
|||
|
||||
nodeid = rc_in->rc_header.h_nodeid;
|
||||
inlen = rc_in->rc_header.h_length - sizeof(struct dlm_rcom);
|
||||
outlen = LOWCOMMS_MAX_TX_BUFFER_LEN - sizeof(struct dlm_rcom);
|
||||
outlen = DLM_MAX_APP_BUFSIZE - sizeof(struct dlm_rcom);
|
||||
|
||||
error = create_rcom_stateless(ls, nodeid, DLM_RCOM_NAMES_REPLY, outlen,
|
||||
&rc, &msg);
|
||||
|
|
Loading…
Reference in New Issue