Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

dlm: remove allocation parameter in msg allocation

Remove the context parameter for message allocations and
always use GFP_ATOMIC. This prepares for softirq message
processing.

Signed-off-by: Alexander Aring <aahringo@redhat.com>
Signed-off-by: David Teigland <teigland@redhat.com>

authored by

Alexander Aring and committed by
David Teigland
98808644 ca0dcef7

+41 -57
+12 -19
fs/dlm/lock.c
··· 3330 3330 static int _create_message(struct dlm_ls *ls, int mb_len, 3331 3331 int to_nodeid, int mstype, 3332 3332 struct dlm_message **ms_ret, 3333 - struct dlm_mhandle **mh_ret, 3334 - gfp_t allocation) 3333 + struct dlm_mhandle **mh_ret) 3335 3334 { 3336 3335 struct dlm_message *ms; 3337 3336 struct dlm_mhandle *mh; ··· 3340 3341 pass into midcomms_commit and a message buffer (mb) that we 3341 3342 write our data into */ 3342 3343 3343 - mh = dlm_midcomms_get_mhandle(to_nodeid, mb_len, allocation, &mb); 3344 + mh = dlm_midcomms_get_mhandle(to_nodeid, mb_len, &mb); 3344 3345 if (!mh) 3345 3346 return -ENOBUFS; 3346 3347 ··· 3362 3363 static int create_message(struct dlm_rsb *r, struct dlm_lkb *lkb, 3363 3364 int to_nodeid, int mstype, 3364 3365 struct dlm_message **ms_ret, 3365 - struct dlm_mhandle **mh_ret, 3366 - gfp_t allocation) 3366 + struct dlm_mhandle **mh_ret) 3367 3367 { 3368 3368 int mb_len = sizeof(struct dlm_message); 3369 3369 ··· 3383 3385 } 3384 3386 3385 3387 return _create_message(r->res_ls, mb_len, to_nodeid, mstype, 3386 - ms_ret, mh_ret, allocation); 3388 + ms_ret, mh_ret); 3387 3389 } 3388 3390 3389 3391 /* further lowcomms enhancements or alternate implementations may make ··· 3452 3454 if (error) 3453 3455 return error; 3454 3456 3455 - error = create_message(r, lkb, to_nodeid, mstype, &ms, &mh, GFP_NOFS); 3457 + error = create_message(r, lkb, to_nodeid, mstype, &ms, &mh); 3456 3458 if (error) 3457 3459 goto fail; 3458 3460 ··· 3512 3514 3513 3515 to_nodeid = lkb->lkb_nodeid; 3514 3516 3515 - error = create_message(r, lkb, to_nodeid, DLM_MSG_GRANT, &ms, &mh, 3516 - GFP_NOFS); 3517 + error = create_message(r, lkb, to_nodeid, DLM_MSG_GRANT, &ms, &mh); 3517 3518 if (error) 3518 3519 goto out; 3519 3520 ··· 3533 3536 3534 3537 to_nodeid = lkb->lkb_nodeid; 3535 3538 3536 - error = create_message(r, NULL, to_nodeid, DLM_MSG_BAST, &ms, &mh, 3537 - GFP_NOFS); 3539 + error = create_message(r, NULL, to_nodeid, DLM_MSG_BAST, &ms, &mh); 3538 3540 if (error) 3539 3541 goto out; 3540 3542 ··· 3558 3562 if (error) 3559 3563 return error; 3560 3564 3561 - error = create_message(r, NULL, to_nodeid, DLM_MSG_LOOKUP, &ms, &mh, 3562 - GFP_NOFS); 3565 + error = create_message(r, NULL, to_nodeid, DLM_MSG_LOOKUP, &ms, &mh); 3563 3566 if (error) 3564 3567 goto fail; 3565 3568 ··· 3582 3587 3583 3588 to_nodeid = dlm_dir_nodeid(r); 3584 3589 3585 - error = create_message(r, NULL, to_nodeid, DLM_MSG_REMOVE, &ms, &mh, 3586 - GFP_ATOMIC); 3590 + error = create_message(r, NULL, to_nodeid, DLM_MSG_REMOVE, &ms, &mh); 3587 3591 if (error) 3588 3592 goto out; 3589 3593 ··· 3603 3609 3604 3610 to_nodeid = lkb->lkb_nodeid; 3605 3611 3606 - error = create_message(r, lkb, to_nodeid, mstype, &ms, &mh, GFP_NOFS); 3612 + error = create_message(r, lkb, to_nodeid, mstype, &ms, &mh); 3607 3613 if (error) 3608 3614 goto out; 3609 3615 ··· 3645 3651 struct dlm_mhandle *mh; 3646 3652 int error, nodeid = le32_to_cpu(ms_in->m_header.h_nodeid); 3647 3653 3648 - error = create_message(r, NULL, nodeid, DLM_MSG_LOOKUP_REPLY, &ms, &mh, 3649 - GFP_NOFS); 3654 + error = create_message(r, NULL, nodeid, DLM_MSG_LOOKUP_REPLY, &ms, &mh); 3650 3655 if (error) 3651 3656 goto out; 3652 3657 ··· 6096 6103 int error; 6097 6104 6098 6105 error = _create_message(ls, sizeof(struct dlm_message), nodeid, 6099 - DLM_MSG_PURGE, &ms, &mh, GFP_NOFS); 6106 + DLM_MSG_PURGE, &ms, &mh); 6100 6107 if (error) 6101 6108 return error; 6102 6109 ms->m_nodeid = cpu_to_le32(nodeid);
+7 -9
fs/dlm/lowcomms.c
··· 1229 1229 }; 1230 1230 1231 1231 static struct dlm_msg *dlm_lowcomms_new_msg_con(struct connection *con, int len, 1232 - gfp_t allocation, char **ppc, 1233 - void (*cb)(void *data), 1232 + char **ppc, void (*cb)(void *data), 1234 1233 void *data) 1235 1234 { 1236 1235 struct writequeue_entry *e; 1237 1236 struct dlm_msg *msg; 1238 1237 1239 - msg = dlm_allocate_msg(allocation); 1238 + msg = dlm_allocate_msg(); 1240 1239 if (!msg) 1241 1240 return NULL; 1242 1241 ··· 1260 1261 * dlm_lowcomms_commit_msg which is a must call if success 1261 1262 */ 1262 1263 #ifndef __CHECKER__ 1263 - struct dlm_msg *dlm_lowcomms_new_msg(int nodeid, int len, gfp_t allocation, 1264 - char **ppc, void (*cb)(void *data), 1265 - void *data) 1264 + struct dlm_msg *dlm_lowcomms_new_msg(int nodeid, int len, char **ppc, 1265 + void (*cb)(void *data), void *data) 1266 1266 { 1267 1267 struct connection *con; 1268 1268 struct dlm_msg *msg; ··· 1282 1284 return NULL; 1283 1285 } 1284 1286 1285 - msg = dlm_lowcomms_new_msg_con(con, len, allocation, ppc, cb, data); 1287 + msg = dlm_lowcomms_new_msg_con(con, len, ppc, cb, data); 1286 1288 if (!msg) { 1287 1289 srcu_read_unlock(&connections_srcu, idx); 1288 1290 return NULL; ··· 1346 1348 if (msg->retransmit) 1347 1349 return 1; 1348 1350 1349 - msg_resend = dlm_lowcomms_new_msg_con(msg->entry->con, msg->len, 1350 - GFP_ATOMIC, &ppc, NULL, NULL); 1351 + msg_resend = dlm_lowcomms_new_msg_con(msg->entry->con, msg->len, &ppc, 1352 + NULL, NULL); 1351 1353 if (!msg_resend) 1352 1354 return -ENOMEM; 1353 1355
+2 -3
fs/dlm/lowcomms.h
··· 39 39 void dlm_lowcomms_init(void); 40 40 void dlm_lowcomms_exit(void); 41 41 int dlm_lowcomms_close(int nodeid); 42 - struct dlm_msg *dlm_lowcomms_new_msg(int nodeid, int len, gfp_t allocation, 43 - char **ppc, void (*cb)(void *data), 44 - void *data); 42 + struct dlm_msg *dlm_lowcomms_new_msg(int nodeid, int len, char **ppc, 43 + void (*cb)(void *data), void *data); 45 44 void dlm_lowcomms_commit_msg(struct dlm_msg *msg); 46 45 void dlm_lowcomms_put_msg(struct dlm_msg *msg); 47 46 int dlm_lowcomms_resend_msg(struct dlm_msg *msg);
+4 -4
fs/dlm/memory.c
··· 130 130 kmem_cache_free(lkb_cache, lkb); 131 131 } 132 132 133 - struct dlm_mhandle *dlm_allocate_mhandle(gfp_t allocation) 133 + struct dlm_mhandle *dlm_allocate_mhandle(void) 134 134 { 135 - return kmem_cache_alloc(mhandle_cache, allocation); 135 + return kmem_cache_alloc(mhandle_cache, GFP_ATOMIC); 136 136 } 137 137 138 138 void dlm_free_mhandle(struct dlm_mhandle *mhandle) ··· 150 150 kmem_cache_free(writequeue_cache, writequeue); 151 151 } 152 152 153 - struct dlm_msg *dlm_allocate_msg(gfp_t allocation) 153 + struct dlm_msg *dlm_allocate_msg(void) 154 154 { 155 - return kmem_cache_alloc(msg_cache, allocation); 155 + return kmem_cache_alloc(msg_cache, GFP_ATOMIC); 156 156 } 157 157 158 158 void dlm_free_msg(struct dlm_msg *msg)
+2 -2
fs/dlm/memory.h
··· 20 20 void dlm_free_lkb(struct dlm_lkb *l); 21 21 char *dlm_allocate_lvb(struct dlm_ls *ls); 22 22 void dlm_free_lvb(char *l); 23 - struct dlm_mhandle *dlm_allocate_mhandle(gfp_t allocation); 23 + struct dlm_mhandle *dlm_allocate_mhandle(void); 24 24 void dlm_free_mhandle(struct dlm_mhandle *mhandle); 25 25 struct writequeue_entry *dlm_allocate_writequeue(void); 26 26 void dlm_free_writequeue(struct writequeue_entry *writequeue); 27 - struct dlm_msg *dlm_allocate_msg(gfp_t allocation); 27 + struct dlm_msg *dlm_allocate_msg(void); 28 28 void dlm_free_msg(struct dlm_msg *msg); 29 29 struct dlm_callback *dlm_allocate_cb(void); 30 30 void dlm_free_cb(struct dlm_callback *cb);
+10 -14
fs/dlm/midcomms.c
··· 379 379 struct dlm_msg *msg; 380 380 char *ppc; 381 381 382 - msg = dlm_lowcomms_new_msg(nodeid, mb_len, GFP_ATOMIC, &ppc, 383 - NULL, NULL); 382 + msg = dlm_lowcomms_new_msg(nodeid, mb_len, &ppc, NULL, NULL); 384 383 if (!msg) 385 384 return -ENOMEM; 386 385 ··· 427 428 struct dlm_mhandle *mh; 428 429 char *ppc; 429 430 430 - mh = dlm_midcomms_get_mhandle(node->nodeid, mb_len, GFP_ATOMIC, &ppc); 431 + mh = dlm_midcomms_get_mhandle(node->nodeid, mb_len, &ppc); 431 432 if (!mh) 432 433 return -ENOMEM; 433 434 ··· 975 976 } 976 977 977 978 static struct dlm_msg *dlm_midcomms_get_msg_3_2(struct dlm_mhandle *mh, int nodeid, 978 - int len, gfp_t allocation, char **ppc) 979 + int len, char **ppc) 979 980 { 980 981 struct dlm_opts *opts; 981 982 struct dlm_msg *msg; 982 983 983 984 msg = dlm_lowcomms_new_msg(nodeid, len + DLM_MIDCOMMS_OPT_LEN, 984 - allocation, ppc, midcomms_new_msg_cb, mh); 985 + ppc, midcomms_new_msg_cb, mh); 985 986 if (!msg) 986 987 return NULL; 987 988 ··· 1000 1001 * dlm_midcomms_commit_mhandle which is a must call if success 1001 1002 */ 1002 1003 #ifndef __CHECKER__ 1003 - struct dlm_mhandle *dlm_midcomms_get_mhandle(int nodeid, int len, 1004 - gfp_t allocation, char **ppc) 1004 + struct dlm_mhandle *dlm_midcomms_get_mhandle(int nodeid, int len, char **ppc) 1005 1005 { 1006 1006 struct midcomms_node *node; 1007 1007 struct dlm_mhandle *mh; ··· 1015 1017 /* this is a bug, however we going on and hope it will be resolved */ 1016 1018 WARN_ON_ONCE(test_bit(DLM_NODE_FLAG_STOP_TX, &node->flags)); 1017 1019 1018 - mh = dlm_allocate_mhandle(allocation); 1020 + mh = dlm_allocate_mhandle(); 1019 1021 if (!mh) 1020 1022 goto err; 1021 1023 ··· 1026 1028 1027 1029 switch (node->version) { 1028 1030 case DLM_VERSION_3_1: 1029 - msg = dlm_lowcomms_new_msg(nodeid, len, allocation, ppc, 1030 - NULL, NULL); 1031 + msg = dlm_lowcomms_new_msg(nodeid, len, ppc, NULL, NULL); 1031 1032 if (!msg) { 1032 1033 dlm_free_mhandle(mh); 1033 1034 goto err; ··· 1037 1040 /* send ack back if necessary */ 1038 1041 dlm_send_ack_threshold(node, DLM_SEND_ACK_BACK_MSG_THRESHOLD); 1039 1042 1040 - msg = dlm_midcomms_get_msg_3_2(mh, nodeid, len, allocation, 1041 - ppc); 1043 + msg = dlm_midcomms_get_msg_3_2(mh, nodeid, len, ppc); 1042 1044 if (!msg) { 1043 1045 dlm_free_mhandle(mh); 1044 1046 goto err; ··· 1497 1501 rd.node = node; 1498 1502 rd.buf = buf; 1499 1503 1500 - msg = dlm_lowcomms_new_msg(node->nodeid, buflen, GFP_NOFS, 1501 - &msgbuf, midcomms_new_rawmsg_cb, &rd); 1504 + msg = dlm_lowcomms_new_msg(node->nodeid, buflen, &msgbuf, 1505 + midcomms_new_rawmsg_cb, &rd); 1502 1506 if (!msg) 1503 1507 return -ENOMEM; 1504 1508
+1 -2
fs/dlm/midcomms.h
··· 16 16 17 17 int dlm_validate_incoming_buffer(int nodeid, unsigned char *buf, int len); 18 18 int dlm_process_incoming_buffer(int nodeid, unsigned char *buf, int buflen); 19 - struct dlm_mhandle *dlm_midcomms_get_mhandle(int nodeid, int len, 20 - gfp_t allocation, char **ppc); 19 + struct dlm_mhandle *dlm_midcomms_get_mhandle(int nodeid, int len, char **ppc); 21 20 void dlm_midcomms_commit_mhandle(struct dlm_mhandle *mh, const void *name, 22 21 int namelen); 23 22 int dlm_midcomms_addr(int nodeid, struct sockaddr_storage *addr, int len);
+3 -4
fs/dlm/rcom.c
··· 55 55 struct dlm_mhandle *mh; 56 56 char *mb; 57 57 58 - mh = dlm_midcomms_get_mhandle(to_nodeid, mb_len, GFP_NOFS, &mb); 58 + mh = dlm_midcomms_get_mhandle(to_nodeid, mb_len, &mb); 59 59 if (!mh) { 60 60 log_print("%s to %d type %d len %d ENOBUFS", 61 61 __func__, to_nodeid, type, len); ··· 75 75 struct dlm_msg *msg; 76 76 char *mb; 77 77 78 - msg = dlm_lowcomms_new_msg(to_nodeid, mb_len, GFP_NOFS, &mb, 79 - NULL, NULL); 78 + msg = dlm_lowcomms_new_msg(to_nodeid, mb_len, &mb, NULL, NULL); 80 79 if (!msg) { 81 80 log_print("create_rcom to %d type %d len %d ENOBUFS", 82 81 to_nodeid, type, len); ··· 509 510 char *mb; 510 511 int mb_len = sizeof(struct dlm_rcom) + sizeof(struct rcom_config); 511 512 512 - mh = dlm_midcomms_get_mhandle(nodeid, mb_len, GFP_NOFS, &mb); 513 + mh = dlm_midcomms_get_mhandle(nodeid, mb_len, &mb); 513 514 if (!mh) 514 515 return -ENOBUFS; 515 516