diff options
author | Philipp Reisner <philipp.reisner@linbit.com> | 2011-01-19 10:13:06 -0500 |
---|---|---|
committer | Philipp Reisner <philipp.reisner@linbit.com> | 2011-08-29 05:30:25 -0400 |
commit | c6d25cfe52a32232e4de0bbe6ddf8219f054f55c (patch) | |
tree | e8f2b7a1bedbc9e54b022d7fdbff33d2c3eae023 /drivers/block/drbd/drbd_receiver.c | |
parent | 191d3cc8d9291bbfea66f3debf19d6c2f85b4752 (diff) |
drbd: Preparing to use p_header96 for all packets
recv_bm_rle_bits() should not make any assumptions abou the layout
of the packet header
Signed-off-by: Philipp Reisner <philipp.reisner@linbit.com>
Signed-off-by: Lars Ellenberg <lars.ellenberg@linbit.com>
Diffstat (limited to 'drivers/block/drbd/drbd_receiver.c')
-rw-r--r-- | drivers/block/drbd/drbd_receiver.c | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/drivers/block/drbd/drbd_receiver.c b/drivers/block/drbd/drbd_receiver.c index fbf93826ef0e..12fdd737cb69 100644 --- a/drivers/block/drbd/drbd_receiver.c +++ b/drivers/block/drbd/drbd_receiver.c | |||
@@ -3393,7 +3393,8 @@ receive_bitmap_plain(struct drbd_conf *mdev, unsigned int data_size, | |||
3393 | static int | 3393 | static int |
3394 | recv_bm_rle_bits(struct drbd_conf *mdev, | 3394 | recv_bm_rle_bits(struct drbd_conf *mdev, |
3395 | struct p_compressed_bm *p, | 3395 | struct p_compressed_bm *p, |
3396 | struct bm_xfer_ctx *c) | 3396 | struct bm_xfer_ctx *c, |
3397 | unsigned int len) | ||
3397 | { | 3398 | { |
3398 | struct bitstream bs; | 3399 | struct bitstream bs; |
3399 | u64 look_ahead; | 3400 | u64 look_ahead; |
@@ -3401,7 +3402,6 @@ recv_bm_rle_bits(struct drbd_conf *mdev, | |||
3401 | u64 tmp; | 3402 | u64 tmp; |
3402 | unsigned long s = c->bit_offset; | 3403 | unsigned long s = c->bit_offset; |
3403 | unsigned long e; | 3404 | unsigned long e; |
3404 | int len = be16_to_cpu(p->head.length) - (sizeof(*p) - sizeof(p->head)); | ||
3405 | int toggle = DCBP_get_start(p); | 3405 | int toggle = DCBP_get_start(p); |
3406 | int have; | 3406 | int have; |
3407 | int bits; | 3407 | int bits; |
@@ -3458,10 +3458,11 @@ recv_bm_rle_bits(struct drbd_conf *mdev, | |||
3458 | static int | 3458 | static int |
3459 | decode_bitmap_c(struct drbd_conf *mdev, | 3459 | decode_bitmap_c(struct drbd_conf *mdev, |
3460 | struct p_compressed_bm *p, | 3460 | struct p_compressed_bm *p, |
3461 | struct bm_xfer_ctx *c) | 3461 | struct bm_xfer_ctx *c, |
3462 | unsigned int len) | ||
3462 | { | 3463 | { |
3463 | if (DCBP_get_code(p) == RLE_VLI_Bits) | 3464 | if (DCBP_get_code(p) == RLE_VLI_Bits) |
3464 | return recv_bm_rle_bits(mdev, p, c); | 3465 | return recv_bm_rle_bits(mdev, p, c, len); |
3465 | 3466 | ||
3466 | /* other variants had been implemented for evaluation, | 3467 | /* other variants had been implemented for evaluation, |
3467 | * but have been dropped as this one turned out to be "best" | 3468 | * but have been dropped as this one turned out to be "best" |
@@ -3560,7 +3561,7 @@ static int receive_bitmap(struct drbd_conf *mdev, enum drbd_packets cmd, unsigne | |||
3560 | dev_err(DEV, "ReportCBitmap packet too small (l:%u)\n", data_size); | 3561 | dev_err(DEV, "ReportCBitmap packet too small (l:%u)\n", data_size); |
3561 | goto out; | 3562 | goto out; |
3562 | } | 3563 | } |
3563 | err = decode_bitmap_c(mdev, p, &c); | 3564 | err = decode_bitmap_c(mdev, p, &c, data_size); |
3564 | } else { | 3565 | } else { |
3565 | dev_warn(DEV, "receive_bitmap: cmd neither ReportBitMap nor ReportCBitMap (is 0x%x)", cmd); | 3566 | dev_warn(DEV, "receive_bitmap: cmd neither ReportBitMap nor ReportCBitMap (is 0x%x)", cmd); |
3566 | goto out; | 3567 | goto out; |