Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 242861
b: refs/heads/master
c: f70af11
h: refs/heads/master
i:
  242859: 82c3234
v: v3
  • Loading branch information
Andreas Gruenbacher authored and Philipp Reisner committed Mar 10, 2011
1 parent 21ce178 commit c2f4207
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 13 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 78fcbdae224469cb48767fa29ca41f1d5890e57c
refs/heads/master: f70af118e3f3638698ac08959a41b9f9fe7237c8
33 changes: 21 additions & 12 deletions trunk/drivers/block/drbd/drbd_main.c
Original file line number Diff line number Diff line change
Expand Up @@ -2140,9 +2140,15 @@ int fill_bitmap_rle_bits(struct drbd_conf *mdev,
return len;
}

enum { OK, FAILED, DONE }
/**
* send_bitmap_rle_or_plain
*
* Return 0 when done, 1 when another iteration is needed, and a negative error
* code upon failure.
*/
static int
send_bitmap_rle_or_plain(struct drbd_conf *mdev,
struct p_header80 *h, struct bm_xfer_ctx *c)
struct p_header80 *h, struct bm_xfer_ctx *c)
{
struct p_compressed_bm *p = (void*)h;
unsigned long num_words;
Expand All @@ -2152,7 +2158,7 @@ send_bitmap_rle_or_plain(struct drbd_conf *mdev,
len = fill_bitmap_rle_bits(mdev, p, c);

if (len < 0)
return FAILED;
return -EIO;

if (len) {
DCBP_set_code(p, RLE_VLI_Bits);
Expand Down Expand Up @@ -2182,19 +2188,22 @@ send_bitmap_rle_or_plain(struct drbd_conf *mdev,
if (c->bit_offset > c->bm_bits)
c->bit_offset = c->bm_bits;
}
ok = ok ? ((len == 0) ? DONE : OK) : FAILED;

if (ok == DONE)
INFO_bm_xfer_stats(mdev, "send", c);
return ok;
if (ok) {
if (len == 0) {
INFO_bm_xfer_stats(mdev, "send", c);
return 0;
} else
return 1;
}
return -EIO;
}

/* See the comment at receive_bitmap() */
int _drbd_send_bitmap(struct drbd_conf *mdev)
{
struct bm_xfer_ctx c;
struct p_header80 *p;
int ret;
int err;

ERR_IF(!mdev->bitmap) return false;

Expand Down Expand Up @@ -2229,11 +2238,11 @@ int _drbd_send_bitmap(struct drbd_conf *mdev)
};

do {
ret = send_bitmap_rle_or_plain(mdev, p, &c);
} while (ret == OK);
err = send_bitmap_rle_or_plain(mdev, p, &c);
} while (err > 0);

free_page((unsigned long) p);
return (ret == DONE);
return err == 0;
}

int drbd_send_bitmap(struct drbd_conf *mdev)
Expand Down

0 comments on commit c2f4207

Please sign in to comment.