diff options
author | Philipp Reisner <philipp.reisner@linbit.com> | 2010-08-20 07:36:10 -0400 |
---|---|---|
committer | Philipp Reisner <philipp.reisner@linbit.com> | 2010-10-14 12:38:23 -0400 |
commit | 0b70a13dac014ec9274640b9e945bde493ba365e (patch) | |
tree | cf771e2f8018c0b59bc14fbf00c5c9cdc9caed7c /drivers/block/drbd | |
parent | 204bba9965c4cc175bf5bc65ddd19889e9085c72 (diff) |
drbd: Sending of big packets, for payloads from 64KByte to 4GByte
Signed-off-by: Philipp Reisner <philipp.reisner@linbit.com>
Signed-off-by: Lars Ellenberg <lars.ellenberg@linbit.com>
Diffstat (limited to 'drivers/block/drbd')
-rw-r--r-- | drivers/block/drbd/drbd_int.h | 74 | ||||
-rw-r--r-- | drivers/block/drbd/drbd_main.c | 79 | ||||
-rw-r--r-- | drivers/block/drbd/drbd_receiver.c | 94 | ||||
-rw-r--r-- | drivers/block/drbd/drbd_worker.c | 2 |
4 files changed, 137 insertions, 112 deletions
diff --git a/drivers/block/drbd/drbd_int.h b/drivers/block/drbd/drbd_int.h index 0fedcc0b8dc9..3f10efc2ac14 100644 --- a/drivers/block/drbd/drbd_int.h +++ b/drivers/block/drbd/drbd_int.h | |||
@@ -337,13 +337,25 @@ static inline void bm_xfer_ctx_bit_to_word_offset(struct bm_xfer_ctx *c) | |||
337 | * NOTE that the payload starts at a long aligned offset, | 337 | * NOTE that the payload starts at a long aligned offset, |
338 | * regardless of 32 or 64 bit arch! | 338 | * regardless of 32 or 64 bit arch! |
339 | */ | 339 | */ |
340 | struct p_header { | 340 | struct p_header80 { |
341 | u32 magic; | 341 | u32 magic; |
342 | u16 command; | 342 | u16 command; |
343 | u16 length; /* bytes of data after this header */ | 343 | u16 length; /* bytes of data after this header */ |
344 | u8 payload[0]; | 344 | u8 payload[0]; |
345 | } __packed; | 345 | } __packed; |
346 | /* 8 bytes. packet FIXED for the next century! */ | 346 | |
347 | /* Header for big packets, Used for data packets exceeding 64kB */ | ||
348 | struct p_header95 { | ||
349 | u16 magic; /* use DRBD_MAGIC_BIG here */ | ||
350 | u16 command; | ||
351 | u32 length; | ||
352 | u8 payload[0]; | ||
353 | } __packed; | ||
354 | |||
355 | union p_header { | ||
356 | struct p_header80 h80; | ||
357 | struct p_header95 h95; | ||
358 | }; | ||
347 | 359 | ||
348 | /* | 360 | /* |
349 | * short commands, packets without payload, plain p_header: | 361 | * short commands, packets without payload, plain p_header: |
@@ -367,7 +379,7 @@ struct p_header { | |||
367 | #define DP_MAY_SET_IN_SYNC 4 | 379 | #define DP_MAY_SET_IN_SYNC 4 |
368 | 380 | ||
369 | struct p_data { | 381 | struct p_data { |
370 | struct p_header head; | 382 | union p_header head; |
371 | u64 sector; /* 64 bits sector number */ | 383 | u64 sector; /* 64 bits sector number */ |
372 | u64 block_id; /* to identify the request in protocol B&C */ | 384 | u64 block_id; /* to identify the request in protocol B&C */ |
373 | u32 seq_num; | 385 | u32 seq_num; |
@@ -383,7 +395,7 @@ struct p_data { | |||
383 | * P_DATA_REQUEST, P_RS_DATA_REQUEST | 395 | * P_DATA_REQUEST, P_RS_DATA_REQUEST |
384 | */ | 396 | */ |
385 | struct p_block_ack { | 397 | struct p_block_ack { |
386 | struct p_header head; | 398 | struct p_header80 head; |
387 | u64 sector; | 399 | u64 sector; |
388 | u64 block_id; | 400 | u64 block_id; |
389 | u32 blksize; | 401 | u32 blksize; |
@@ -392,7 +404,7 @@ struct p_block_ack { | |||
392 | 404 | ||
393 | 405 | ||
394 | struct p_block_req { | 406 | struct p_block_req { |
395 | struct p_header head; | 407 | struct p_header80 head; |
396 | u64 sector; | 408 | u64 sector; |
397 | u64 block_id; | 409 | u64 block_id; |
398 | u32 blksize; | 410 | u32 blksize; |
@@ -409,7 +421,7 @@ struct p_block_req { | |||
409 | */ | 421 | */ |
410 | 422 | ||
411 | struct p_handshake { | 423 | struct p_handshake { |
412 | struct p_header head; /* 8 bytes */ | 424 | struct p_header80 head; /* 8 bytes */ |
413 | u32 protocol_min; | 425 | u32 protocol_min; |
414 | u32 feature_flags; | 426 | u32 feature_flags; |
415 | u32 protocol_max; | 427 | u32 protocol_max; |
@@ -424,19 +436,19 @@ struct p_handshake { | |||
424 | /* 80 bytes, FIXED for the next century */ | 436 | /* 80 bytes, FIXED for the next century */ |
425 | 437 | ||
426 | struct p_barrier { | 438 | struct p_barrier { |
427 | struct p_header head; | 439 | struct p_header80 head; |
428 | u32 barrier; /* barrier number _handle_ only */ | 440 | u32 barrier; /* barrier number _handle_ only */ |
429 | u32 pad; /* to multiple of 8 Byte */ | 441 | u32 pad; /* to multiple of 8 Byte */ |
430 | } __packed; | 442 | } __packed; |
431 | 443 | ||
432 | struct p_barrier_ack { | 444 | struct p_barrier_ack { |
433 | struct p_header head; | 445 | struct p_header80 head; |
434 | u32 barrier; | 446 | u32 barrier; |
435 | u32 set_size; | 447 | u32 set_size; |
436 | } __packed; | 448 | } __packed; |
437 | 449 | ||
438 | struct p_rs_param { | 450 | struct p_rs_param { |
439 | struct p_header head; | 451 | struct p_header80 head; |
440 | u32 rate; | 452 | u32 rate; |
441 | 453 | ||
442 | /* Since protocol version 88 and higher. */ | 454 | /* Since protocol version 88 and higher. */ |
@@ -444,7 +456,7 @@ struct p_rs_param { | |||
444 | } __packed; | 456 | } __packed; |
445 | 457 | ||
446 | struct p_rs_param_89 { | 458 | struct p_rs_param_89 { |
447 | struct p_header head; | 459 | struct p_header80 head; |
448 | u32 rate; | 460 | u32 rate; |
449 | /* protocol version 89: */ | 461 | /* protocol version 89: */ |
450 | char verify_alg[SHARED_SECRET_MAX]; | 462 | char verify_alg[SHARED_SECRET_MAX]; |
@@ -452,7 +464,7 @@ struct p_rs_param_89 { | |||
452 | } __packed; | 464 | } __packed; |
453 | 465 | ||
454 | struct p_rs_param_95 { | 466 | struct p_rs_param_95 { |
455 | struct p_header head; | 467 | struct p_header80 head; |
456 | u32 rate; | 468 | u32 rate; |
457 | char verify_alg[SHARED_SECRET_MAX]; | 469 | char verify_alg[SHARED_SECRET_MAX]; |
458 | char csums_alg[SHARED_SECRET_MAX]; | 470 | char csums_alg[SHARED_SECRET_MAX]; |
@@ -468,7 +480,7 @@ enum drbd_conn_flags { | |||
468 | }; | 480 | }; |
469 | 481 | ||
470 | struct p_protocol { | 482 | struct p_protocol { |
471 | struct p_header head; | 483 | struct p_header80 head; |
472 | u32 protocol; | 484 | u32 protocol; |
473 | u32 after_sb_0p; | 485 | u32 after_sb_0p; |
474 | u32 after_sb_1p; | 486 | u32 after_sb_1p; |
@@ -482,17 +494,17 @@ struct p_protocol { | |||
482 | } __packed; | 494 | } __packed; |
483 | 495 | ||
484 | struct p_uuids { | 496 | struct p_uuids { |
485 | struct p_header head; | 497 | struct p_header80 head; |
486 | u64 uuid[UI_EXTENDED_SIZE]; | 498 | u64 uuid[UI_EXTENDED_SIZE]; |
487 | } __packed; | 499 | } __packed; |
488 | 500 | ||
489 | struct p_rs_uuid { | 501 | struct p_rs_uuid { |
490 | struct p_header head; | 502 | struct p_header80 head; |
491 | u64 uuid; | 503 | u64 uuid; |
492 | } __packed; | 504 | } __packed; |
493 | 505 | ||
494 | struct p_sizes { | 506 | struct p_sizes { |
495 | struct p_header head; | 507 | struct p_header80 head; |
496 | u64 d_size; /* size of disk */ | 508 | u64 d_size; /* size of disk */ |
497 | u64 u_size; /* user requested size */ | 509 | u64 u_size; /* user requested size */ |
498 | u64 c_size; /* current exported size */ | 510 | u64 c_size; /* current exported size */ |
@@ -502,18 +514,18 @@ struct p_sizes { | |||
502 | } __packed; | 514 | } __packed; |
503 | 515 | ||
504 | struct p_state { | 516 | struct p_state { |
505 | struct p_header head; | 517 | struct p_header80 head; |
506 | u32 state; | 518 | u32 state; |
507 | } __packed; | 519 | } __packed; |
508 | 520 | ||
509 | struct p_req_state { | 521 | struct p_req_state { |
510 | struct p_header head; | 522 | struct p_header80 head; |
511 | u32 mask; | 523 | u32 mask; |
512 | u32 val; | 524 | u32 val; |
513 | } __packed; | 525 | } __packed; |
514 | 526 | ||
515 | struct p_req_state_reply { | 527 | struct p_req_state_reply { |
516 | struct p_header head; | 528 | struct p_header80 head; |
517 | u32 retcode; | 529 | u32 retcode; |
518 | } __packed; | 530 | } __packed; |
519 | 531 | ||
@@ -528,7 +540,7 @@ struct p_drbd06_param { | |||
528 | } __packed; | 540 | } __packed; |
529 | 541 | ||
530 | struct p_discard { | 542 | struct p_discard { |
531 | struct p_header head; | 543 | struct p_header80 head; |
532 | u64 block_id; | 544 | u64 block_id; |
533 | u32 seq_num; | 545 | u32 seq_num; |
534 | u32 pad; | 546 | u32 pad; |
@@ -544,7 +556,7 @@ enum drbd_bitmap_code { | |||
544 | }; | 556 | }; |
545 | 557 | ||
546 | struct p_compressed_bm { | 558 | struct p_compressed_bm { |
547 | struct p_header head; | 559 | struct p_header80 head; |
548 | /* (encoding & 0x0f): actual encoding, see enum drbd_bitmap_code | 560 | /* (encoding & 0x0f): actual encoding, see enum drbd_bitmap_code |
549 | * (encoding & 0x80): polarity (set/unset) of first runlength | 561 | * (encoding & 0x80): polarity (set/unset) of first runlength |
550 | * ((encoding >> 4) & 0x07): pad_bits, number of trailing zero bits | 562 | * ((encoding >> 4) & 0x07): pad_bits, number of trailing zero bits |
@@ -555,10 +567,10 @@ struct p_compressed_bm { | |||
555 | u8 code[0]; | 567 | u8 code[0]; |
556 | } __packed; | 568 | } __packed; |
557 | 569 | ||
558 | struct p_delay_probe { | 570 | struct p_delay_probe93 { |
559 | struct p_header head; | 571 | struct p_header80 head; |
560 | u32 seq_num; /* sequence number to match the two probe packets */ | 572 | u32 seq_num; /* sequence number to match the two probe packets */ |
561 | u32 offset; /* usecs the probe got sent after the reference time point */ | 573 | u32 offset; /* usecs the probe got sent after the reference time point */ |
562 | } __packed; | 574 | } __packed; |
563 | 575 | ||
564 | /* DCBP: Drbd Compressed Bitmap Packet ... */ | 576 | /* DCBP: Drbd Compressed Bitmap Packet ... */ |
@@ -605,7 +617,7 @@ DCBP_set_pad_bits(struct p_compressed_bm *p, int n) | |||
605 | * so we need to use the fixed size 4KiB page size | 617 | * so we need to use the fixed size 4KiB page size |
606 | * most architechtures have used for a long time. | 618 | * most architechtures have used for a long time. |
607 | */ | 619 | */ |
608 | #define BM_PACKET_PAYLOAD_BYTES (4096 - sizeof(struct p_header)) | 620 | #define BM_PACKET_PAYLOAD_BYTES (4096 - sizeof(struct p_header80)) |
609 | #define BM_PACKET_WORDS (BM_PACKET_PAYLOAD_BYTES/sizeof(long)) | 621 | #define BM_PACKET_WORDS (BM_PACKET_PAYLOAD_BYTES/sizeof(long)) |
610 | #define BM_PACKET_VLI_BYTES_MAX (4096 - sizeof(struct p_compressed_bm)) | 622 | #define BM_PACKET_VLI_BYTES_MAX (4096 - sizeof(struct p_compressed_bm)) |
611 | #if (PAGE_SIZE < 4096) | 623 | #if (PAGE_SIZE < 4096) |
@@ -614,7 +626,7 @@ DCBP_set_pad_bits(struct p_compressed_bm *p, int n) | |||
614 | #endif | 626 | #endif |
615 | 627 | ||
616 | union p_polymorph { | 628 | union p_polymorph { |
617 | struct p_header header; | 629 | struct p_header80 header; |
618 | struct p_handshake handshake; | 630 | struct p_handshake handshake; |
619 | struct p_data data; | 631 | struct p_data data; |
620 | struct p_block_ack block_ack; | 632 | struct p_block_ack block_ack; |
@@ -1188,12 +1200,12 @@ extern int drbd_send_sizes(struct drbd_conf *mdev, int trigger_reply, enum dds_f | |||
1188 | extern int _drbd_send_state(struct drbd_conf *mdev); | 1200 | extern int _drbd_send_state(struct drbd_conf *mdev); |
1189 | extern int drbd_send_state(struct drbd_conf *mdev); | 1201 | extern int drbd_send_state(struct drbd_conf *mdev); |
1190 | extern int _drbd_send_cmd(struct drbd_conf *mdev, struct socket *sock, | 1202 | extern int _drbd_send_cmd(struct drbd_conf *mdev, struct socket *sock, |
1191 | enum drbd_packets cmd, struct p_header *h, | 1203 | enum drbd_packets cmd, struct p_header80 *h, |
1192 | size_t size, unsigned msg_flags); | 1204 | size_t size, unsigned msg_flags); |
1193 | #define USE_DATA_SOCKET 1 | 1205 | #define USE_DATA_SOCKET 1 |
1194 | #define USE_META_SOCKET 0 | 1206 | #define USE_META_SOCKET 0 |
1195 | extern int drbd_send_cmd(struct drbd_conf *mdev, int use_data_socket, | 1207 | extern int drbd_send_cmd(struct drbd_conf *mdev, int use_data_socket, |
1196 | enum drbd_packets cmd, struct p_header *h, | 1208 | enum drbd_packets cmd, struct p_header80 *h, |
1197 | size_t size); | 1209 | size_t size); |
1198 | extern int drbd_send_cmd2(struct drbd_conf *mdev, enum drbd_packets cmd, | 1210 | extern int drbd_send_cmd2(struct drbd_conf *mdev, enum drbd_packets cmd, |
1199 | char *data, size_t size); | 1211 | char *data, size_t size); |
@@ -1936,19 +1948,19 @@ static inline void request_ping(struct drbd_conf *mdev) | |||
1936 | static inline int drbd_send_short_cmd(struct drbd_conf *mdev, | 1948 | static inline int drbd_send_short_cmd(struct drbd_conf *mdev, |
1937 | enum drbd_packets cmd) | 1949 | enum drbd_packets cmd) |
1938 | { | 1950 | { |
1939 | struct p_header h; | 1951 | struct p_header80 h; |
1940 | return drbd_send_cmd(mdev, USE_DATA_SOCKET, cmd, &h, sizeof(h)); | 1952 | return drbd_send_cmd(mdev, USE_DATA_SOCKET, cmd, &h, sizeof(h)); |
1941 | } | 1953 | } |
1942 | 1954 | ||
1943 | static inline int drbd_send_ping(struct drbd_conf *mdev) | 1955 | static inline int drbd_send_ping(struct drbd_conf *mdev) |
1944 | { | 1956 | { |
1945 | struct p_header h; | 1957 | struct p_header80 h; |
1946 | return drbd_send_cmd(mdev, USE_META_SOCKET, P_PING, &h, sizeof(h)); | 1958 | return drbd_send_cmd(mdev, USE_META_SOCKET, P_PING, &h, sizeof(h)); |
1947 | } | 1959 | } |
1948 | 1960 | ||
1949 | static inline int drbd_send_ping_ack(struct drbd_conf *mdev) | 1961 | static inline int drbd_send_ping_ack(struct drbd_conf *mdev) |
1950 | { | 1962 | { |
1951 | struct p_header h; | 1963 | struct p_header80 h; |
1952 | return drbd_send_cmd(mdev, USE_META_SOCKET, P_PING_ACK, &h, sizeof(h)); | 1964 | return drbd_send_cmd(mdev, USE_META_SOCKET, P_PING_ACK, &h, sizeof(h)); |
1953 | } | 1965 | } |
1954 | 1966 | ||
diff --git a/drivers/block/drbd/drbd_main.c b/drivers/block/drbd/drbd_main.c index db93eee7e543..f3f4ea9c5eb9 100644 --- a/drivers/block/drbd/drbd_main.c +++ b/drivers/block/drbd/drbd_main.c | |||
@@ -1647,7 +1647,7 @@ void drbd_thread_current_set_cpu(struct drbd_conf *mdev) | |||
1647 | 1647 | ||
1648 | /* the appropriate socket mutex must be held already */ | 1648 | /* the appropriate socket mutex must be held already */ |
1649 | int _drbd_send_cmd(struct drbd_conf *mdev, struct socket *sock, | 1649 | int _drbd_send_cmd(struct drbd_conf *mdev, struct socket *sock, |
1650 | enum drbd_packets cmd, struct p_header *h, | 1650 | enum drbd_packets cmd, struct p_header80 *h, |
1651 | size_t size, unsigned msg_flags) | 1651 | size_t size, unsigned msg_flags) |
1652 | { | 1652 | { |
1653 | int sent, ok; | 1653 | int sent, ok; |
@@ -1657,7 +1657,7 @@ int _drbd_send_cmd(struct drbd_conf *mdev, struct socket *sock, | |||
1657 | 1657 | ||
1658 | h->magic = BE_DRBD_MAGIC; | 1658 | h->magic = BE_DRBD_MAGIC; |
1659 | h->command = cpu_to_be16(cmd); | 1659 | h->command = cpu_to_be16(cmd); |
1660 | h->length = cpu_to_be16(size-sizeof(struct p_header)); | 1660 | h->length = cpu_to_be16(size-sizeof(struct p_header80)); |
1661 | 1661 | ||
1662 | sent = drbd_send(mdev, sock, h, size, msg_flags); | 1662 | sent = drbd_send(mdev, sock, h, size, msg_flags); |
1663 | 1663 | ||
@@ -1672,7 +1672,7 @@ int _drbd_send_cmd(struct drbd_conf *mdev, struct socket *sock, | |||
1672 | * when we hold the appropriate socket mutex. | 1672 | * when we hold the appropriate socket mutex. |
1673 | */ | 1673 | */ |
1674 | int drbd_send_cmd(struct drbd_conf *mdev, int use_data_socket, | 1674 | int drbd_send_cmd(struct drbd_conf *mdev, int use_data_socket, |
1675 | enum drbd_packets cmd, struct p_header *h, size_t size) | 1675 | enum drbd_packets cmd, struct p_header80 *h, size_t size) |
1676 | { | 1676 | { |
1677 | int ok = 0; | 1677 | int ok = 0; |
1678 | struct socket *sock; | 1678 | struct socket *sock; |
@@ -1700,7 +1700,7 @@ int drbd_send_cmd(struct drbd_conf *mdev, int use_data_socket, | |||
1700 | int drbd_send_cmd2(struct drbd_conf *mdev, enum drbd_packets cmd, char *data, | 1700 | int drbd_send_cmd2(struct drbd_conf *mdev, enum drbd_packets cmd, char *data, |
1701 | size_t size) | 1701 | size_t size) |
1702 | { | 1702 | { |
1703 | struct p_header h; | 1703 | struct p_header80 h; |
1704 | int ok; | 1704 | int ok; |
1705 | 1705 | ||
1706 | h.magic = BE_DRBD_MAGIC; | 1706 | h.magic = BE_DRBD_MAGIC; |
@@ -1807,7 +1807,7 @@ int drbd_send_protocol(struct drbd_conf *mdev) | |||
1807 | strcpy(p->integrity_alg, mdev->net_conf->integrity_alg); | 1807 | strcpy(p->integrity_alg, mdev->net_conf->integrity_alg); |
1808 | 1808 | ||
1809 | rv = drbd_send_cmd(mdev, USE_DATA_SOCKET, P_PROTOCOL, | 1809 | rv = drbd_send_cmd(mdev, USE_DATA_SOCKET, P_PROTOCOL, |
1810 | (struct p_header *)p, size); | 1810 | (struct p_header80 *)p, size); |
1811 | kfree(p); | 1811 | kfree(p); |
1812 | return rv; | 1812 | return rv; |
1813 | } | 1813 | } |
@@ -1833,7 +1833,7 @@ int _drbd_send_uuids(struct drbd_conf *mdev, u64 uuid_flags) | |||
1833 | put_ldev(mdev); | 1833 | put_ldev(mdev); |
1834 | 1834 | ||
1835 | return drbd_send_cmd(mdev, USE_DATA_SOCKET, P_UUIDS, | 1835 | return drbd_send_cmd(mdev, USE_DATA_SOCKET, P_UUIDS, |
1836 | (struct p_header *)&p, sizeof(p)); | 1836 | (struct p_header80 *)&p, sizeof(p)); |
1837 | } | 1837 | } |
1838 | 1838 | ||
1839 | int drbd_send_uuids(struct drbd_conf *mdev) | 1839 | int drbd_send_uuids(struct drbd_conf *mdev) |
@@ -1854,7 +1854,7 @@ int drbd_send_sync_uuid(struct drbd_conf *mdev, u64 val) | |||
1854 | p.uuid = cpu_to_be64(val); | 1854 | p.uuid = cpu_to_be64(val); |
1855 | 1855 | ||
1856 | return drbd_send_cmd(mdev, USE_DATA_SOCKET, P_SYNC_UUID, | 1856 | return drbd_send_cmd(mdev, USE_DATA_SOCKET, P_SYNC_UUID, |
1857 | (struct p_header *)&p, sizeof(p)); | 1857 | (struct p_header80 *)&p, sizeof(p)); |
1858 | } | 1858 | } |
1859 | 1859 | ||
1860 | int drbd_send_sizes(struct drbd_conf *mdev, int trigger_reply, enum dds_flags flags) | 1860 | int drbd_send_sizes(struct drbd_conf *mdev, int trigger_reply, enum dds_flags flags) |
@@ -1884,7 +1884,7 @@ int drbd_send_sizes(struct drbd_conf *mdev, int trigger_reply, enum dds_flags fl | |||
1884 | p.dds_flags = cpu_to_be16(flags); | 1884 | p.dds_flags = cpu_to_be16(flags); |
1885 | 1885 | ||
1886 | ok = drbd_send_cmd(mdev, USE_DATA_SOCKET, P_SIZES, | 1886 | ok = drbd_send_cmd(mdev, USE_DATA_SOCKET, P_SIZES, |
1887 | (struct p_header *)&p, sizeof(p)); | 1887 | (struct p_header80 *)&p, sizeof(p)); |
1888 | return ok; | 1888 | return ok; |
1889 | } | 1889 | } |
1890 | 1890 | ||
@@ -1909,7 +1909,7 @@ int drbd_send_state(struct drbd_conf *mdev) | |||
1909 | 1909 | ||
1910 | if (likely(sock != NULL)) { | 1910 | if (likely(sock != NULL)) { |
1911 | ok = _drbd_send_cmd(mdev, sock, P_STATE, | 1911 | ok = _drbd_send_cmd(mdev, sock, P_STATE, |
1912 | (struct p_header *)&p, sizeof(p), 0); | 1912 | (struct p_header80 *)&p, sizeof(p), 0); |
1913 | } | 1913 | } |
1914 | 1914 | ||
1915 | mutex_unlock(&mdev->data.mutex); | 1915 | mutex_unlock(&mdev->data.mutex); |
@@ -1927,7 +1927,7 @@ int drbd_send_state_req(struct drbd_conf *mdev, | |||
1927 | p.val = cpu_to_be32(val.i); | 1927 | p.val = cpu_to_be32(val.i); |
1928 | 1928 | ||
1929 | return drbd_send_cmd(mdev, USE_DATA_SOCKET, P_STATE_CHG_REQ, | 1929 | return drbd_send_cmd(mdev, USE_DATA_SOCKET, P_STATE_CHG_REQ, |
1930 | (struct p_header *)&p, sizeof(p)); | 1930 | (struct p_header80 *)&p, sizeof(p)); |
1931 | } | 1931 | } |
1932 | 1932 | ||
1933 | int drbd_send_sr_reply(struct drbd_conf *mdev, int retcode) | 1933 | int drbd_send_sr_reply(struct drbd_conf *mdev, int retcode) |
@@ -1937,7 +1937,7 @@ int drbd_send_sr_reply(struct drbd_conf *mdev, int retcode) | |||
1937 | p.retcode = cpu_to_be32(retcode); | 1937 | p.retcode = cpu_to_be32(retcode); |
1938 | 1938 | ||
1939 | return drbd_send_cmd(mdev, USE_META_SOCKET, P_STATE_CHG_REPLY, | 1939 | return drbd_send_cmd(mdev, USE_META_SOCKET, P_STATE_CHG_REPLY, |
1940 | (struct p_header *)&p, sizeof(p)); | 1940 | (struct p_header80 *)&p, sizeof(p)); |
1941 | } | 1941 | } |
1942 | 1942 | ||
1943 | int fill_bitmap_rle_bits(struct drbd_conf *mdev, | 1943 | int fill_bitmap_rle_bits(struct drbd_conf *mdev, |
@@ -2036,7 +2036,7 @@ int fill_bitmap_rle_bits(struct drbd_conf *mdev, | |||
2036 | 2036 | ||
2037 | enum { OK, FAILED, DONE } | 2037 | enum { OK, FAILED, DONE } |
2038 | send_bitmap_rle_or_plain(struct drbd_conf *mdev, | 2038 | send_bitmap_rle_or_plain(struct drbd_conf *mdev, |
2039 | struct p_header *h, struct bm_xfer_ctx *c) | 2039 | struct p_header80 *h, struct bm_xfer_ctx *c) |
2040 | { | 2040 | { |
2041 | struct p_compressed_bm *p = (void*)h; | 2041 | struct p_compressed_bm *p = (void*)h; |
2042 | unsigned long num_words; | 2042 | unsigned long num_words; |
@@ -2066,12 +2066,12 @@ send_bitmap_rle_or_plain(struct drbd_conf *mdev, | |||
2066 | if (len) | 2066 | if (len) |
2067 | drbd_bm_get_lel(mdev, c->word_offset, num_words, (unsigned long*)h->payload); | 2067 | drbd_bm_get_lel(mdev, c->word_offset, num_words, (unsigned long*)h->payload); |
2068 | ok = _drbd_send_cmd(mdev, mdev->data.socket, P_BITMAP, | 2068 | ok = _drbd_send_cmd(mdev, mdev->data.socket, P_BITMAP, |
2069 | h, sizeof(struct p_header) + len, 0); | 2069 | h, sizeof(struct p_header80) + len, 0); |
2070 | c->word_offset += num_words; | 2070 | c->word_offset += num_words; |
2071 | c->bit_offset = c->word_offset * BITS_PER_LONG; | 2071 | c->bit_offset = c->word_offset * BITS_PER_LONG; |
2072 | 2072 | ||
2073 | c->packets[1]++; | 2073 | c->packets[1]++; |
2074 | c->bytes[1] += sizeof(struct p_header) + len; | 2074 | c->bytes[1] += sizeof(struct p_header80) + len; |
2075 | 2075 | ||
2076 | if (c->bit_offset > c->bm_bits) | 2076 | if (c->bit_offset > c->bm_bits) |
2077 | c->bit_offset = c->bm_bits; | 2077 | c->bit_offset = c->bm_bits; |
@@ -2087,14 +2087,14 @@ send_bitmap_rle_or_plain(struct drbd_conf *mdev, | |||
2087 | int _drbd_send_bitmap(struct drbd_conf *mdev) | 2087 | int _drbd_send_bitmap(struct drbd_conf *mdev) |
2088 | { | 2088 | { |
2089 | struct bm_xfer_ctx c; | 2089 | struct bm_xfer_ctx c; |
2090 | struct p_header *p; | 2090 | struct p_header80 *p; |
2091 | int ret; | 2091 | int ret; |
2092 | 2092 | ||
2093 | ERR_IF(!mdev->bitmap) return FALSE; | 2093 | ERR_IF(!mdev->bitmap) return FALSE; |
2094 | 2094 | ||
2095 | /* maybe we should use some per thread scratch page, | 2095 | /* maybe we should use some per thread scratch page, |
2096 | * and allocate that during initial device creation? */ | 2096 | * and allocate that during initial device creation? */ |
2097 | p = (struct p_header *) __get_free_page(GFP_NOIO); | 2097 | p = (struct p_header80 *) __get_free_page(GFP_NOIO); |
2098 | if (!p) { | 2098 | if (!p) { |
2099 | dev_err(DEV, "failed to allocate one page buffer in %s\n", __func__); | 2099 | dev_err(DEV, "failed to allocate one page buffer in %s\n", __func__); |
2100 | return FALSE; | 2100 | return FALSE; |
@@ -2152,7 +2152,7 @@ int drbd_send_b_ack(struct drbd_conf *mdev, u32 barrier_nr, u32 set_size) | |||
2152 | if (mdev->state.conn < C_CONNECTED) | 2152 | if (mdev->state.conn < C_CONNECTED) |
2153 | return FALSE; | 2153 | return FALSE; |
2154 | ok = drbd_send_cmd(mdev, USE_META_SOCKET, P_BARRIER_ACK, | 2154 | ok = drbd_send_cmd(mdev, USE_META_SOCKET, P_BARRIER_ACK, |
2155 | (struct p_header *)&p, sizeof(p)); | 2155 | (struct p_header80 *)&p, sizeof(p)); |
2156 | return ok; | 2156 | return ok; |
2157 | } | 2157 | } |
2158 | 2158 | ||
@@ -2180,7 +2180,7 @@ static int _drbd_send_ack(struct drbd_conf *mdev, enum drbd_packets cmd, | |||
2180 | if (!mdev->meta.socket || mdev->state.conn < C_CONNECTED) | 2180 | if (!mdev->meta.socket || mdev->state.conn < C_CONNECTED) |
2181 | return FALSE; | 2181 | return FALSE; |
2182 | ok = drbd_send_cmd(mdev, USE_META_SOCKET, cmd, | 2182 | ok = drbd_send_cmd(mdev, USE_META_SOCKET, cmd, |
2183 | (struct p_header *)&p, sizeof(p)); | 2183 | (struct p_header80 *)&p, sizeof(p)); |
2184 | return ok; | 2184 | return ok; |
2185 | } | 2185 | } |
2186 | 2186 | ||
@@ -2188,8 +2188,8 @@ int drbd_send_ack_dp(struct drbd_conf *mdev, enum drbd_packets cmd, | |||
2188 | struct p_data *dp) | 2188 | struct p_data *dp) |
2189 | { | 2189 | { |
2190 | const int header_size = sizeof(struct p_data) | 2190 | const int header_size = sizeof(struct p_data) |
2191 | - sizeof(struct p_header); | 2191 | - sizeof(struct p_header80); |
2192 | int data_size = ((struct p_header *)dp)->length - header_size; | 2192 | int data_size = ((struct p_header80 *)dp)->length - header_size; |
2193 | 2193 | ||
2194 | return _drbd_send_ack(mdev, cmd, dp->sector, cpu_to_be32(data_size), | 2194 | return _drbd_send_ack(mdev, cmd, dp->sector, cpu_to_be32(data_size), |
2195 | dp->block_id); | 2195 | dp->block_id); |
@@ -2238,7 +2238,7 @@ int drbd_send_drequest(struct drbd_conf *mdev, int cmd, | |||
2238 | p.blksize = cpu_to_be32(size); | 2238 | p.blksize = cpu_to_be32(size); |
2239 | 2239 | ||
2240 | ok = drbd_send_cmd(mdev, USE_DATA_SOCKET, cmd, | 2240 | ok = drbd_send_cmd(mdev, USE_DATA_SOCKET, cmd, |
2241 | (struct p_header *)&p, sizeof(p)); | 2241 | (struct p_header80 *)&p, sizeof(p)); |
2242 | return ok; | 2242 | return ok; |
2243 | } | 2243 | } |
2244 | 2244 | ||
@@ -2256,7 +2256,7 @@ int drbd_send_drequest_csum(struct drbd_conf *mdev, | |||
2256 | 2256 | ||
2257 | p.head.magic = BE_DRBD_MAGIC; | 2257 | p.head.magic = BE_DRBD_MAGIC; |
2258 | p.head.command = cpu_to_be16(cmd); | 2258 | p.head.command = cpu_to_be16(cmd); |
2259 | p.head.length = cpu_to_be16(sizeof(p) - sizeof(struct p_header) + digest_size); | 2259 | p.head.length = cpu_to_be16(sizeof(p) - sizeof(struct p_header80) + digest_size); |
2260 | 2260 | ||
2261 | mutex_lock(&mdev->data.mutex); | 2261 | mutex_lock(&mdev->data.mutex); |
2262 | 2262 | ||
@@ -2278,7 +2278,7 @@ int drbd_send_ov_request(struct drbd_conf *mdev, sector_t sector, int size) | |||
2278 | p.blksize = cpu_to_be32(size); | 2278 | p.blksize = cpu_to_be32(size); |
2279 | 2279 | ||
2280 | ok = drbd_send_cmd(mdev, USE_DATA_SOCKET, P_OV_REQUEST, | 2280 | ok = drbd_send_cmd(mdev, USE_DATA_SOCKET, P_OV_REQUEST, |
2281 | (struct p_header *)&p, sizeof(p)); | 2281 | (struct p_header80 *)&p, sizeof(p)); |
2282 | return ok; | 2282 | return ok; |
2283 | } | 2283 | } |
2284 | 2284 | ||
@@ -2447,10 +2447,17 @@ int drbd_send_dblock(struct drbd_conf *mdev, struct drbd_request *req) | |||
2447 | dgs = (mdev->agreed_pro_version >= 87 && mdev->integrity_w_tfm) ? | 2447 | dgs = (mdev->agreed_pro_version >= 87 && mdev->integrity_w_tfm) ? |
2448 | crypto_hash_digestsize(mdev->integrity_w_tfm) : 0; | 2448 | crypto_hash_digestsize(mdev->integrity_w_tfm) : 0; |
2449 | 2449 | ||
2450 | p.head.magic = BE_DRBD_MAGIC; | 2450 | if (req->size <= (1 << 15)) { |
2451 | p.head.command = cpu_to_be16(P_DATA); | 2451 | p.head.h80.magic = BE_DRBD_MAGIC; |
2452 | p.head.length = | 2452 | p.head.h80.command = cpu_to_be16(P_DATA); |
2453 | cpu_to_be16(sizeof(p) - sizeof(struct p_header) + dgs + req->size); | 2453 | p.head.h80.length = |
2454 | cpu_to_be16(sizeof(p) - sizeof(union p_header) + dgs + req->size); | ||
2455 | } else { | ||
2456 | p.head.h95.magic = BE_DRBD_MAGIC_BIG; | ||
2457 | p.head.h95.command = cpu_to_be16(P_DATA); | ||
2458 | p.head.h95.length = | ||
2459 | cpu_to_be32(sizeof(p) - sizeof(union p_header) + dgs + req->size); | ||
2460 | } | ||
2454 | 2461 | ||
2455 | p.sector = cpu_to_be64(req->sector); | 2462 | p.sector = cpu_to_be64(req->sector); |
2456 | p.block_id = (unsigned long)req; | 2463 | p.block_id = (unsigned long)req; |
@@ -2511,10 +2518,17 @@ int drbd_send_block(struct drbd_conf *mdev, enum drbd_packets cmd, | |||
2511 | dgs = (mdev->agreed_pro_version >= 87 && mdev->integrity_w_tfm) ? | 2518 | dgs = (mdev->agreed_pro_version >= 87 && mdev->integrity_w_tfm) ? |
2512 | crypto_hash_digestsize(mdev->integrity_w_tfm) : 0; | 2519 | crypto_hash_digestsize(mdev->integrity_w_tfm) : 0; |
2513 | 2520 | ||
2514 | p.head.magic = BE_DRBD_MAGIC; | 2521 | if (e->size <= (1 << 15)) { |
2515 | p.head.command = cpu_to_be16(cmd); | 2522 | p.head.h80.magic = BE_DRBD_MAGIC; |
2516 | p.head.length = | 2523 | p.head.h80.command = cpu_to_be16(cmd); |
2517 | cpu_to_be16(sizeof(p) - sizeof(struct p_header) + dgs + e->size); | 2524 | p.head.h80.length = |
2525 | cpu_to_be16(sizeof(p) - sizeof(struct p_header80) + dgs + e->size); | ||
2526 | } else { | ||
2527 | p.head.h95.magic = BE_DRBD_MAGIC_BIG; | ||
2528 | p.head.h95.command = cpu_to_be16(cmd); | ||
2529 | p.head.h95.length = | ||
2530 | cpu_to_be32(sizeof(p) - sizeof(struct p_header80) + dgs + e->size); | ||
2531 | } | ||
2518 | 2532 | ||
2519 | p.sector = cpu_to_be64(e->sector); | 2533 | p.sector = cpu_to_be64(e->sector); |
2520 | p.block_id = e->block_id; | 2534 | p.block_id = e->block_id; |
@@ -2527,8 +2541,7 @@ int drbd_send_block(struct drbd_conf *mdev, enum drbd_packets cmd, | |||
2527 | if (!drbd_get_data_sock(mdev)) | 2541 | if (!drbd_get_data_sock(mdev)) |
2528 | return 0; | 2542 | return 0; |
2529 | 2543 | ||
2530 | ok = sizeof(p) == drbd_send(mdev, mdev->data.socket, &p, | 2544 | ok = sizeof(p) == drbd_send(mdev, mdev->data.socket, &p, sizeof(p), dgs ? MSG_MORE : 0); |
2531 | sizeof(p), dgs ? MSG_MORE : 0); | ||
2532 | if (ok && dgs) { | 2545 | if (ok && dgs) { |
2533 | dgb = mdev->int_dig_out; | 2546 | dgb = mdev->int_dig_out; |
2534 | drbd_csum_ee(mdev, mdev->integrity_w_tfm, e, dgb); | 2547 | drbd_csum_ee(mdev, mdev->integrity_w_tfm, e, dgb); |
diff --git a/drivers/block/drbd/drbd_receiver.c b/drivers/block/drbd/drbd_receiver.c index 591a171291d9..9b3321e2c3cd 100644 --- a/drivers/block/drbd/drbd_receiver.c +++ b/drivers/block/drbd/drbd_receiver.c | |||
@@ -720,14 +720,14 @@ out: | |||
720 | static int drbd_send_fp(struct drbd_conf *mdev, | 720 | static int drbd_send_fp(struct drbd_conf *mdev, |
721 | struct socket *sock, enum drbd_packets cmd) | 721 | struct socket *sock, enum drbd_packets cmd) |
722 | { | 722 | { |
723 | struct p_header *h = (struct p_header *) &mdev->data.sbuf.header; | 723 | struct p_header80 *h = (struct p_header80 *) &mdev->data.sbuf.header; |
724 | 724 | ||
725 | return _drbd_send_cmd(mdev, sock, cmd, h, sizeof(*h), 0); | 725 | return _drbd_send_cmd(mdev, sock, cmd, h, sizeof(*h), 0); |
726 | } | 726 | } |
727 | 727 | ||
728 | static enum drbd_packets drbd_recv_fp(struct drbd_conf *mdev, struct socket *sock) | 728 | static enum drbd_packets drbd_recv_fp(struct drbd_conf *mdev, struct socket *sock) |
729 | { | 729 | { |
730 | struct p_header *h = (struct p_header *) &mdev->data.sbuf.header; | 730 | struct p_header80 *h = (struct p_header80 *) &mdev->data.sbuf.header; |
731 | int rr; | 731 | int rr; |
732 | 732 | ||
733 | rr = drbd_recv_short(mdev, sock, h, sizeof(*h), 0); | 733 | rr = drbd_recv_short(mdev, sock, h, sizeof(*h), 0); |
@@ -944,7 +944,7 @@ out_release_sockets: | |||
944 | return -1; | 944 | return -1; |
945 | } | 945 | } |
946 | 946 | ||
947 | static int drbd_recv_header(struct drbd_conf *mdev, struct p_header *h) | 947 | static int drbd_recv_header(struct drbd_conf *mdev, struct p_header80 *h) |
948 | { | 948 | { |
949 | int r; | 949 | int r; |
950 | 950 | ||
@@ -1266,7 +1266,7 @@ int w_e_reissue(struct drbd_conf *mdev, struct drbd_work *w, int cancel) __relea | |||
1266 | return 1; | 1266 | return 1; |
1267 | } | 1267 | } |
1268 | 1268 | ||
1269 | static int receive_Barrier(struct drbd_conf *mdev, struct p_header *h) | 1269 | static int receive_Barrier(struct drbd_conf *mdev, struct p_header80 *h) |
1270 | { | 1270 | { |
1271 | int rv, issue_flush; | 1271 | int rv, issue_flush; |
1272 | struct p_barrier *p = (struct p_barrier *)h; | 1272 | struct p_barrier *p = (struct p_barrier *)h; |
@@ -1570,7 +1570,7 @@ fail: | |||
1570 | return FALSE; | 1570 | return FALSE; |
1571 | } | 1571 | } |
1572 | 1572 | ||
1573 | static int receive_DataReply(struct drbd_conf *mdev, struct p_header *h) | 1573 | static int receive_DataReply(struct drbd_conf *mdev, struct p_header80 *h) |
1574 | { | 1574 | { |
1575 | struct drbd_request *req; | 1575 | struct drbd_request *req; |
1576 | sector_t sector; | 1576 | sector_t sector; |
@@ -1610,7 +1610,7 @@ static int receive_DataReply(struct drbd_conf *mdev, struct p_header *h) | |||
1610 | return ok; | 1610 | return ok; |
1611 | } | 1611 | } |
1612 | 1612 | ||
1613 | static int receive_RSDataReply(struct drbd_conf *mdev, struct p_header *h) | 1613 | static int receive_RSDataReply(struct drbd_conf *mdev, struct p_header80 *h) |
1614 | { | 1614 | { |
1615 | sector_t sector; | 1615 | sector_t sector; |
1616 | unsigned int header_size, data_size; | 1616 | unsigned int header_size, data_size; |
@@ -1767,7 +1767,7 @@ static int drbd_wait_peer_seq(struct drbd_conf *mdev, const u32 packet_seq) | |||
1767 | } | 1767 | } |
1768 | 1768 | ||
1769 | /* mirrored write */ | 1769 | /* mirrored write */ |
1770 | static int receive_Data(struct drbd_conf *mdev, struct p_header *h) | 1770 | static int receive_Data(struct drbd_conf *mdev, struct p_header80 *h) |
1771 | { | 1771 | { |
1772 | sector_t sector; | 1772 | sector_t sector; |
1773 | struct drbd_epoch_entry *e; | 1773 | struct drbd_epoch_entry *e; |
@@ -2066,7 +2066,7 @@ int drbd_rs_should_slow_down(struct drbd_conf *mdev) | |||
2066 | } | 2066 | } |
2067 | 2067 | ||
2068 | 2068 | ||
2069 | static int receive_DataRequest(struct drbd_conf *mdev, struct p_header *h) | 2069 | static int receive_DataRequest(struct drbd_conf *mdev, struct p_header80 *h) |
2070 | { | 2070 | { |
2071 | sector_t sector; | 2071 | sector_t sector; |
2072 | const sector_t capacity = drbd_get_capacity(mdev->this_bdev); | 2072 | const sector_t capacity = drbd_get_capacity(mdev->this_bdev); |
@@ -2756,7 +2756,7 @@ static int cmp_after_sb(enum drbd_after_sb_p peer, enum drbd_after_sb_p self) | |||
2756 | return 1; | 2756 | return 1; |
2757 | } | 2757 | } |
2758 | 2758 | ||
2759 | static int receive_protocol(struct drbd_conf *mdev, struct p_header *h) | 2759 | static int receive_protocol(struct drbd_conf *mdev, struct p_header80 *h) |
2760 | { | 2760 | { |
2761 | struct p_protocol *p = (struct p_protocol *)h; | 2761 | struct p_protocol *p = (struct p_protocol *)h; |
2762 | int header_size, data_size; | 2762 | int header_size, data_size; |
@@ -2862,7 +2862,7 @@ struct crypto_hash *drbd_crypto_alloc_digest_safe(const struct drbd_conf *mdev, | |||
2862 | return tfm; | 2862 | return tfm; |
2863 | } | 2863 | } |
2864 | 2864 | ||
2865 | static int receive_SyncParam(struct drbd_conf *mdev, struct p_header *h) | 2865 | static int receive_SyncParam(struct drbd_conf *mdev, struct p_header80 *h) |
2866 | { | 2866 | { |
2867 | int ok = TRUE; | 2867 | int ok = TRUE; |
2868 | struct p_rs_param_95 *p = (struct p_rs_param_95 *)h; | 2868 | struct p_rs_param_95 *p = (struct p_rs_param_95 *)h; |
@@ -3032,7 +3032,7 @@ static void warn_if_differ_considerably(struct drbd_conf *mdev, | |||
3032 | (unsigned long long)a, (unsigned long long)b); | 3032 | (unsigned long long)a, (unsigned long long)b); |
3033 | } | 3033 | } |
3034 | 3034 | ||
3035 | static int receive_sizes(struct drbd_conf *mdev, struct p_header *h) | 3035 | static int receive_sizes(struct drbd_conf *mdev, struct p_header80 *h) |
3036 | { | 3036 | { |
3037 | struct p_sizes *p = (struct p_sizes *)h; | 3037 | struct p_sizes *p = (struct p_sizes *)h; |
3038 | enum determine_dev_size dd = unchanged; | 3038 | enum determine_dev_size dd = unchanged; |
@@ -3148,7 +3148,7 @@ static int receive_sizes(struct drbd_conf *mdev, struct p_header *h) | |||
3148 | return TRUE; | 3148 | return TRUE; |
3149 | } | 3149 | } |
3150 | 3150 | ||
3151 | static int receive_uuids(struct drbd_conf *mdev, struct p_header *h) | 3151 | static int receive_uuids(struct drbd_conf *mdev, struct p_header80 *h) |
3152 | { | 3152 | { |
3153 | struct p_uuids *p = (struct p_uuids *)h; | 3153 | struct p_uuids *p = (struct p_uuids *)h; |
3154 | u64 *p_uuid; | 3154 | u64 *p_uuid; |
@@ -3241,7 +3241,7 @@ static union drbd_state convert_state(union drbd_state ps) | |||
3241 | return ms; | 3241 | return ms; |
3242 | } | 3242 | } |
3243 | 3243 | ||
3244 | static int receive_req_state(struct drbd_conf *mdev, struct p_header *h) | 3244 | static int receive_req_state(struct drbd_conf *mdev, struct p_header80 *h) |
3245 | { | 3245 | { |
3246 | struct p_req_state *p = (struct p_req_state *)h; | 3246 | struct p_req_state *p = (struct p_req_state *)h; |
3247 | union drbd_state mask, val; | 3247 | union drbd_state mask, val; |
@@ -3271,7 +3271,7 @@ static int receive_req_state(struct drbd_conf *mdev, struct p_header *h) | |||
3271 | return TRUE; | 3271 | return TRUE; |
3272 | } | 3272 | } |
3273 | 3273 | ||
3274 | static int receive_state(struct drbd_conf *mdev, struct p_header *h) | 3274 | static int receive_state(struct drbd_conf *mdev, struct p_header80 *h) |
3275 | { | 3275 | { |
3276 | struct p_state *p = (struct p_state *)h; | 3276 | struct p_state *p = (struct p_state *)h; |
3277 | enum drbd_conns nconn, oconn; | 3277 | enum drbd_conns nconn, oconn; |
@@ -3395,7 +3395,7 @@ static int receive_state(struct drbd_conf *mdev, struct p_header *h) | |||
3395 | return TRUE; | 3395 | return TRUE; |
3396 | } | 3396 | } |
3397 | 3397 | ||
3398 | static int receive_sync_uuid(struct drbd_conf *mdev, struct p_header *h) | 3398 | static int receive_sync_uuid(struct drbd_conf *mdev, struct p_header80 *h) |
3399 | { | 3399 | { |
3400 | struct p_rs_uuid *p = (struct p_rs_uuid *)h; | 3400 | struct p_rs_uuid *p = (struct p_rs_uuid *)h; |
3401 | 3401 | ||
@@ -3428,7 +3428,7 @@ static int receive_sync_uuid(struct drbd_conf *mdev, struct p_header *h) | |||
3428 | enum receive_bitmap_ret { OK, DONE, FAILED }; | 3428 | enum receive_bitmap_ret { OK, DONE, FAILED }; |
3429 | 3429 | ||
3430 | static enum receive_bitmap_ret | 3430 | static enum receive_bitmap_ret |
3431 | receive_bitmap_plain(struct drbd_conf *mdev, struct p_header *h, | 3431 | receive_bitmap_plain(struct drbd_conf *mdev, struct p_header80 *h, |
3432 | unsigned long *buffer, struct bm_xfer_ctx *c) | 3432 | unsigned long *buffer, struct bm_xfer_ctx *c) |
3433 | { | 3433 | { |
3434 | unsigned num_words = min_t(size_t, BM_PACKET_WORDS, c->bm_words - c->word_offset); | 3434 | unsigned num_words = min_t(size_t, BM_PACKET_WORDS, c->bm_words - c->word_offset); |
@@ -3533,7 +3533,7 @@ void INFO_bm_xfer_stats(struct drbd_conf *mdev, | |||
3533 | const char *direction, struct bm_xfer_ctx *c) | 3533 | const char *direction, struct bm_xfer_ctx *c) |
3534 | { | 3534 | { |
3535 | /* what would it take to transfer it "plaintext" */ | 3535 | /* what would it take to transfer it "plaintext" */ |
3536 | unsigned plain = sizeof(struct p_header) * | 3536 | unsigned plain = sizeof(struct p_header80) * |
3537 | ((c->bm_words+BM_PACKET_WORDS-1)/BM_PACKET_WORDS+1) | 3537 | ((c->bm_words+BM_PACKET_WORDS-1)/BM_PACKET_WORDS+1) |
3538 | + c->bm_words * sizeof(long); | 3538 | + c->bm_words * sizeof(long); |
3539 | unsigned total = c->bytes[0] + c->bytes[1]; | 3539 | unsigned total = c->bytes[0] + c->bytes[1]; |
@@ -3571,7 +3571,7 @@ void INFO_bm_xfer_stats(struct drbd_conf *mdev, | |||
3571 | in order to be agnostic to the 32 vs 64 bits issue. | 3571 | in order to be agnostic to the 32 vs 64 bits issue. |
3572 | 3572 | ||
3573 | returns 0 on failure, 1 if we successfully received it. */ | 3573 | returns 0 on failure, 1 if we successfully received it. */ |
3574 | static int receive_bitmap(struct drbd_conf *mdev, struct p_header *h) | 3574 | static int receive_bitmap(struct drbd_conf *mdev, struct p_header80 *h) |
3575 | { | 3575 | { |
3576 | struct bm_xfer_ctx c; | 3576 | struct bm_xfer_ctx c; |
3577 | void *buffer; | 3577 | void *buffer; |
@@ -3623,7 +3623,7 @@ static int receive_bitmap(struct drbd_conf *mdev, struct p_header *h) | |||
3623 | } | 3623 | } |
3624 | 3624 | ||
3625 | c.packets[h->command == P_BITMAP]++; | 3625 | c.packets[h->command == P_BITMAP]++; |
3626 | c.bytes[h->command == P_BITMAP] += sizeof(struct p_header) + h->length; | 3626 | c.bytes[h->command == P_BITMAP] += sizeof(struct p_header80) + h->length; |
3627 | 3627 | ||
3628 | if (ret != OK) | 3628 | if (ret != OK) |
3629 | break; | 3629 | break; |
@@ -3659,7 +3659,7 @@ static int receive_bitmap(struct drbd_conf *mdev, struct p_header *h) | |||
3659 | return ok; | 3659 | return ok; |
3660 | } | 3660 | } |
3661 | 3661 | ||
3662 | static int receive_skip_(struct drbd_conf *mdev, struct p_header *h, int silent) | 3662 | static int receive_skip_(struct drbd_conf *mdev, struct p_header80 *h, int silent) |
3663 | { | 3663 | { |
3664 | /* TODO zero copy sink :) */ | 3664 | /* TODO zero copy sink :) */ |
3665 | static char sink[128]; | 3665 | static char sink[128]; |
@@ -3679,17 +3679,17 @@ static int receive_skip_(struct drbd_conf *mdev, struct p_header *h, int silent) | |||
3679 | return size == 0; | 3679 | return size == 0; |
3680 | } | 3680 | } |
3681 | 3681 | ||
3682 | static int receive_skip(struct drbd_conf *mdev, struct p_header *h) | 3682 | static int receive_skip(struct drbd_conf *mdev, struct p_header80 *h) |
3683 | { | 3683 | { |
3684 | return receive_skip_(mdev, h, 0); | 3684 | return receive_skip_(mdev, h, 0); |
3685 | } | 3685 | } |
3686 | 3686 | ||
3687 | static int receive_skip_silent(struct drbd_conf *mdev, struct p_header *h) | 3687 | static int receive_skip_silent(struct drbd_conf *mdev, struct p_header80 *h) |
3688 | { | 3688 | { |
3689 | return receive_skip_(mdev, h, 1); | 3689 | return receive_skip_(mdev, h, 1); |
3690 | } | 3690 | } |
3691 | 3691 | ||
3692 | static int receive_UnplugRemote(struct drbd_conf *mdev, struct p_header *h) | 3692 | static int receive_UnplugRemote(struct drbd_conf *mdev, struct p_header80 *h) |
3693 | { | 3693 | { |
3694 | if (mdev->state.disk >= D_INCONSISTENT) | 3694 | if (mdev->state.disk >= D_INCONSISTENT) |
3695 | drbd_kick_lo(mdev); | 3695 | drbd_kick_lo(mdev); |
@@ -3701,7 +3701,7 @@ static int receive_UnplugRemote(struct drbd_conf *mdev, struct p_header *h) | |||
3701 | return TRUE; | 3701 | return TRUE; |
3702 | } | 3702 | } |
3703 | 3703 | ||
3704 | typedef int (*drbd_cmd_handler_f)(struct drbd_conf *, struct p_header *); | 3704 | typedef int (*drbd_cmd_handler_f)(struct drbd_conf *, struct p_header80 *); |
3705 | 3705 | ||
3706 | static drbd_cmd_handler_f drbd_default_handler[] = { | 3706 | static drbd_cmd_handler_f drbd_default_handler[] = { |
3707 | [P_DATA] = receive_Data, | 3707 | [P_DATA] = receive_Data, |
@@ -3736,7 +3736,7 @@ static drbd_cmd_handler_f *drbd_opt_cmd_handler; | |||
3736 | static void drbdd(struct drbd_conf *mdev) | 3736 | static void drbdd(struct drbd_conf *mdev) |
3737 | { | 3737 | { |
3738 | drbd_cmd_handler_f handler; | 3738 | drbd_cmd_handler_f handler; |
3739 | struct p_header *header = &mdev->data.rbuf.header; | 3739 | struct p_header80 *header = &mdev->data.rbuf.header; |
3740 | 3740 | ||
3741 | while (get_t_state(&mdev->receiver) == Running) { | 3741 | while (get_t_state(&mdev->receiver) == Running) { |
3742 | drbd_thread_current_set_cpu(mdev); | 3742 | drbd_thread_current_set_cpu(mdev); |
@@ -3964,7 +3964,7 @@ static int drbd_send_handshake(struct drbd_conf *mdev) | |||
3964 | p->protocol_min = cpu_to_be32(PRO_VERSION_MIN); | 3964 | p->protocol_min = cpu_to_be32(PRO_VERSION_MIN); |
3965 | p->protocol_max = cpu_to_be32(PRO_VERSION_MAX); | 3965 | p->protocol_max = cpu_to_be32(PRO_VERSION_MAX); |
3966 | ok = _drbd_send_cmd( mdev, mdev->data.socket, P_HAND_SHAKE, | 3966 | ok = _drbd_send_cmd( mdev, mdev->data.socket, P_HAND_SHAKE, |
3967 | (struct p_header *)p, sizeof(*p), 0 ); | 3967 | (struct p_header80 *)p, sizeof(*p), 0 ); |
3968 | mutex_unlock(&mdev->data.mutex); | 3968 | mutex_unlock(&mdev->data.mutex); |
3969 | return ok; | 3969 | return ok; |
3970 | } | 3970 | } |
@@ -3981,7 +3981,7 @@ static int drbd_do_handshake(struct drbd_conf *mdev) | |||
3981 | /* ASSERT current == mdev->receiver ... */ | 3981 | /* ASSERT current == mdev->receiver ... */ |
3982 | struct p_handshake *p = &mdev->data.rbuf.handshake; | 3982 | struct p_handshake *p = &mdev->data.rbuf.handshake; |
3983 | const int expect = sizeof(struct p_handshake) | 3983 | const int expect = sizeof(struct p_handshake) |
3984 | -sizeof(struct p_header); | 3984 | -sizeof(struct p_header80); |
3985 | int rv; | 3985 | int rv; |
3986 | 3986 | ||
3987 | rv = drbd_send_handshake(mdev); | 3987 | rv = drbd_send_handshake(mdev); |
@@ -4058,7 +4058,7 @@ static int drbd_do_auth(struct drbd_conf *mdev) | |||
4058 | char *response = NULL; | 4058 | char *response = NULL; |
4059 | char *right_response = NULL; | 4059 | char *right_response = NULL; |
4060 | char *peers_ch = NULL; | 4060 | char *peers_ch = NULL; |
4061 | struct p_header p; | 4061 | struct p_header80 p; |
4062 | unsigned int key_len = strlen(mdev->net_conf->shared_secret); | 4062 | unsigned int key_len = strlen(mdev->net_conf->shared_secret); |
4063 | unsigned int resp_size; | 4063 | unsigned int resp_size; |
4064 | struct hash_desc desc; | 4064 | struct hash_desc desc; |
@@ -4231,7 +4231,7 @@ int drbdd_init(struct drbd_thread *thi) | |||
4231 | 4231 | ||
4232 | /* ********* acknowledge sender ******** */ | 4232 | /* ********* acknowledge sender ******** */ |
4233 | 4233 | ||
4234 | static int got_RqSReply(struct drbd_conf *mdev, struct p_header *h) | 4234 | static int got_RqSReply(struct drbd_conf *mdev, struct p_header80 *h) |
4235 | { | 4235 | { |
4236 | struct p_req_state_reply *p = (struct p_req_state_reply *)h; | 4236 | struct p_req_state_reply *p = (struct p_req_state_reply *)h; |
4237 | 4237 | ||
@@ -4249,13 +4249,13 @@ static int got_RqSReply(struct drbd_conf *mdev, struct p_header *h) | |||
4249 | return TRUE; | 4249 | return TRUE; |
4250 | } | 4250 | } |
4251 | 4251 | ||
4252 | static int got_Ping(struct drbd_conf *mdev, struct p_header *h) | 4252 | static int got_Ping(struct drbd_conf *mdev, struct p_header80 *h) |
4253 | { | 4253 | { |
4254 | return drbd_send_ping_ack(mdev); | 4254 | return drbd_send_ping_ack(mdev); |
4255 | 4255 | ||
4256 | } | 4256 | } |
4257 | 4257 | ||
4258 | static int got_PingAck(struct drbd_conf *mdev, struct p_header *h) | 4258 | static int got_PingAck(struct drbd_conf *mdev, struct p_header80 *h) |
4259 | { | 4259 | { |
4260 | /* restore idle timeout */ | 4260 | /* restore idle timeout */ |
4261 | mdev->meta.socket->sk->sk_rcvtimeo = mdev->net_conf->ping_int*HZ; | 4261 | mdev->meta.socket->sk->sk_rcvtimeo = mdev->net_conf->ping_int*HZ; |
@@ -4265,7 +4265,7 @@ static int got_PingAck(struct drbd_conf *mdev, struct p_header *h) | |||
4265 | return TRUE; | 4265 | return TRUE; |
4266 | } | 4266 | } |
4267 | 4267 | ||
4268 | static int got_IsInSync(struct drbd_conf *mdev, struct p_header *h) | 4268 | static int got_IsInSync(struct drbd_conf *mdev, struct p_header80 *h) |
4269 | { | 4269 | { |
4270 | struct p_block_ack *p = (struct p_block_ack *)h; | 4270 | struct p_block_ack *p = (struct p_block_ack *)h; |
4271 | sector_t sector = be64_to_cpu(p->sector); | 4271 | sector_t sector = be64_to_cpu(p->sector); |
@@ -4336,7 +4336,7 @@ static int validate_req_change_req_state(struct drbd_conf *mdev, | |||
4336 | return TRUE; | 4336 | return TRUE; |
4337 | } | 4337 | } |
4338 | 4338 | ||
4339 | static int got_BlockAck(struct drbd_conf *mdev, struct p_header *h) | 4339 | static int got_BlockAck(struct drbd_conf *mdev, struct p_header80 *h) |
4340 | { | 4340 | { |
4341 | struct p_block_ack *p = (struct p_block_ack *)h; | 4341 | struct p_block_ack *p = (struct p_block_ack *)h; |
4342 | sector_t sector = be64_to_cpu(p->sector); | 4342 | sector_t sector = be64_to_cpu(p->sector); |
@@ -4376,7 +4376,7 @@ static int got_BlockAck(struct drbd_conf *mdev, struct p_header *h) | |||
4376 | _ack_id_to_req, __func__ , what); | 4376 | _ack_id_to_req, __func__ , what); |
4377 | } | 4377 | } |
4378 | 4378 | ||
4379 | static int got_NegAck(struct drbd_conf *mdev, struct p_header *h) | 4379 | static int got_NegAck(struct drbd_conf *mdev, struct p_header80 *h) |
4380 | { | 4380 | { |
4381 | struct p_block_ack *p = (struct p_block_ack *)h; | 4381 | struct p_block_ack *p = (struct p_block_ack *)h; |
4382 | sector_t sector = be64_to_cpu(p->sector); | 4382 | sector_t sector = be64_to_cpu(p->sector); |
@@ -4396,7 +4396,7 @@ static int got_NegAck(struct drbd_conf *mdev, struct p_header *h) | |||
4396 | _ack_id_to_req, __func__ , neg_acked); | 4396 | _ack_id_to_req, __func__ , neg_acked); |
4397 | } | 4397 | } |
4398 | 4398 | ||
4399 | static int got_NegDReply(struct drbd_conf *mdev, struct p_header *h) | 4399 | static int got_NegDReply(struct drbd_conf *mdev, struct p_header80 *h) |
4400 | { | 4400 | { |
4401 | struct p_block_ack *p = (struct p_block_ack *)h; | 4401 | struct p_block_ack *p = (struct p_block_ack *)h; |
4402 | sector_t sector = be64_to_cpu(p->sector); | 4402 | sector_t sector = be64_to_cpu(p->sector); |
@@ -4409,7 +4409,7 @@ static int got_NegDReply(struct drbd_conf *mdev, struct p_header *h) | |||
4409 | _ar_id_to_req, __func__ , neg_acked); | 4409 | _ar_id_to_req, __func__ , neg_acked); |
4410 | } | 4410 | } |
4411 | 4411 | ||
4412 | static int got_NegRSDReply(struct drbd_conf *mdev, struct p_header *h) | 4412 | static int got_NegRSDReply(struct drbd_conf *mdev, struct p_header80 *h) |
4413 | { | 4413 | { |
4414 | sector_t sector; | 4414 | sector_t sector; |
4415 | int size; | 4415 | int size; |
@@ -4431,7 +4431,7 @@ static int got_NegRSDReply(struct drbd_conf *mdev, struct p_header *h) | |||
4431 | return TRUE; | 4431 | return TRUE; |
4432 | } | 4432 | } |
4433 | 4433 | ||
4434 | static int got_BarrierAck(struct drbd_conf *mdev, struct p_header *h) | 4434 | static int got_BarrierAck(struct drbd_conf *mdev, struct p_header80 *h) |
4435 | { | 4435 | { |
4436 | struct p_barrier_ack *p = (struct p_barrier_ack *)h; | 4436 | struct p_barrier_ack *p = (struct p_barrier_ack *)h; |
4437 | 4437 | ||
@@ -4440,7 +4440,7 @@ static int got_BarrierAck(struct drbd_conf *mdev, struct p_header *h) | |||
4440 | return TRUE; | 4440 | return TRUE; |
4441 | } | 4441 | } |
4442 | 4442 | ||
4443 | static int got_OVResult(struct drbd_conf *mdev, struct p_header *h) | 4443 | static int got_OVResult(struct drbd_conf *mdev, struct p_header80 *h) |
4444 | { | 4444 | { |
4445 | struct p_block_ack *p = (struct p_block_ack *)h; | 4445 | struct p_block_ack *p = (struct p_block_ack *)h; |
4446 | struct drbd_work *w; | 4446 | struct drbd_work *w; |
@@ -4474,7 +4474,7 @@ static int got_OVResult(struct drbd_conf *mdev, struct p_header *h) | |||
4474 | return TRUE; | 4474 | return TRUE; |
4475 | } | 4475 | } |
4476 | 4476 | ||
4477 | static int got_something_to_ignore_m(struct drbd_conf *mdev, struct p_header *h) | 4477 | static int got_something_to_ignore_m(struct drbd_conf *mdev, struct p_header80 *h) |
4478 | { | 4478 | { |
4479 | /* IGNORE */ | 4479 | /* IGNORE */ |
4480 | return TRUE; | 4480 | return TRUE; |
@@ -4482,7 +4482,7 @@ static int got_something_to_ignore_m(struct drbd_conf *mdev, struct p_header *h) | |||
4482 | 4482 | ||
4483 | struct asender_cmd { | 4483 | struct asender_cmd { |
4484 | size_t pkt_size; | 4484 | size_t pkt_size; |
4485 | int (*process)(struct drbd_conf *mdev, struct p_header *h); | 4485 | int (*process)(struct drbd_conf *mdev, struct p_header80 *h); |
4486 | }; | 4486 | }; |
4487 | 4487 | ||
4488 | static struct asender_cmd *get_asender_cmd(int cmd) | 4488 | static struct asender_cmd *get_asender_cmd(int cmd) |
@@ -4491,8 +4491,8 @@ static struct asender_cmd *get_asender_cmd(int cmd) | |||
4491 | /* anything missing from this table is in | 4491 | /* anything missing from this table is in |
4492 | * the drbd_cmd_handler (drbd_default_handler) table, | 4492 | * the drbd_cmd_handler (drbd_default_handler) table, |
4493 | * see the beginning of drbdd() */ | 4493 | * see the beginning of drbdd() */ |
4494 | [P_PING] = { sizeof(struct p_header), got_Ping }, | 4494 | [P_PING] = { sizeof(struct p_header80), got_Ping }, |
4495 | [P_PING_ACK] = { sizeof(struct p_header), got_PingAck }, | 4495 | [P_PING_ACK] = { sizeof(struct p_header80), got_PingAck }, |
4496 | [P_RECV_ACK] = { sizeof(struct p_block_ack), got_BlockAck }, | 4496 | [P_RECV_ACK] = { sizeof(struct p_block_ack), got_BlockAck }, |
4497 | [P_WRITE_ACK] = { sizeof(struct p_block_ack), got_BlockAck }, | 4497 | [P_WRITE_ACK] = { sizeof(struct p_block_ack), got_BlockAck }, |
4498 | [P_RS_WRITE_ACK] = { sizeof(struct p_block_ack), got_BlockAck }, | 4498 | [P_RS_WRITE_ACK] = { sizeof(struct p_block_ack), got_BlockAck }, |
@@ -4504,7 +4504,7 @@ static struct asender_cmd *get_asender_cmd(int cmd) | |||
4504 | [P_BARRIER_ACK] = { sizeof(struct p_barrier_ack), got_BarrierAck }, | 4504 | [P_BARRIER_ACK] = { sizeof(struct p_barrier_ack), got_BarrierAck }, |
4505 | [P_STATE_CHG_REPLY] = { sizeof(struct p_req_state_reply), got_RqSReply }, | 4505 | [P_STATE_CHG_REPLY] = { sizeof(struct p_req_state_reply), got_RqSReply }, |
4506 | [P_RS_IS_IN_SYNC] = { sizeof(struct p_block_ack), got_IsInSync }, | 4506 | [P_RS_IS_IN_SYNC] = { sizeof(struct p_block_ack), got_IsInSync }, |
4507 | [P_DELAY_PROBE] = { sizeof(struct p_delay_probe), got_something_to_ignore_m }, | 4507 | [P_DELAY_PROBE] = { sizeof(struct p_delay_probe93), got_something_to_ignore_m }, |
4508 | [P_MAX_CMD] = { 0, NULL }, | 4508 | [P_MAX_CMD] = { 0, NULL }, |
4509 | }; | 4509 | }; |
4510 | if (cmd > P_MAX_CMD || asender_tbl[cmd].process == NULL) | 4510 | if (cmd > P_MAX_CMD || asender_tbl[cmd].process == NULL) |
@@ -4515,13 +4515,13 @@ static struct asender_cmd *get_asender_cmd(int cmd) | |||
4515 | int drbd_asender(struct drbd_thread *thi) | 4515 | int drbd_asender(struct drbd_thread *thi) |
4516 | { | 4516 | { |
4517 | struct drbd_conf *mdev = thi->mdev; | 4517 | struct drbd_conf *mdev = thi->mdev; |
4518 | struct p_header *h = &mdev->meta.rbuf.header; | 4518 | struct p_header80 *h = &mdev->meta.rbuf.header; |
4519 | struct asender_cmd *cmd = NULL; | 4519 | struct asender_cmd *cmd = NULL; |
4520 | 4520 | ||
4521 | int rv, len; | 4521 | int rv, len; |
4522 | void *buf = h; | 4522 | void *buf = h; |
4523 | int received = 0; | 4523 | int received = 0; |
4524 | int expect = sizeof(struct p_header); | 4524 | int expect = sizeof(struct p_header80); |
4525 | int empty; | 4525 | int empty; |
4526 | 4526 | ||
4527 | sprintf(current->comm, "drbd%d_asender", mdev_to_minor(mdev)); | 4527 | sprintf(current->comm, "drbd%d_asender", mdev_to_minor(mdev)); |
@@ -4621,7 +4621,7 @@ int drbd_asender(struct drbd_thread *thi) | |||
4621 | goto disconnect; | 4621 | goto disconnect; |
4622 | } | 4622 | } |
4623 | expect = cmd->pkt_size; | 4623 | expect = cmd->pkt_size; |
4624 | ERR_IF(len != expect-sizeof(struct p_header)) | 4624 | ERR_IF(len != expect-sizeof(struct p_header80)) |
4625 | goto reconnect; | 4625 | goto reconnect; |
4626 | } | 4626 | } |
4627 | if (received == expect) { | 4627 | if (received == expect) { |
@@ -4631,7 +4631,7 @@ int drbd_asender(struct drbd_thread *thi) | |||
4631 | 4631 | ||
4632 | buf = h; | 4632 | buf = h; |
4633 | received = 0; | 4633 | received = 0; |
4634 | expect = sizeof(struct p_header); | 4634 | expect = sizeof(struct p_header80); |
4635 | cmd = NULL; | 4635 | cmd = NULL; |
4636 | } | 4636 | } |
4637 | } | 4637 | } |
diff --git a/drivers/block/drbd/drbd_worker.c b/drivers/block/drbd/drbd_worker.c index 1eeb55423b3e..3d0e14e3ade3 100644 --- a/drivers/block/drbd/drbd_worker.c +++ b/drivers/block/drbd/drbd_worker.c | |||
@@ -1204,7 +1204,7 @@ int w_send_barrier(struct drbd_conf *mdev, struct drbd_work *w, int cancel) | |||
1204 | * dec_ap_pending will be done in got_BarrierAck | 1204 | * dec_ap_pending will be done in got_BarrierAck |
1205 | * or (on connection loss) in w_clear_epoch. */ | 1205 | * or (on connection loss) in w_clear_epoch. */ |
1206 | ok = _drbd_send_cmd(mdev, mdev->data.socket, P_BARRIER, | 1206 | ok = _drbd_send_cmd(mdev, mdev->data.socket, P_BARRIER, |
1207 | (struct p_header *)p, sizeof(*p), 0); | 1207 | (struct p_header80 *)p, sizeof(*p), 0); |
1208 | drbd_put_data_sock(mdev); | 1208 | drbd_put_data_sock(mdev); |
1209 | 1209 | ||
1210 | return ok; | 1210 | return ok; |