Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 345707
b: refs/heads/master
c: 668eebc
h: refs/heads/master
i:
  345705: b2b7ce4
  345703: d0ab2d3
v: v3
  • Loading branch information
Andreas Gruenbacher authored and Philipp Reisner committed Aug 25, 2011
1 parent 0f6c166 commit 75a4f2e
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 26 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: 516245856456db591c5336a90584077545e772b1
refs/heads/master: 668eebc6a10ba146db6b8257b9938121d1f3a06a
49 changes: 24 additions & 25 deletions trunk/drivers/block/drbd/drbd_receiver.c
Original file line number Diff line number Diff line change
Expand Up @@ -1469,24 +1469,39 @@ static int recv_resync_read(struct drbd_conf *mdev, sector_t sector, int data_si
return false;
}

/* when we receive the answer for a read request,
* verify that we actually know about it */
static struct drbd_request *ar_id_to_req(struct drbd_conf *mdev, u64 id,
sector_t sector)
static struct drbd_request *
find_request(struct drbd_conf *mdev,
struct hlist_head *(*hash_slot)(struct drbd_conf *, sector_t),
u64 id, sector_t sector, const char *func)
{
struct hlist_head *slot = ar_hash_slot(mdev, sector);
struct hlist_head *slot = hash_slot(mdev, sector);
struct hlist_node *n;
struct drbd_request *req;

hlist_for_each_entry(req, n, slot, collision) {
if ((unsigned long)req == (unsigned long)id) {
D_ASSERT(req->sector == sector);
return req;
if ((unsigned long)req != (unsigned long)id)
continue;
if (req->sector != sector) {
dev_err(DEV, "%s: found request %lu but it has "
"wrong sector (%llus versus %llus)\n",
func, (unsigned long)req,
(unsigned long long)req->sector,
(unsigned long long)sector);
break;
}
return req;
}
return NULL;
}

/* when we receive the answer for a read request,
* verify that we actually know about it */
static struct drbd_request *ar_id_to_req(struct drbd_conf *mdev, u64 id,
sector_t sector)
{
return find_request(mdev, ar_hash_slot, id, sector, __func__);
}

static int receive_DataReply(struct drbd_conf *mdev, enum drbd_packets cmd, unsigned int data_size)
{
struct drbd_request *req;
Expand Down Expand Up @@ -4243,23 +4258,7 @@ static int got_IsInSync(struct drbd_conf *mdev, struct p_header80 *h)
static struct drbd_request *ack_id_to_req(struct drbd_conf *mdev, u64 id,
sector_t sector)
{
struct hlist_head *slot = tl_hash_slot(mdev, sector);
struct hlist_node *n;
struct drbd_request *req;

hlist_for_each_entry(req, n, slot, collision) {
if ((unsigned long)req == (unsigned long)id) {
if (req->sector != sector) {
dev_err(DEV, "ack_id_to_req: found req %p but it has "
"wrong sector (%llus versus %llus)\n", req,
(unsigned long long)req->sector,
(unsigned long long)sector);
break;
}
return req;
}
}
return NULL;
return find_request(mdev, tl_hash_slot, id, sector, __func__);
}

static int validate_req_change_req_state(struct drbd_conf *mdev,
Expand Down

0 comments on commit 75a4f2e

Please sign in to comment.