drbd: Local variable renames: e -> peer_req

Signed-off-by: Philipp Reisner <philipp.reisner@linbit.com>
Signed-off-by: Lars Ellenberg <lars.ellenberg@linbit.com>
This commit is contained in:
Andreas Gruenbacher 2011-02-04 15:57:48 +01:00 committed by Philipp Reisner
parent 6c852beca1
commit db830c464b
5 changed files with 258 additions and 251 deletions

View File

@ -1701,9 +1701,9 @@ static inline int drbd_bio_has_active_page(struct bio *bio)
return 0; return 0;
} }
static inline int drbd_ee_has_active_page(struct drbd_peer_request *e) static inline int drbd_ee_has_active_page(struct drbd_peer_request *peer_req)
{ {
struct page *page = e->pages; struct page *page = peer_req->pages;
page_chain_for_each(page) { page_chain_for_each(page) {
if (page_count(page) > 1) if (page_count(page) > 1)
return 1; return 1;

View File

@ -2429,17 +2429,17 @@ int drbd_send_ack_rp(struct drbd_conf *mdev, enum drbd_packet cmd,
/** /**
* drbd_send_ack() - Sends an ack packet * drbd_send_ack() - Sends an ack packet
* @mdev: DRBD device. * @mdev: DRBD device
* @cmd: Packet command code. * @cmd: packet command code
* @e: Epoch entry. * @peer_req: peer request
*/ */
int drbd_send_ack(struct drbd_conf *mdev, enum drbd_packet cmd, int drbd_send_ack(struct drbd_conf *mdev, enum drbd_packet cmd,
struct drbd_peer_request *e) struct drbd_peer_request *peer_req)
{ {
return _drbd_send_ack(mdev, cmd, return _drbd_send_ack(mdev, cmd,
cpu_to_be64(e->i.sector), cpu_to_be64(peer_req->i.sector),
cpu_to_be32(e->i.size), cpu_to_be32(peer_req->i.size),
e->block_id); peer_req->block_id);
} }
/* This function misuses the block_id field to signal if the blocks /* This function misuses the block_id field to signal if the blocks
@ -2641,10 +2641,12 @@ static int _drbd_send_zc_bio(struct drbd_conf *mdev, struct bio *bio)
return 1; return 1;
} }
static int _drbd_send_zc_ee(struct drbd_conf *mdev, struct drbd_peer_request *e) static int _drbd_send_zc_ee(struct drbd_conf *mdev,
struct drbd_peer_request *peer_req)
{ {
struct page *page = e->pages; struct page *page = peer_req->pages;
unsigned len = e->i.size; unsigned len = peer_req->i.size;
/* hint all but last page with MSG_MORE */ /* hint all but last page with MSG_MORE */
page_chain_for_each(page) { page_chain_for_each(page) {
unsigned l = min_t(unsigned, len, PAGE_SIZE); unsigned l = min_t(unsigned, len, PAGE_SIZE);
@ -2747,7 +2749,7 @@ int drbd_send_dblock(struct drbd_conf *mdev, struct drbd_request *req)
* C_SYNC_SOURCE -> C_SYNC_TARGET (P_RS_DATA_REPLY) * C_SYNC_SOURCE -> C_SYNC_TARGET (P_RS_DATA_REPLY)
*/ */
int drbd_send_block(struct drbd_conf *mdev, enum drbd_packet cmd, int drbd_send_block(struct drbd_conf *mdev, enum drbd_packet cmd,
struct drbd_peer_request *e) struct drbd_peer_request *peer_req)
{ {
int ok; int ok;
struct p_data p; struct p_data p;
@ -2757,9 +2759,11 @@ int drbd_send_block(struct drbd_conf *mdev, enum drbd_packet cmd,
dgs = (mdev->tconn->agreed_pro_version >= 87 && mdev->tconn->integrity_w_tfm) ? dgs = (mdev->tconn->agreed_pro_version >= 87 && mdev->tconn->integrity_w_tfm) ?
crypto_hash_digestsize(mdev->tconn->integrity_w_tfm) : 0; crypto_hash_digestsize(mdev->tconn->integrity_w_tfm) : 0;
prepare_header(mdev, &p.head, cmd, sizeof(p) - sizeof(struct p_header80) + dgs + e->i.size); prepare_header(mdev, &p.head, cmd, sizeof(p) -
p.sector = cpu_to_be64(e->i.sector); sizeof(struct p_header80) +
p.block_id = e->block_id; dgs + peer_req->i.size);
p.sector = cpu_to_be64(peer_req->i.sector);
p.block_id = peer_req->block_id;
p.seq_num = 0; /* unused */ p.seq_num = 0; /* unused */
/* Only called by our kernel thread. /* Only called by our kernel thread.
@ -2772,11 +2776,11 @@ int drbd_send_block(struct drbd_conf *mdev, enum drbd_packet cmd,
ok = sizeof(p) == drbd_send(mdev, mdev->tconn->data.socket, &p, sizeof(p), dgs ? MSG_MORE : 0); ok = sizeof(p) == drbd_send(mdev, mdev->tconn->data.socket, &p, sizeof(p), dgs ? MSG_MORE : 0);
if (ok && dgs) { if (ok && dgs) {
dgb = mdev->tconn->int_dig_out; dgb = mdev->tconn->int_dig_out;
drbd_csum_ee(mdev, mdev->tconn->integrity_w_tfm, e, dgb); drbd_csum_ee(mdev, mdev->tconn->integrity_w_tfm, peer_req, dgb);
ok = dgs == drbd_send(mdev, mdev->tconn->data.socket, dgb, dgs, 0); ok = dgs == drbd_send(mdev, mdev->tconn->data.socket, dgb, dgs, 0);
} }
if (ok) if (ok)
ok = _drbd_send_zc_ee(mdev, e); ok = _drbd_send_zc_ee(mdev, peer_req);
drbd_put_data_sock(mdev); drbd_put_data_sock(mdev);

View File

@ -2445,7 +2445,7 @@ void drbd_bcast_ev_helper(struct drbd_conf *mdev, char *helper_name)
void drbd_bcast_ee(struct drbd_conf *mdev, const char *reason, const int dgs, void drbd_bcast_ee(struct drbd_conf *mdev, const char *reason, const int dgs,
const char *seen_hash, const char *calc_hash, const char *seen_hash, const char *calc_hash,
const struct drbd_peer_request *e) const struct drbd_peer_request *peer_req)
{ {
struct cn_msg *cn_reply; struct cn_msg *cn_reply;
struct drbd_nl_cfg_reply *reply; struct drbd_nl_cfg_reply *reply;
@ -2453,7 +2453,7 @@ void drbd_bcast_ee(struct drbd_conf *mdev, const char *reason, const int dgs,
struct page *page; struct page *page;
unsigned len; unsigned len;
if (!e) if (!peer_req)
return; return;
if (!reason || !reason[0]) if (!reason || !reason[0])
return; return;
@ -2472,8 +2472,10 @@ void drbd_bcast_ee(struct drbd_conf *mdev, const char *reason, const int dgs,
GFP_NOIO); GFP_NOIO);
if (!cn_reply) { if (!cn_reply) {
dev_err(DEV, "could not kmalloc buffer for drbd_bcast_ee, sector %llu, size %u\n", dev_err(DEV, "could not kmalloc buffer for drbd_bcast_ee, "
(unsigned long long)e->i.sector, e->i.size); "sector %llu, size %u\n",
(unsigned long long)peer_req->i.sector,
peer_req->i.size);
return; return;
} }
@ -2483,15 +2485,15 @@ void drbd_bcast_ee(struct drbd_conf *mdev, const char *reason, const int dgs,
tl = tl_add_str(tl, T_dump_ee_reason, reason); tl = tl_add_str(tl, T_dump_ee_reason, reason);
tl = tl_add_blob(tl, T_seen_digest, seen_hash, dgs); tl = tl_add_blob(tl, T_seen_digest, seen_hash, dgs);
tl = tl_add_blob(tl, T_calc_digest, calc_hash, dgs); tl = tl_add_blob(tl, T_calc_digest, calc_hash, dgs);
tl = tl_add_int(tl, T_ee_sector, &e->i.sector); tl = tl_add_int(tl, T_ee_sector, &peer_req->i.sector);
tl = tl_add_int(tl, T_ee_block_id, &e->block_id); tl = tl_add_int(tl, T_ee_block_id, &peer_req->block_id);
/* dump the first 32k */ /* dump the first 32k */
len = min_t(unsigned, e->i.size, 32 << 10); len = min_t(unsigned, peer_req->i.size, 32 << 10);
put_unaligned(T_ee_data, tl++); put_unaligned(T_ee_data, tl++);
put_unaligned(len, tl++); put_unaligned(len, tl++);
page = e->pages; page = peer_req->pages;
page_chain_for_each(page) { page_chain_for_each(page) {
void *d = kmap_atomic(page, KM_USER0); void *d = kmap_atomic(page, KM_USER0);
unsigned l = min_t(unsigned, len, PAGE_SIZE); unsigned l = min_t(unsigned, len, PAGE_SIZE);

View File

@ -189,7 +189,7 @@ static struct page *drbd_pp_first_pages_or_try_alloc(struct drbd_conf *mdev, int
static void reclaim_net_ee(struct drbd_conf *mdev, struct list_head *to_be_freed) static void reclaim_net_ee(struct drbd_conf *mdev, struct list_head *to_be_freed)
{ {
struct drbd_peer_request *e; struct drbd_peer_request *peer_req;
struct list_head *le, *tle; struct list_head *le, *tle;
/* The EEs are always appended to the end of the list. Since /* The EEs are always appended to the end of the list. Since
@ -198,8 +198,8 @@ static void reclaim_net_ee(struct drbd_conf *mdev, struct list_head *to_be_freed
stop to examine the list... */ stop to examine the list... */
list_for_each_safe(le, tle, &mdev->net_ee) { list_for_each_safe(le, tle, &mdev->net_ee) {
e = list_entry(le, struct drbd_peer_request, w.list); peer_req = list_entry(le, struct drbd_peer_request, w.list);
if (drbd_ee_has_active_page(e)) if (drbd_ee_has_active_page(peer_req))
break; break;
list_move(le, to_be_freed); list_move(le, to_be_freed);
} }
@ -208,14 +208,14 @@ static void reclaim_net_ee(struct drbd_conf *mdev, struct list_head *to_be_freed
static void drbd_kick_lo_and_reclaim_net(struct drbd_conf *mdev) static void drbd_kick_lo_and_reclaim_net(struct drbd_conf *mdev)
{ {
LIST_HEAD(reclaimed); LIST_HEAD(reclaimed);
struct drbd_peer_request *e, *t; struct drbd_peer_request *peer_req, *t;
spin_lock_irq(&mdev->tconn->req_lock); spin_lock_irq(&mdev->tconn->req_lock);
reclaim_net_ee(mdev, &reclaimed); reclaim_net_ee(mdev, &reclaimed);
spin_unlock_irq(&mdev->tconn->req_lock); spin_unlock_irq(&mdev->tconn->req_lock);
list_for_each_entry_safe(e, t, &reclaimed, w.list) list_for_each_entry_safe(peer_req, t, &reclaimed, w.list)
drbd_free_net_ee(mdev, e); drbd_free_net_ee(mdev, peer_req);
} }
/** /**
@ -313,15 +313,15 @@ struct drbd_peer_request *
drbd_alloc_ee(struct drbd_conf *mdev, u64 id, sector_t sector, drbd_alloc_ee(struct drbd_conf *mdev, u64 id, sector_t sector,
unsigned int data_size, gfp_t gfp_mask) __must_hold(local) unsigned int data_size, gfp_t gfp_mask) __must_hold(local)
{ {
struct drbd_peer_request *e; struct drbd_peer_request *peer_req;
struct page *page; struct page *page;
unsigned nr_pages = (data_size + PAGE_SIZE -1) >> PAGE_SHIFT; unsigned nr_pages = (data_size + PAGE_SIZE -1) >> PAGE_SHIFT;
if (drbd_insert_fault(mdev, DRBD_FAULT_AL_EE)) if (drbd_insert_fault(mdev, DRBD_FAULT_AL_EE))
return NULL; return NULL;
e = mempool_alloc(drbd_ee_mempool, gfp_mask & ~__GFP_HIGHMEM); peer_req = mempool_alloc(drbd_ee_mempool, gfp_mask & ~__GFP_HIGHMEM);
if (!e) { if (!peer_req) {
if (!(gfp_mask & __GFP_NOWARN)) if (!(gfp_mask & __GFP_NOWARN))
dev_err(DEV, "alloc_ee: Allocation of an EE failed\n"); dev_err(DEV, "alloc_ee: Allocation of an EE failed\n");
return NULL; return NULL;
@ -331,45 +331,45 @@ drbd_alloc_ee(struct drbd_conf *mdev, u64 id, sector_t sector,
if (!page) if (!page)
goto fail; goto fail;
drbd_clear_interval(&e->i); drbd_clear_interval(&peer_req->i);
e->i.size = data_size; peer_req->i.size = data_size;
e->i.sector = sector; peer_req->i.sector = sector;
e->i.local = false; peer_req->i.local = false;
e->i.waiting = false; peer_req->i.waiting = false;
e->epoch = NULL; peer_req->epoch = NULL;
e->mdev = mdev; peer_req->mdev = mdev;
e->pages = page; peer_req->pages = page;
atomic_set(&e->pending_bios, 0); atomic_set(&peer_req->pending_bios, 0);
e->flags = 0; peer_req->flags = 0;
/* /*
* The block_id is opaque to the receiver. It is not endianness * The block_id is opaque to the receiver. It is not endianness
* converted, and sent back to the sender unchanged. * converted, and sent back to the sender unchanged.
*/ */
e->block_id = id; peer_req->block_id = id;
return e; return peer_req;
fail: fail:
mempool_free(e, drbd_ee_mempool); mempool_free(peer_req, drbd_ee_mempool);
return NULL; return NULL;
} }
void drbd_free_some_ee(struct drbd_conf *mdev, struct drbd_peer_request *e, void drbd_free_some_ee(struct drbd_conf *mdev, struct drbd_peer_request *peer_req,
int is_net) int is_net)
{ {
if (e->flags & EE_HAS_DIGEST) if (peer_req->flags & EE_HAS_DIGEST)
kfree(e->digest); kfree(peer_req->digest);
drbd_pp_free(mdev, e->pages, is_net); drbd_pp_free(mdev, peer_req->pages, is_net);
D_ASSERT(atomic_read(&e->pending_bios) == 0); D_ASSERT(atomic_read(&peer_req->pending_bios) == 0);
D_ASSERT(drbd_interval_empty(&e->i)); D_ASSERT(drbd_interval_empty(&peer_req->i));
mempool_free(e, drbd_ee_mempool); mempool_free(peer_req, drbd_ee_mempool);
} }
int drbd_release_ee(struct drbd_conf *mdev, struct list_head *list) int drbd_release_ee(struct drbd_conf *mdev, struct list_head *list)
{ {
LIST_HEAD(work_list); LIST_HEAD(work_list);
struct drbd_peer_request *e, *t; struct drbd_peer_request *peer_req, *t;
int count = 0; int count = 0;
int is_net = list == &mdev->net_ee; int is_net = list == &mdev->net_ee;
@ -377,8 +377,8 @@ int drbd_release_ee(struct drbd_conf *mdev, struct list_head *list)
list_splice_init(list, &work_list); list_splice_init(list, &work_list);
spin_unlock_irq(&mdev->tconn->req_lock); spin_unlock_irq(&mdev->tconn->req_lock);
list_for_each_entry_safe(e, t, &work_list, w.list) { list_for_each_entry_safe(peer_req, t, &work_list, w.list) {
drbd_free_some_ee(mdev, e, is_net); drbd_free_some_ee(mdev, peer_req, is_net);
count++; count++;
} }
return count; return count;
@ -398,7 +398,7 @@ static int drbd_process_done_ee(struct drbd_conf *mdev)
{ {
LIST_HEAD(work_list); LIST_HEAD(work_list);
LIST_HEAD(reclaimed); LIST_HEAD(reclaimed);
struct drbd_peer_request *e, *t; struct drbd_peer_request *peer_req, *t;
int ok = (mdev->state.conn >= C_WF_REPORT_PARAMS); int ok = (mdev->state.conn >= C_WF_REPORT_PARAMS);
spin_lock_irq(&mdev->tconn->req_lock); spin_lock_irq(&mdev->tconn->req_lock);
@ -406,17 +406,17 @@ static int drbd_process_done_ee(struct drbd_conf *mdev)
list_splice_init(&mdev->done_ee, &work_list); list_splice_init(&mdev->done_ee, &work_list);
spin_unlock_irq(&mdev->tconn->req_lock); spin_unlock_irq(&mdev->tconn->req_lock);
list_for_each_entry_safe(e, t, &reclaimed, w.list) list_for_each_entry_safe(peer_req, t, &reclaimed, w.list)
drbd_free_net_ee(mdev, e); drbd_free_net_ee(mdev, peer_req);
/* possible callbacks here: /* possible callbacks here:
* e_end_block, and e_end_resync_block, e_send_discard_ack. * e_end_block, and e_end_resync_block, e_send_discard_ack.
* all ignore the last argument. * all ignore the last argument.
*/ */
list_for_each_entry_safe(e, t, &work_list, w.list) { list_for_each_entry_safe(peer_req, t, &work_list, w.list) {
/* list_del not necessary, next/prev members not touched */ /* list_del not necessary, next/prev members not touched */
ok = e->w.cb(mdev, &e->w, !ok) && ok; ok = peer_req->w.cb(mdev, &peer_req->w, !ok) && ok;
drbd_free_ee(mdev, e); drbd_free_ee(mdev, peer_req);
} }
wake_up(&mdev->ee_wait); wake_up(&mdev->ee_wait);
@ -1085,7 +1085,7 @@ void drbd_bump_write_ordering(struct drbd_conf *mdev, enum write_ordering_e wo)
/** /**
* drbd_submit_ee() * drbd_submit_ee()
* @mdev: DRBD device. * @mdev: DRBD device.
* @e: peer request * @peer_req: peer request
* @rw: flag field, see bio->bi_rw * @rw: flag field, see bio->bi_rw
* *
* May spread the pages to multiple bios, * May spread the pages to multiple bios,
@ -1099,14 +1099,14 @@ void drbd_bump_write_ordering(struct drbd_conf *mdev, enum write_ordering_e wo)
* on certain Xen deployments. * on certain Xen deployments.
*/ */
/* TODO allocate from our own bio_set. */ /* TODO allocate from our own bio_set. */
int drbd_submit_ee(struct drbd_conf *mdev, struct drbd_peer_request *e, int drbd_submit_ee(struct drbd_conf *mdev, struct drbd_peer_request *peer_req,
const unsigned rw, const int fault_type) const unsigned rw, const int fault_type)
{ {
struct bio *bios = NULL; struct bio *bios = NULL;
struct bio *bio; struct bio *bio;
struct page *page = e->pages; struct page *page = peer_req->pages;
sector_t sector = e->i.sector; sector_t sector = peer_req->i.sector;
unsigned ds = e->i.size; unsigned ds = peer_req->i.size;
unsigned n_bios = 0; unsigned n_bios = 0;
unsigned nr_pages = (ds + PAGE_SIZE -1) >> PAGE_SHIFT; unsigned nr_pages = (ds + PAGE_SIZE -1) >> PAGE_SHIFT;
int err = -ENOMEM; int err = -ENOMEM;
@ -1121,11 +1121,11 @@ int drbd_submit_ee(struct drbd_conf *mdev, struct drbd_peer_request *e,
dev_err(DEV, "submit_ee: Allocation of a bio failed\n"); dev_err(DEV, "submit_ee: Allocation of a bio failed\n");
goto fail; goto fail;
} }
/* > e->i.sector, unless this is the first bio */ /* > peer_req->i.sector, unless this is the first bio */
bio->bi_sector = sector; bio->bi_sector = sector;
bio->bi_bdev = mdev->ldev->backing_bdev; bio->bi_bdev = mdev->ldev->backing_bdev;
bio->bi_rw = rw; bio->bi_rw = rw;
bio->bi_private = e; bio->bi_private = peer_req;
bio->bi_end_io = drbd_endio_sec; bio->bi_end_io = drbd_endio_sec;
bio->bi_next = bios; bio->bi_next = bios;
@ -1155,7 +1155,7 @@ int drbd_submit_ee(struct drbd_conf *mdev, struct drbd_peer_request *e,
D_ASSERT(page == NULL); D_ASSERT(page == NULL);
D_ASSERT(ds == 0); D_ASSERT(ds == 0);
atomic_set(&e->pending_bios, n_bios); atomic_set(&peer_req->pending_bios, n_bios);
do { do {
bio = bios; bio = bios;
bios = bios->bi_next; bios = bios->bi_next;
@ -1175,9 +1175,9 @@ int drbd_submit_ee(struct drbd_conf *mdev, struct drbd_peer_request *e,
} }
static void drbd_remove_epoch_entry_interval(struct drbd_conf *mdev, static void drbd_remove_epoch_entry_interval(struct drbd_conf *mdev,
struct drbd_peer_request *e) struct drbd_peer_request *peer_req)
{ {
struct drbd_interval *i = &e->i; struct drbd_interval *i = &peer_req->i;
drbd_remove_interval(&mdev->write_requests, i); drbd_remove_interval(&mdev->write_requests, i);
drbd_clear_interval(i); drbd_clear_interval(i);
@ -1266,7 +1266,7 @@ read_in_block(struct drbd_conf *mdev, u64 id, sector_t sector,
int data_size) __must_hold(local) int data_size) __must_hold(local)
{ {
const sector_t capacity = drbd_get_capacity(mdev->this_bdev); const sector_t capacity = drbd_get_capacity(mdev->this_bdev);
struct drbd_peer_request *e; struct drbd_peer_request *peer_req;
struct page *page; struct page *page;
int dgs, ds, rr; int dgs, ds, rr;
void *dig_in = mdev->tconn->int_dig_in; void *dig_in = mdev->tconn->int_dig_in;
@ -1309,12 +1309,12 @@ read_in_block(struct drbd_conf *mdev, u64 id, sector_t sector,
/* GFP_NOIO, because we must not cause arbitrary write-out: in a DRBD /* GFP_NOIO, because we must not cause arbitrary write-out: in a DRBD
* "criss-cross" setup, that might cause write-out on some other DRBD, * "criss-cross" setup, that might cause write-out on some other DRBD,
* which in turn might block on the other node at this very place. */ * which in turn might block on the other node at this very place. */
e = drbd_alloc_ee(mdev, id, sector, data_size, GFP_NOIO); peer_req = drbd_alloc_ee(mdev, id, sector, data_size, GFP_NOIO);
if (!e) if (!peer_req)
return NULL; return NULL;
ds = data_size; ds = data_size;
page = e->pages; page = peer_req->pages;
page_chain_for_each(page) { page_chain_for_each(page) {
unsigned len = min_t(int, ds, PAGE_SIZE); unsigned len = min_t(int, ds, PAGE_SIZE);
data = kmap(page); data = kmap(page);
@ -1325,7 +1325,7 @@ read_in_block(struct drbd_conf *mdev, u64 id, sector_t sector,
} }
kunmap(page); kunmap(page);
if (rr != len) { if (rr != len) {
drbd_free_ee(mdev, e); drbd_free_ee(mdev, peer_req);
if (!signal_pending(current)) if (!signal_pending(current))
dev_warn(DEV, "short read receiving data: read %d expected %d\n", dev_warn(DEV, "short read receiving data: read %d expected %d\n",
rr, len); rr, len);
@ -1335,18 +1335,18 @@ read_in_block(struct drbd_conf *mdev, u64 id, sector_t sector,
} }
if (dgs) { if (dgs) {
drbd_csum_ee(mdev, mdev->tconn->integrity_r_tfm, e, dig_vv); drbd_csum_ee(mdev, mdev->tconn->integrity_r_tfm, peer_req, dig_vv);
if (memcmp(dig_in, dig_vv, dgs)) { if (memcmp(dig_in, dig_vv, dgs)) {
dev_err(DEV, "Digest integrity check FAILED: %llus +%u\n", dev_err(DEV, "Digest integrity check FAILED: %llus +%u\n",
(unsigned long long)sector, data_size); (unsigned long long)sector, data_size);
drbd_bcast_ee(mdev, "digest failed", drbd_bcast_ee(mdev, "digest failed",
dgs, dig_in, dig_vv, e); dgs, dig_in, dig_vv, peer_req);
drbd_free_ee(mdev, e); drbd_free_ee(mdev, peer_req);
return NULL; return NULL;
} }
} }
mdev->recv_cnt += data_size>>9; mdev->recv_cnt += data_size>>9;
return e; return peer_req;
} }
/* drbd_drain_block() just takes a data block /* drbd_drain_block() just takes a data block
@ -1445,20 +1445,20 @@ static int recv_dless_read(struct drbd_conf *mdev, struct drbd_request *req,
* drbd_process_done_ee() by asender only */ * drbd_process_done_ee() by asender only */
static int e_end_resync_block(struct drbd_conf *mdev, struct drbd_work *w, int unused) static int e_end_resync_block(struct drbd_conf *mdev, struct drbd_work *w, int unused)
{ {
struct drbd_peer_request *e = (struct drbd_peer_request *)w; struct drbd_peer_request *peer_req = (struct drbd_peer_request *)w;
sector_t sector = e->i.sector; sector_t sector = peer_req->i.sector;
int ok; int ok;
D_ASSERT(drbd_interval_empty(&e->i)); D_ASSERT(drbd_interval_empty(&peer_req->i));
if (likely((e->flags & EE_WAS_ERROR) == 0)) { if (likely((peer_req->flags & EE_WAS_ERROR) == 0)) {
drbd_set_in_sync(mdev, sector, e->i.size); drbd_set_in_sync(mdev, sector, peer_req->i.size);
ok = drbd_send_ack(mdev, P_RS_WRITE_ACK, e); ok = drbd_send_ack(mdev, P_RS_WRITE_ACK, peer_req);
} else { } else {
/* Record failure to sync */ /* Record failure to sync */
drbd_rs_failed_io(mdev, sector, e->i.size); drbd_rs_failed_io(mdev, sector, peer_req->i.size);
ok = drbd_send_ack(mdev, P_NEG_ACK, e); ok = drbd_send_ack(mdev, P_NEG_ACK, peer_req);
} }
dec_unacked(mdev); dec_unacked(mdev);
@ -1467,10 +1467,10 @@ static int e_end_resync_block(struct drbd_conf *mdev, struct drbd_work *w, int u
static int recv_resync_read(struct drbd_conf *mdev, sector_t sector, int data_size) __releases(local) static int recv_resync_read(struct drbd_conf *mdev, sector_t sector, int data_size) __releases(local)
{ {
struct drbd_peer_request *e; struct drbd_peer_request *peer_req;
e = read_in_block(mdev, ID_SYNCER, sector, data_size); peer_req = read_in_block(mdev, ID_SYNCER, sector, data_size);
if (!e) if (!peer_req)
goto fail; goto fail;
dec_rs_pending(mdev); dec_rs_pending(mdev);
@ -1479,23 +1479,23 @@ static int recv_resync_read(struct drbd_conf *mdev, sector_t sector, int data_si
/* corresponding dec_unacked() in e_end_resync_block() /* corresponding dec_unacked() in e_end_resync_block()
* respective _drbd_clear_done_ee */ * respective _drbd_clear_done_ee */
e->w.cb = e_end_resync_block; peer_req->w.cb = e_end_resync_block;
spin_lock_irq(&mdev->tconn->req_lock); spin_lock_irq(&mdev->tconn->req_lock);
list_add(&e->w.list, &mdev->sync_ee); list_add(&peer_req->w.list, &mdev->sync_ee);
spin_unlock_irq(&mdev->tconn->req_lock); spin_unlock_irq(&mdev->tconn->req_lock);
atomic_add(data_size >> 9, &mdev->rs_sect_ev); atomic_add(data_size >> 9, &mdev->rs_sect_ev);
if (drbd_submit_ee(mdev, e, WRITE, DRBD_FAULT_RS_WR) == 0) if (drbd_submit_ee(mdev, peer_req, WRITE, DRBD_FAULT_RS_WR) == 0)
return true; return true;
/* don't care for the reason here */ /* don't care for the reason here */
dev_err(DEV, "submit failed, triggering re-connect\n"); dev_err(DEV, "submit failed, triggering re-connect\n");
spin_lock_irq(&mdev->tconn->req_lock); spin_lock_irq(&mdev->tconn->req_lock);
list_del(&e->w.list); list_del(&peer_req->w.list);
spin_unlock_irq(&mdev->tconn->req_lock); spin_unlock_irq(&mdev->tconn->req_lock);
drbd_free_ee(mdev, e); drbd_free_ee(mdev, peer_req);
fail: fail:
put_ldev(mdev); put_ldev(mdev);
return false; return false;
@ -1582,21 +1582,21 @@ static int receive_RSDataReply(struct drbd_conf *mdev, enum drbd_packet cmd,
*/ */
static int e_end_block(struct drbd_conf *mdev, struct drbd_work *w, int cancel) static int e_end_block(struct drbd_conf *mdev, struct drbd_work *w, int cancel)
{ {
struct drbd_peer_request *e = (struct drbd_peer_request *)w; struct drbd_peer_request *peer_req = (struct drbd_peer_request *)w;
sector_t sector = e->i.sector; sector_t sector = peer_req->i.sector;
int ok = 1, pcmd; int ok = 1, pcmd;
if (mdev->tconn->net_conf->wire_protocol == DRBD_PROT_C) { if (mdev->tconn->net_conf->wire_protocol == DRBD_PROT_C) {
if (likely((e->flags & EE_WAS_ERROR) == 0)) { if (likely((peer_req->flags & EE_WAS_ERROR) == 0)) {
pcmd = (mdev->state.conn >= C_SYNC_SOURCE && pcmd = (mdev->state.conn >= C_SYNC_SOURCE &&
mdev->state.conn <= C_PAUSED_SYNC_T && mdev->state.conn <= C_PAUSED_SYNC_T &&
e->flags & EE_MAY_SET_IN_SYNC) ? peer_req->flags & EE_MAY_SET_IN_SYNC) ?
P_RS_WRITE_ACK : P_WRITE_ACK; P_RS_WRITE_ACK : P_WRITE_ACK;
ok &= drbd_send_ack(mdev, pcmd, e); ok &= drbd_send_ack(mdev, pcmd, peer_req);
if (pcmd == P_RS_WRITE_ACK) if (pcmd == P_RS_WRITE_ACK)
drbd_set_in_sync(mdev, sector, e->i.size); drbd_set_in_sync(mdev, sector, peer_req->i.size);
} else { } else {
ok = drbd_send_ack(mdev, P_NEG_ACK, e); ok = drbd_send_ack(mdev, P_NEG_ACK, peer_req);
/* we expect it to be marked out of sync anyways... /* we expect it to be marked out of sync anyways...
* maybe assert this? */ * maybe assert this? */
} }
@ -1606,28 +1606,28 @@ static int e_end_block(struct drbd_conf *mdev, struct drbd_work *w, int cancel)
* P_WRITE_ACK / P_NEG_ACK, to get the sequence number right. */ * P_WRITE_ACK / P_NEG_ACK, to get the sequence number right. */
if (mdev->tconn->net_conf->two_primaries) { if (mdev->tconn->net_conf->two_primaries) {
spin_lock_irq(&mdev->tconn->req_lock); spin_lock_irq(&mdev->tconn->req_lock);
D_ASSERT(!drbd_interval_empty(&e->i)); D_ASSERT(!drbd_interval_empty(&peer_req->i));
drbd_remove_epoch_entry_interval(mdev, e); drbd_remove_epoch_entry_interval(mdev, peer_req);
spin_unlock_irq(&mdev->tconn->req_lock); spin_unlock_irq(&mdev->tconn->req_lock);
} else } else
D_ASSERT(drbd_interval_empty(&e->i)); D_ASSERT(drbd_interval_empty(&peer_req->i));
drbd_may_finish_epoch(mdev, e->epoch, EV_PUT + (cancel ? EV_CLEANUP : 0)); drbd_may_finish_epoch(mdev, peer_req->epoch, EV_PUT + (cancel ? EV_CLEANUP : 0));
return ok; return ok;
} }
static int e_send_discard_ack(struct drbd_conf *mdev, struct drbd_work *w, int unused) static int e_send_discard_ack(struct drbd_conf *mdev, struct drbd_work *w, int unused)
{ {
struct drbd_peer_request *e = (struct drbd_peer_request *)w; struct drbd_peer_request *peer_req = (struct drbd_peer_request *)w;
int ok = 1; int ok = 1;
D_ASSERT(mdev->tconn->net_conf->wire_protocol == DRBD_PROT_C); D_ASSERT(mdev->tconn->net_conf->wire_protocol == DRBD_PROT_C);
ok = drbd_send_ack(mdev, P_DISCARD_ACK, e); ok = drbd_send_ack(mdev, P_DISCARD_ACK, peer_req);
spin_lock_irq(&mdev->tconn->req_lock); spin_lock_irq(&mdev->tconn->req_lock);
D_ASSERT(!drbd_interval_empty(&e->i)); D_ASSERT(!drbd_interval_empty(&peer_req->i));
drbd_remove_epoch_entry_interval(mdev, e); drbd_remove_epoch_entry_interval(mdev, peer_req);
spin_unlock_irq(&mdev->tconn->req_lock); spin_unlock_irq(&mdev->tconn->req_lock);
dec_unacked(mdev); dec_unacked(mdev);
@ -1731,7 +1731,7 @@ static int receive_Data(struct drbd_conf *mdev, enum drbd_packet cmd,
unsigned int data_size) unsigned int data_size)
{ {
sector_t sector; sector_t sector;
struct drbd_peer_request *e; struct drbd_peer_request *peer_req;
struct p_data *p = &mdev->tconn->data.rbuf.data; struct p_data *p = &mdev->tconn->data.rbuf.data;
int rw = WRITE; int rw = WRITE;
u32 dp_flags; u32 dp_flags;
@ -1753,24 +1753,24 @@ static int receive_Data(struct drbd_conf *mdev, enum drbd_packet cmd,
* the end of this function. */ * the end of this function. */
sector = be64_to_cpu(p->sector); sector = be64_to_cpu(p->sector);
e = read_in_block(mdev, p->block_id, sector, data_size); peer_req = read_in_block(mdev, p->block_id, sector, data_size);
if (!e) { if (!peer_req) {
put_ldev(mdev); put_ldev(mdev);
return false; return false;
} }
e->w.cb = e_end_block; peer_req->w.cb = e_end_block;
dp_flags = be32_to_cpu(p->dp_flags); dp_flags = be32_to_cpu(p->dp_flags);
rw |= wire_flags_to_bio(mdev, dp_flags); rw |= wire_flags_to_bio(mdev, dp_flags);
if (dp_flags & DP_MAY_SET_IN_SYNC) if (dp_flags & DP_MAY_SET_IN_SYNC)
e->flags |= EE_MAY_SET_IN_SYNC; peer_req->flags |= EE_MAY_SET_IN_SYNC;
spin_lock(&mdev->epoch_lock); spin_lock(&mdev->epoch_lock);
e->epoch = mdev->current_epoch; peer_req->epoch = mdev->current_epoch;
atomic_inc(&e->epoch->epoch_size); atomic_inc(&peer_req->epoch->epoch_size);
atomic_inc(&e->epoch->active); atomic_inc(&peer_req->epoch->active);
spin_unlock(&mdev->epoch_lock); spin_unlock(&mdev->epoch_lock);
/* I'm the receiver, I do hold a net_cnt reference. */ /* I'm the receiver, I do hold a net_cnt reference. */
@ -1779,7 +1779,7 @@ static int receive_Data(struct drbd_conf *mdev, enum drbd_packet cmd,
} else { } else {
/* don't get the req_lock yet, /* don't get the req_lock yet,
* we may sleep in drbd_wait_peer_seq */ * we may sleep in drbd_wait_peer_seq */
const int size = e->i.size; const int size = peer_req->i.size;
const int discard = test_bit(DISCARD_CONCURRENT, &mdev->flags); const int discard = test_bit(DISCARD_CONCURRENT, &mdev->flags);
DEFINE_WAIT(wait); DEFINE_WAIT(wait);
int first; int first;
@ -1856,8 +1856,8 @@ static int receive_Data(struct drbd_conf *mdev, enum drbd_packet cmd,
dev_alert(DEV, "Concurrent write! [DISCARD BY FLAG] sec=%llus\n", dev_alert(DEV, "Concurrent write! [DISCARD BY FLAG] sec=%llus\n",
(unsigned long long)sector); (unsigned long long)sector);
inc_unacked(mdev); inc_unacked(mdev);
e->w.cb = e_send_discard_ack; peer_req->w.cb = e_send_discard_ack;
list_add_tail(&e->w.list, &mdev->done_ee); list_add_tail(&peer_req->w.list, &mdev->done_ee);
spin_unlock_irq(&mdev->tconn->req_lock); spin_unlock_irq(&mdev->tconn->req_lock);
@ -1894,10 +1894,10 @@ static int receive_Data(struct drbd_conf *mdev, enum drbd_packet cmd,
} }
finish_wait(&mdev->misc_wait, &wait); finish_wait(&mdev->misc_wait, &wait);
drbd_insert_interval(&mdev->write_requests, &e->i); drbd_insert_interval(&mdev->write_requests, &peer_req->i);
} }
list_add(&e->w.list, &mdev->active_ee); list_add(&peer_req->w.list, &mdev->active_ee);
spin_unlock_irq(&mdev->tconn->req_lock); spin_unlock_irq(&mdev->tconn->req_lock);
switch (mdev->tconn->net_conf->wire_protocol) { switch (mdev->tconn->net_conf->wire_protocol) {
@ -1909,7 +1909,7 @@ static int receive_Data(struct drbd_conf *mdev, enum drbd_packet cmd,
case DRBD_PROT_B: case DRBD_PROT_B:
/* I really don't like it that the receiver thread /* I really don't like it that the receiver thread
* sends on the msock, but anyways */ * sends on the msock, but anyways */
drbd_send_ack(mdev, P_RECV_ACK, e); drbd_send_ack(mdev, P_RECV_ACK, peer_req);
break; break;
case DRBD_PROT_A: case DRBD_PROT_A:
/* nothing to do */ /* nothing to do */
@ -1918,28 +1918,28 @@ static int receive_Data(struct drbd_conf *mdev, enum drbd_packet cmd,
if (mdev->state.pdsk < D_INCONSISTENT) { if (mdev->state.pdsk < D_INCONSISTENT) {
/* In case we have the only disk of the cluster, */ /* In case we have the only disk of the cluster, */
drbd_set_out_of_sync(mdev, e->i.sector, e->i.size); drbd_set_out_of_sync(mdev, peer_req->i.sector, peer_req->i.size);
e->flags |= EE_CALL_AL_COMPLETE_IO; peer_req->flags |= EE_CALL_AL_COMPLETE_IO;
e->flags &= ~EE_MAY_SET_IN_SYNC; peer_req->flags &= ~EE_MAY_SET_IN_SYNC;
drbd_al_begin_io(mdev, e->i.sector); drbd_al_begin_io(mdev, peer_req->i.sector);
} }
if (drbd_submit_ee(mdev, e, rw, DRBD_FAULT_DT_WR) == 0) if (drbd_submit_ee(mdev, peer_req, rw, DRBD_FAULT_DT_WR) == 0)
return true; return true;
/* don't care for the reason here */ /* don't care for the reason here */
dev_err(DEV, "submit failed, triggering re-connect\n"); dev_err(DEV, "submit failed, triggering re-connect\n");
spin_lock_irq(&mdev->tconn->req_lock); spin_lock_irq(&mdev->tconn->req_lock);
list_del(&e->w.list); list_del(&peer_req->w.list);
drbd_remove_epoch_entry_interval(mdev, e); drbd_remove_epoch_entry_interval(mdev, peer_req);
spin_unlock_irq(&mdev->tconn->req_lock); spin_unlock_irq(&mdev->tconn->req_lock);
if (e->flags & EE_CALL_AL_COMPLETE_IO) if (peer_req->flags & EE_CALL_AL_COMPLETE_IO)
drbd_al_complete_io(mdev, e->i.sector); drbd_al_complete_io(mdev, peer_req->i.sector);
out_interrupted: out_interrupted:
drbd_may_finish_epoch(mdev, e->epoch, EV_PUT + EV_CLEANUP); drbd_may_finish_epoch(mdev, peer_req->epoch, EV_PUT + EV_CLEANUP);
put_ldev(mdev); put_ldev(mdev);
drbd_free_ee(mdev, e); drbd_free_ee(mdev, peer_req);
return false; return false;
} }
@ -2015,7 +2015,7 @@ static int receive_DataRequest(struct drbd_conf *mdev, enum drbd_packet cmd,
{ {
sector_t sector; sector_t sector;
const sector_t capacity = drbd_get_capacity(mdev->this_bdev); const sector_t capacity = drbd_get_capacity(mdev->this_bdev);
struct drbd_peer_request *e; struct drbd_peer_request *peer_req;
struct digest_info *di = NULL; struct digest_info *di = NULL;
int size, verb; int size, verb;
unsigned int fault_type; unsigned int fault_type;
@ -2066,21 +2066,21 @@ static int receive_DataRequest(struct drbd_conf *mdev, enum drbd_packet cmd,
/* GFP_NOIO, because we must not cause arbitrary write-out: in a DRBD /* GFP_NOIO, because we must not cause arbitrary write-out: in a DRBD
* "criss-cross" setup, that might cause write-out on some other DRBD, * "criss-cross" setup, that might cause write-out on some other DRBD,
* which in turn might block on the other node at this very place. */ * which in turn might block on the other node at this very place. */
e = drbd_alloc_ee(mdev, p->block_id, sector, size, GFP_NOIO); peer_req = drbd_alloc_ee(mdev, p->block_id, sector, size, GFP_NOIO);
if (!e) { if (!peer_req) {
put_ldev(mdev); put_ldev(mdev);
return false; return false;
} }
switch (cmd) { switch (cmd) {
case P_DATA_REQUEST: case P_DATA_REQUEST:
e->w.cb = w_e_end_data_req; peer_req->w.cb = w_e_end_data_req;
fault_type = DRBD_FAULT_DT_RD; fault_type = DRBD_FAULT_DT_RD;
/* application IO, don't drbd_rs_begin_io */ /* application IO, don't drbd_rs_begin_io */
goto submit; goto submit;
case P_RS_DATA_REQUEST: case P_RS_DATA_REQUEST:
e->w.cb = w_e_end_rsdata_req; peer_req->w.cb = w_e_end_rsdata_req;
fault_type = DRBD_FAULT_RS_RD; fault_type = DRBD_FAULT_RS_RD;
/* used in the sector offset progress display */ /* used in the sector offset progress display */
mdev->bm_resync_fo = BM_SECT_TO_BIT(sector); mdev->bm_resync_fo = BM_SECT_TO_BIT(sector);
@ -2096,21 +2096,21 @@ static int receive_DataRequest(struct drbd_conf *mdev, enum drbd_packet cmd,
di->digest_size = digest_size; di->digest_size = digest_size;
di->digest = (((char *)di)+sizeof(struct digest_info)); di->digest = (((char *)di)+sizeof(struct digest_info));
e->digest = di; peer_req->digest = di;
e->flags |= EE_HAS_DIGEST; peer_req->flags |= EE_HAS_DIGEST;
if (drbd_recv(mdev, di->digest, digest_size) != digest_size) if (drbd_recv(mdev, di->digest, digest_size) != digest_size)
goto out_free_e; goto out_free_e;
if (cmd == P_CSUM_RS_REQUEST) { if (cmd == P_CSUM_RS_REQUEST) {
D_ASSERT(mdev->tconn->agreed_pro_version >= 89); D_ASSERT(mdev->tconn->agreed_pro_version >= 89);
e->w.cb = w_e_end_csum_rs_req; peer_req->w.cb = w_e_end_csum_rs_req;
/* used in the sector offset progress display */ /* used in the sector offset progress display */
mdev->bm_resync_fo = BM_SECT_TO_BIT(sector); mdev->bm_resync_fo = BM_SECT_TO_BIT(sector);
} else if (cmd == P_OV_REPLY) { } else if (cmd == P_OV_REPLY) {
/* track progress, we may need to throttle */ /* track progress, we may need to throttle */
atomic_add(size >> 9, &mdev->rs_sect_in); atomic_add(size >> 9, &mdev->rs_sect_in);
e->w.cb = w_e_end_ov_reply; peer_req->w.cb = w_e_end_ov_reply;
dec_rs_pending(mdev); dec_rs_pending(mdev);
/* drbd_rs_begin_io done when we sent this request, /* drbd_rs_begin_io done when we sent this request,
* but accounting still needs to be done. */ * but accounting still needs to be done. */
@ -2134,7 +2134,7 @@ static int receive_DataRequest(struct drbd_conf *mdev, enum drbd_packet cmd,
dev_info(DEV, "Online Verify start sector: %llu\n", dev_info(DEV, "Online Verify start sector: %llu\n",
(unsigned long long)sector); (unsigned long long)sector);
} }
e->w.cb = w_e_end_ov_req; peer_req->w.cb = w_e_end_ov_req;
fault_type = DRBD_FAULT_RS_RD; fault_type = DRBD_FAULT_RS_RD;
break; break;
@ -2178,22 +2178,22 @@ static int receive_DataRequest(struct drbd_conf *mdev, enum drbd_packet cmd,
submit: submit:
inc_unacked(mdev); inc_unacked(mdev);
spin_lock_irq(&mdev->tconn->req_lock); spin_lock_irq(&mdev->tconn->req_lock);
list_add_tail(&e->w.list, &mdev->read_ee); list_add_tail(&peer_req->w.list, &mdev->read_ee);
spin_unlock_irq(&mdev->tconn->req_lock); spin_unlock_irq(&mdev->tconn->req_lock);
if (drbd_submit_ee(mdev, e, READ, fault_type) == 0) if (drbd_submit_ee(mdev, peer_req, READ, fault_type) == 0)
return true; return true;
/* don't care for the reason here */ /* don't care for the reason here */
dev_err(DEV, "submit failed, triggering re-connect\n"); dev_err(DEV, "submit failed, triggering re-connect\n");
spin_lock_irq(&mdev->tconn->req_lock); spin_lock_irq(&mdev->tconn->req_lock);
list_del(&e->w.list); list_del(&peer_req->w.list);
spin_unlock_irq(&mdev->tconn->req_lock); spin_unlock_irq(&mdev->tconn->req_lock);
/* no drbd_rs_complete_io(), we are dropping the connection anyways */ /* no drbd_rs_complete_io(), we are dropping the connection anyways */
out_free_e: out_free_e:
put_ldev(mdev); put_ldev(mdev);
drbd_free_ee(mdev, e); drbd_free_ee(mdev, peer_req);
return false; return false;
} }

View File

@ -80,47 +80,47 @@ void drbd_md_io_complete(struct bio *bio, int error)
/* reads on behalf of the partner, /* reads on behalf of the partner,
* "submitted" by the receiver * "submitted" by the receiver
*/ */
void drbd_endio_read_sec_final(struct drbd_peer_request *e) __releases(local) void drbd_endio_read_sec_final(struct drbd_peer_request *peer_req) __releases(local)
{ {
unsigned long flags = 0; unsigned long flags = 0;
struct drbd_conf *mdev = e->mdev; struct drbd_conf *mdev = peer_req->mdev;
spin_lock_irqsave(&mdev->tconn->req_lock, flags); spin_lock_irqsave(&mdev->tconn->req_lock, flags);
mdev->read_cnt += e->i.size >> 9; mdev->read_cnt += peer_req->i.size >> 9;
list_del(&e->w.list); list_del(&peer_req->w.list);
if (list_empty(&mdev->read_ee)) if (list_empty(&mdev->read_ee))
wake_up(&mdev->ee_wait); wake_up(&mdev->ee_wait);
if (test_bit(__EE_WAS_ERROR, &e->flags)) if (test_bit(__EE_WAS_ERROR, &peer_req->flags))
__drbd_chk_io_error(mdev, false); __drbd_chk_io_error(mdev, false);
spin_unlock_irqrestore(&mdev->tconn->req_lock, flags); spin_unlock_irqrestore(&mdev->tconn->req_lock, flags);
drbd_queue_work(&mdev->tconn->data.work, &e->w); drbd_queue_work(&mdev->tconn->data.work, &peer_req->w);
put_ldev(mdev); put_ldev(mdev);
} }
/* writes on behalf of the partner, or resync writes, /* writes on behalf of the partner, or resync writes,
* "submitted" by the receiver, final stage. */ * "submitted" by the receiver, final stage. */
static void drbd_endio_write_sec_final(struct drbd_peer_request *e) __releases(local) static void drbd_endio_write_sec_final(struct drbd_peer_request *peer_req) __releases(local)
{ {
unsigned long flags = 0; unsigned long flags = 0;
struct drbd_conf *mdev = e->mdev; struct drbd_conf *mdev = peer_req->mdev;
sector_t e_sector; sector_t e_sector;
int do_wake; int do_wake;
u64 block_id; u64 block_id;
int do_al_complete_io; int do_al_complete_io;
/* after we moved e to done_ee, /* after we moved peer_req to done_ee,
* we may no longer access it, * we may no longer access it,
* it may be freed/reused already! * it may be freed/reused already!
* (as soon as we release the req_lock) */ * (as soon as we release the req_lock) */
e_sector = e->i.sector; e_sector = peer_req->i.sector;
do_al_complete_io = e->flags & EE_CALL_AL_COMPLETE_IO; do_al_complete_io = peer_req->flags & EE_CALL_AL_COMPLETE_IO;
block_id = e->block_id; block_id = peer_req->block_id;
spin_lock_irqsave(&mdev->tconn->req_lock, flags); spin_lock_irqsave(&mdev->tconn->req_lock, flags);
mdev->writ_cnt += e->i.size >> 9; mdev->writ_cnt += peer_req->i.size >> 9;
list_del(&e->w.list); /* has been on active_ee or sync_ee */ list_del(&peer_req->w.list); /* has been on active_ee or sync_ee */
list_add_tail(&e->w.list, &mdev->done_ee); list_add_tail(&peer_req->w.list, &mdev->done_ee);
/* /*
* Do not remove from the write_requests tree here: we did not send the * Do not remove from the write_requests tree here: we did not send the
@ -132,7 +132,7 @@ static void drbd_endio_write_sec_final(struct drbd_peer_request *e) __releases(l
do_wake = list_empty(block_id == ID_SYNCER ? &mdev->sync_ee : &mdev->active_ee); do_wake = list_empty(block_id == ID_SYNCER ? &mdev->sync_ee : &mdev->active_ee);
if (test_bit(__EE_WAS_ERROR, &e->flags)) if (test_bit(__EE_WAS_ERROR, &peer_req->flags))
__drbd_chk_io_error(mdev, false); __drbd_chk_io_error(mdev, false);
spin_unlock_irqrestore(&mdev->tconn->req_lock, flags); spin_unlock_irqrestore(&mdev->tconn->req_lock, flags);
@ -154,20 +154,20 @@ static void drbd_endio_write_sec_final(struct drbd_peer_request *e) __releases(l
*/ */
void drbd_endio_sec(struct bio *bio, int error) void drbd_endio_sec(struct bio *bio, int error)
{ {
struct drbd_peer_request *e = bio->bi_private; struct drbd_peer_request *peer_req = bio->bi_private;
struct drbd_conf *mdev = e->mdev; struct drbd_conf *mdev = peer_req->mdev;
int uptodate = bio_flagged(bio, BIO_UPTODATE); int uptodate = bio_flagged(bio, BIO_UPTODATE);
int is_write = bio_data_dir(bio) == WRITE; int is_write = bio_data_dir(bio) == WRITE;
if (error && __ratelimit(&drbd_ratelimit_state)) if (error && __ratelimit(&drbd_ratelimit_state))
dev_warn(DEV, "%s: error=%d s=%llus\n", dev_warn(DEV, "%s: error=%d s=%llus\n",
is_write ? "write" : "read", error, is_write ? "write" : "read", error,
(unsigned long long)e->i.sector); (unsigned long long)peer_req->i.sector);
if (!error && !uptodate) { if (!error && !uptodate) {
if (__ratelimit(&drbd_ratelimit_state)) if (__ratelimit(&drbd_ratelimit_state))
dev_warn(DEV, "%s: setting error to -EIO s=%llus\n", dev_warn(DEV, "%s: setting error to -EIO s=%llus\n",
is_write ? "write" : "read", is_write ? "write" : "read",
(unsigned long long)e->i.sector); (unsigned long long)peer_req->i.sector);
/* strange behavior of some lower level drivers... /* strange behavior of some lower level drivers...
* fail the request by clearing the uptodate flag, * fail the request by clearing the uptodate flag,
* but do not return any error?! */ * but do not return any error?! */
@ -175,14 +175,14 @@ void drbd_endio_sec(struct bio *bio, int error)
} }
if (error) if (error)
set_bit(__EE_WAS_ERROR, &e->flags); set_bit(__EE_WAS_ERROR, &peer_req->flags);
bio_put(bio); /* no need for the bio anymore */ bio_put(bio); /* no need for the bio anymore */
if (atomic_dec_and_test(&e->pending_bios)) { if (atomic_dec_and_test(&peer_req->pending_bios)) {
if (is_write) if (is_write)
drbd_endio_write_sec_final(e); drbd_endio_write_sec_final(peer_req);
else else
drbd_endio_read_sec_final(e); drbd_endio_read_sec_final(peer_req);
} }
} }
@ -248,11 +248,11 @@ int w_read_retry_remote(struct drbd_conf *mdev, struct drbd_work *w, int cancel)
} }
void drbd_csum_ee(struct drbd_conf *mdev, struct crypto_hash *tfm, void drbd_csum_ee(struct drbd_conf *mdev, struct crypto_hash *tfm,
struct drbd_peer_request *e, void *digest) struct drbd_peer_request *peer_req, void *digest)
{ {
struct hash_desc desc; struct hash_desc desc;
struct scatterlist sg; struct scatterlist sg;
struct page *page = e->pages; struct page *page = peer_req->pages;
struct page *tmp; struct page *tmp;
unsigned len; unsigned len;
@ -269,7 +269,7 @@ void drbd_csum_ee(struct drbd_conf *mdev, struct crypto_hash *tfm,
page = tmp; page = tmp;
} }
/* and now the last, possibly only partially used page */ /* and now the last, possibly only partially used page */
len = e->i.size & (PAGE_SIZE - 1); len = peer_req->i.size & (PAGE_SIZE - 1);
sg_set_page(&sg, page, len ?: PAGE_SIZE, 0); sg_set_page(&sg, page, len ?: PAGE_SIZE, 0);
crypto_hash_update(&desc, &sg, sg.length); crypto_hash_update(&desc, &sg, sg.length);
crypto_hash_final(&desc, digest); crypto_hash_final(&desc, digest);
@ -298,7 +298,8 @@ void drbd_csum_bio(struct drbd_conf *mdev, struct crypto_hash *tfm, struct bio *
/* TODO merge common code with w_e_end_ov_req */ /* TODO merge common code with w_e_end_ov_req */
int w_e_send_csum(struct drbd_conf *mdev, struct drbd_work *w, int cancel) int w_e_send_csum(struct drbd_conf *mdev, struct drbd_work *w, int cancel)
{ {
struct drbd_peer_request *e = container_of(w, struct drbd_peer_request, w); struct drbd_peer_request *peer_req =
container_of(w, struct drbd_peer_request, w);
int digest_size; int digest_size;
void *digest; void *digest;
int ok = 1; int ok = 1;
@ -306,22 +307,22 @@ int w_e_send_csum(struct drbd_conf *mdev, struct drbd_work *w, int cancel)
if (unlikely(cancel)) if (unlikely(cancel))
goto out; goto out;
if (likely((e->flags & EE_WAS_ERROR) != 0)) if (likely((peer_req->flags & EE_WAS_ERROR) != 0))
goto out; goto out;
digest_size = crypto_hash_digestsize(mdev->csums_tfm); digest_size = crypto_hash_digestsize(mdev->csums_tfm);
digest = kmalloc(digest_size, GFP_NOIO); digest = kmalloc(digest_size, GFP_NOIO);
if (digest) { if (digest) {
sector_t sector = e->i.sector; sector_t sector = peer_req->i.sector;
unsigned int size = e->i.size; unsigned int size = peer_req->i.size;
drbd_csum_ee(mdev, mdev->csums_tfm, e, digest); drbd_csum_ee(mdev, mdev->csums_tfm, peer_req, digest);
/* Free e and pages before send. /* Free e and pages before send.
* In case we block on congestion, we could otherwise run into * In case we block on congestion, we could otherwise run into
* some distributed deadlock, if the other side blocks on * some distributed deadlock, if the other side blocks on
* congestion as well, because our receiver blocks in * congestion as well, because our receiver blocks in
* drbd_pp_alloc due to pp_in_use > max_buffers. */ * drbd_pp_alloc due to pp_in_use > max_buffers. */
drbd_free_ee(mdev, e); drbd_free_ee(mdev, peer_req);
e = NULL; peer_req = NULL;
inc_rs_pending(mdev); inc_rs_pending(mdev);
ok = drbd_send_drequest_csum(mdev, sector, size, ok = drbd_send_drequest_csum(mdev, sector, size,
digest, digest_size, digest, digest_size,
@ -333,8 +334,8 @@ int w_e_send_csum(struct drbd_conf *mdev, struct drbd_work *w, int cancel)
} }
out: out:
if (e) if (peer_req)
drbd_free_ee(mdev, e); drbd_free_ee(mdev, peer_req);
if (unlikely(!ok)) if (unlikely(!ok))
dev_err(DEV, "drbd_send_drequest(..., csum) failed\n"); dev_err(DEV, "drbd_send_drequest(..., csum) failed\n");
@ -345,7 +346,7 @@ int w_e_send_csum(struct drbd_conf *mdev, struct drbd_work *w, int cancel)
static int read_for_csum(struct drbd_conf *mdev, sector_t sector, int size) static int read_for_csum(struct drbd_conf *mdev, sector_t sector, int size)
{ {
struct drbd_peer_request *e; struct drbd_peer_request *peer_req;
if (!get_ldev(mdev)) if (!get_ldev(mdev))
return -EIO; return -EIO;
@ -355,17 +356,17 @@ static int read_for_csum(struct drbd_conf *mdev, sector_t sector, int size)
/* GFP_TRY, because if there is no memory available right now, this may /* GFP_TRY, because if there is no memory available right now, this may
* be rescheduled for later. It is "only" background resync, after all. */ * be rescheduled for later. It is "only" background resync, after all. */
e = drbd_alloc_ee(mdev, ID_SYNCER /* unused */, sector, size, GFP_TRY); peer_req = drbd_alloc_ee(mdev, ID_SYNCER /* unused */, sector, size, GFP_TRY);
if (!e) if (!peer_req)
goto defer; goto defer;
e->w.cb = w_e_send_csum; peer_req->w.cb = w_e_send_csum;
spin_lock_irq(&mdev->tconn->req_lock); spin_lock_irq(&mdev->tconn->req_lock);
list_add(&e->w.list, &mdev->read_ee); list_add(&peer_req->w.list, &mdev->read_ee);
spin_unlock_irq(&mdev->tconn->req_lock); spin_unlock_irq(&mdev->tconn->req_lock);
atomic_add(size >> 9, &mdev->rs_sect_ev); atomic_add(size >> 9, &mdev->rs_sect_ev);
if (drbd_submit_ee(mdev, e, READ, DRBD_FAULT_RS_RD) == 0) if (drbd_submit_ee(mdev, peer_req, READ, DRBD_FAULT_RS_RD) == 0)
return 0; return 0;
/* If it failed because of ENOMEM, retry should help. If it failed /* If it failed because of ENOMEM, retry should help. If it failed
@ -373,10 +374,10 @@ static int read_for_csum(struct drbd_conf *mdev, sector_t sector, int size)
* retry may or may not help. * retry may or may not help.
* If it does not, you may need to force disconnect. */ * If it does not, you may need to force disconnect. */
spin_lock_irq(&mdev->tconn->req_lock); spin_lock_irq(&mdev->tconn->req_lock);
list_del(&e->w.list); list_del(&peer_req->w.list);
spin_unlock_irq(&mdev->tconn->req_lock); spin_unlock_irq(&mdev->tconn->req_lock);
drbd_free_ee(mdev, e); drbd_free_ee(mdev, peer_req);
defer: defer:
put_ldev(mdev); put_ldev(mdev);
return -EAGAIN; return -EAGAIN;
@ -901,19 +902,19 @@ int drbd_resync_finished(struct drbd_conf *mdev)
} }
/* helper */ /* helper */
static void move_to_net_ee_or_free(struct drbd_conf *mdev, struct drbd_peer_request *e) static void move_to_net_ee_or_free(struct drbd_conf *mdev, struct drbd_peer_request *peer_req)
{ {
if (drbd_ee_has_active_page(e)) { if (drbd_ee_has_active_page(peer_req)) {
/* This might happen if sendpage() has not finished */ /* This might happen if sendpage() has not finished */
int i = (e->i.size + PAGE_SIZE -1) >> PAGE_SHIFT; int i = (peer_req->i.size + PAGE_SIZE -1) >> PAGE_SHIFT;
atomic_add(i, &mdev->pp_in_use_by_net); atomic_add(i, &mdev->pp_in_use_by_net);
atomic_sub(i, &mdev->pp_in_use); atomic_sub(i, &mdev->pp_in_use);
spin_lock_irq(&mdev->tconn->req_lock); spin_lock_irq(&mdev->tconn->req_lock);
list_add_tail(&e->w.list, &mdev->net_ee); list_add_tail(&peer_req->w.list, &mdev->net_ee);
spin_unlock_irq(&mdev->tconn->req_lock); spin_unlock_irq(&mdev->tconn->req_lock);
wake_up(&drbd_pp_wait); wake_up(&drbd_pp_wait);
} else } else
drbd_free_ee(mdev, e); drbd_free_ee(mdev, peer_req);
} }
/** /**
@ -924,28 +925,28 @@ static void move_to_net_ee_or_free(struct drbd_conf *mdev, struct drbd_peer_requ
*/ */
int w_e_end_data_req(struct drbd_conf *mdev, struct drbd_work *w, int cancel) int w_e_end_data_req(struct drbd_conf *mdev, struct drbd_work *w, int cancel)
{ {
struct drbd_peer_request *e = container_of(w, struct drbd_peer_request, w); struct drbd_peer_request *peer_req = container_of(w, struct drbd_peer_request, w);
int ok; int ok;
if (unlikely(cancel)) { if (unlikely(cancel)) {
drbd_free_ee(mdev, e); drbd_free_ee(mdev, peer_req);
dec_unacked(mdev); dec_unacked(mdev);
return 1; return 1;
} }
if (likely((e->flags & EE_WAS_ERROR) == 0)) { if (likely((peer_req->flags & EE_WAS_ERROR) == 0)) {
ok = drbd_send_block(mdev, P_DATA_REPLY, e); ok = drbd_send_block(mdev, P_DATA_REPLY, peer_req);
} else { } else {
if (__ratelimit(&drbd_ratelimit_state)) if (__ratelimit(&drbd_ratelimit_state))
dev_err(DEV, "Sending NegDReply. sector=%llus.\n", dev_err(DEV, "Sending NegDReply. sector=%llus.\n",
(unsigned long long)e->i.sector); (unsigned long long)peer_req->i.sector);
ok = drbd_send_ack(mdev, P_NEG_DREPLY, e); ok = drbd_send_ack(mdev, P_NEG_DREPLY, peer_req);
} }
dec_unacked(mdev); dec_unacked(mdev);
move_to_net_ee_or_free(mdev, e); move_to_net_ee_or_free(mdev, peer_req);
if (unlikely(!ok)) if (unlikely(!ok))
dev_err(DEV, "drbd_send_block() failed\n"); dev_err(DEV, "drbd_send_block() failed\n");
@ -960,26 +961,26 @@ int w_e_end_data_req(struct drbd_conf *mdev, struct drbd_work *w, int cancel)
*/ */
int w_e_end_rsdata_req(struct drbd_conf *mdev, struct drbd_work *w, int cancel) int w_e_end_rsdata_req(struct drbd_conf *mdev, struct drbd_work *w, int cancel)
{ {
struct drbd_peer_request *e = container_of(w, struct drbd_peer_request, w); struct drbd_peer_request *peer_req = container_of(w, struct drbd_peer_request, w);
int ok; int ok;
if (unlikely(cancel)) { if (unlikely(cancel)) {
drbd_free_ee(mdev, e); drbd_free_ee(mdev, peer_req);
dec_unacked(mdev); dec_unacked(mdev);
return 1; return 1;
} }
if (get_ldev_if_state(mdev, D_FAILED)) { if (get_ldev_if_state(mdev, D_FAILED)) {
drbd_rs_complete_io(mdev, e->i.sector); drbd_rs_complete_io(mdev, peer_req->i.sector);
put_ldev(mdev); put_ldev(mdev);
} }
if (mdev->state.conn == C_AHEAD) { if (mdev->state.conn == C_AHEAD) {
ok = drbd_send_ack(mdev, P_RS_CANCEL, e); ok = drbd_send_ack(mdev, P_RS_CANCEL, peer_req);
} else if (likely((e->flags & EE_WAS_ERROR) == 0)) { } else if (likely((peer_req->flags & EE_WAS_ERROR) == 0)) {
if (likely(mdev->state.pdsk >= D_INCONSISTENT)) { if (likely(mdev->state.pdsk >= D_INCONSISTENT)) {
inc_rs_pending(mdev); inc_rs_pending(mdev);
ok = drbd_send_block(mdev, P_RS_DATA_REPLY, e); ok = drbd_send_block(mdev, P_RS_DATA_REPLY, peer_req);
} else { } else {
if (__ratelimit(&drbd_ratelimit_state)) if (__ratelimit(&drbd_ratelimit_state))
dev_err(DEV, "Not sending RSDataReply, " dev_err(DEV, "Not sending RSDataReply, "
@ -989,17 +990,17 @@ int w_e_end_rsdata_req(struct drbd_conf *mdev, struct drbd_work *w, int cancel)
} else { } else {
if (__ratelimit(&drbd_ratelimit_state)) if (__ratelimit(&drbd_ratelimit_state))
dev_err(DEV, "Sending NegRSDReply. sector %llus.\n", dev_err(DEV, "Sending NegRSDReply. sector %llus.\n",
(unsigned long long)e->i.sector); (unsigned long long)peer_req->i.sector);
ok = drbd_send_ack(mdev, P_NEG_RS_DREPLY, e); ok = drbd_send_ack(mdev, P_NEG_RS_DREPLY, peer_req);
/* update resync data with failure */ /* update resync data with failure */
drbd_rs_failed_io(mdev, e->i.sector, e->i.size); drbd_rs_failed_io(mdev, peer_req->i.sector, peer_req->i.size);
} }
dec_unacked(mdev); dec_unacked(mdev);
move_to_net_ee_or_free(mdev, e); move_to_net_ee_or_free(mdev, peer_req);
if (unlikely(!ok)) if (unlikely(!ok))
dev_err(DEV, "drbd_send_block() failed\n"); dev_err(DEV, "drbd_send_block() failed\n");
@ -1008,26 +1009,26 @@ int w_e_end_rsdata_req(struct drbd_conf *mdev, struct drbd_work *w, int cancel)
int w_e_end_csum_rs_req(struct drbd_conf *mdev, struct drbd_work *w, int cancel) int w_e_end_csum_rs_req(struct drbd_conf *mdev, struct drbd_work *w, int cancel)
{ {
struct drbd_peer_request *e = container_of(w, struct drbd_peer_request, w); struct drbd_peer_request *peer_req = container_of(w, struct drbd_peer_request, w);
struct digest_info *di; struct digest_info *di;
int digest_size; int digest_size;
void *digest = NULL; void *digest = NULL;
int ok, eq = 0; int ok, eq = 0;
if (unlikely(cancel)) { if (unlikely(cancel)) {
drbd_free_ee(mdev, e); drbd_free_ee(mdev, peer_req);
dec_unacked(mdev); dec_unacked(mdev);
return 1; return 1;
} }
if (get_ldev(mdev)) { if (get_ldev(mdev)) {
drbd_rs_complete_io(mdev, e->i.sector); drbd_rs_complete_io(mdev, peer_req->i.sector);
put_ldev(mdev); put_ldev(mdev);
} }
di = e->digest; di = peer_req->digest;
if (likely((e->flags & EE_WAS_ERROR) == 0)) { if (likely((peer_req->flags & EE_WAS_ERROR) == 0)) {
/* quick hack to try to avoid a race against reconfiguration. /* quick hack to try to avoid a race against reconfiguration.
* a real fix would be much more involved, * a real fix would be much more involved,
* introducing more locking mechanisms */ * introducing more locking mechanisms */
@ -1037,31 +1038,31 @@ int w_e_end_csum_rs_req(struct drbd_conf *mdev, struct drbd_work *w, int cancel)
digest = kmalloc(digest_size, GFP_NOIO); digest = kmalloc(digest_size, GFP_NOIO);
} }
if (digest) { if (digest) {
drbd_csum_ee(mdev, mdev->csums_tfm, e, digest); drbd_csum_ee(mdev, mdev->csums_tfm, peer_req, digest);
eq = !memcmp(digest, di->digest, digest_size); eq = !memcmp(digest, di->digest, digest_size);
kfree(digest); kfree(digest);
} }
if (eq) { if (eq) {
drbd_set_in_sync(mdev, e->i.sector, e->i.size); drbd_set_in_sync(mdev, peer_req->i.sector, peer_req->i.size);
/* rs_same_csums unit is BM_BLOCK_SIZE */ /* rs_same_csums unit is BM_BLOCK_SIZE */
mdev->rs_same_csum += e->i.size >> BM_BLOCK_SHIFT; mdev->rs_same_csum += peer_req->i.size >> BM_BLOCK_SHIFT;
ok = drbd_send_ack(mdev, P_RS_IS_IN_SYNC, e); ok = drbd_send_ack(mdev, P_RS_IS_IN_SYNC, peer_req);
} else { } else {
inc_rs_pending(mdev); inc_rs_pending(mdev);
e->block_id = ID_SYNCER; /* By setting block_id, digest pointer becomes invalid! */ peer_req->block_id = ID_SYNCER; /* By setting block_id, digest pointer becomes invalid! */
e->flags &= ~EE_HAS_DIGEST; /* This e no longer has a digest pointer */ peer_req->flags &= ~EE_HAS_DIGEST; /* This peer request no longer has a digest pointer */
kfree(di); kfree(di);
ok = drbd_send_block(mdev, P_RS_DATA_REPLY, e); ok = drbd_send_block(mdev, P_RS_DATA_REPLY, peer_req);
} }
} else { } else {
ok = drbd_send_ack(mdev, P_NEG_RS_DREPLY, e); ok = drbd_send_ack(mdev, P_NEG_RS_DREPLY, peer_req);
if (__ratelimit(&drbd_ratelimit_state)) if (__ratelimit(&drbd_ratelimit_state))
dev_err(DEV, "Sending NegDReply. I guess it gets messy.\n"); dev_err(DEV, "Sending NegDReply. I guess it gets messy.\n");
} }
dec_unacked(mdev); dec_unacked(mdev);
move_to_net_ee_or_free(mdev, e); move_to_net_ee_or_free(mdev, peer_req);
if (unlikely(!ok)) if (unlikely(!ok))
dev_err(DEV, "drbd_send_block/ack() failed\n"); dev_err(DEV, "drbd_send_block/ack() failed\n");
@ -1071,9 +1072,9 @@ int w_e_end_csum_rs_req(struct drbd_conf *mdev, struct drbd_work *w, int cancel)
/* TODO merge common code with w_e_send_csum */ /* TODO merge common code with w_e_send_csum */
int w_e_end_ov_req(struct drbd_conf *mdev, struct drbd_work *w, int cancel) int w_e_end_ov_req(struct drbd_conf *mdev, struct drbd_work *w, int cancel)
{ {
struct drbd_peer_request *e = container_of(w, struct drbd_peer_request, w); struct drbd_peer_request *peer_req = container_of(w, struct drbd_peer_request, w);
sector_t sector = e->i.sector; sector_t sector = peer_req->i.sector;
unsigned int size = e->i.size; unsigned int size = peer_req->i.size;
int digest_size; int digest_size;
void *digest; void *digest;
int ok = 1; int ok = 1;
@ -1088,8 +1089,8 @@ int w_e_end_ov_req(struct drbd_conf *mdev, struct drbd_work *w, int cancel)
goto out; goto out;
} }
if (likely(!(e->flags & EE_WAS_ERROR))) if (likely(!(peer_req->flags & EE_WAS_ERROR)))
drbd_csum_ee(mdev, mdev->verify_tfm, e, digest); drbd_csum_ee(mdev, mdev->verify_tfm, peer_req, digest);
else else
memset(digest, 0, digest_size); memset(digest, 0, digest_size);
@ -1098,8 +1099,8 @@ int w_e_end_ov_req(struct drbd_conf *mdev, struct drbd_work *w, int cancel)
* some distributed deadlock, if the other side blocks on * some distributed deadlock, if the other side blocks on
* congestion as well, because our receiver blocks in * congestion as well, because our receiver blocks in
* drbd_pp_alloc due to pp_in_use > max_buffers. */ * drbd_pp_alloc due to pp_in_use > max_buffers. */
drbd_free_ee(mdev, e); drbd_free_ee(mdev, peer_req);
e = NULL; peer_req = NULL;
inc_rs_pending(mdev); inc_rs_pending(mdev);
ok = drbd_send_drequest_csum(mdev, sector, size, ok = drbd_send_drequest_csum(mdev, sector, size,
digest, digest_size, digest, digest_size,
@ -1109,8 +1110,8 @@ int w_e_end_ov_req(struct drbd_conf *mdev, struct drbd_work *w, int cancel)
kfree(digest); kfree(digest);
out: out:
if (e) if (peer_req)
drbd_free_ee(mdev, e); drbd_free_ee(mdev, peer_req);
dec_unacked(mdev); dec_unacked(mdev);
return ok; return ok;
} }
@ -1128,16 +1129,16 @@ void drbd_ov_oos_found(struct drbd_conf *mdev, sector_t sector, int size)
int w_e_end_ov_reply(struct drbd_conf *mdev, struct drbd_work *w, int cancel) int w_e_end_ov_reply(struct drbd_conf *mdev, struct drbd_work *w, int cancel)
{ {
struct drbd_peer_request *e = container_of(w, struct drbd_peer_request, w); struct drbd_peer_request *peer_req = container_of(w, struct drbd_peer_request, w);
struct digest_info *di; struct digest_info *di;
void *digest; void *digest;
sector_t sector = e->i.sector; sector_t sector = peer_req->i.sector;
unsigned int size = e->i.size; unsigned int size = peer_req->i.size;
int digest_size; int digest_size;
int ok, eq = 0; int ok, eq = 0;
if (unlikely(cancel)) { if (unlikely(cancel)) {
drbd_free_ee(mdev, e); drbd_free_ee(mdev, peer_req);
dec_unacked(mdev); dec_unacked(mdev);
return 1; return 1;
} }
@ -1145,17 +1146,17 @@ int w_e_end_ov_reply(struct drbd_conf *mdev, struct drbd_work *w, int cancel)
/* after "cancel", because after drbd_disconnect/drbd_rs_cancel_all /* after "cancel", because after drbd_disconnect/drbd_rs_cancel_all
* the resync lru has been cleaned up already */ * the resync lru has been cleaned up already */
if (get_ldev(mdev)) { if (get_ldev(mdev)) {
drbd_rs_complete_io(mdev, e->i.sector); drbd_rs_complete_io(mdev, peer_req->i.sector);
put_ldev(mdev); put_ldev(mdev);
} }
di = e->digest; di = peer_req->digest;
if (likely((e->flags & EE_WAS_ERROR) == 0)) { if (likely((peer_req->flags & EE_WAS_ERROR) == 0)) {
digest_size = crypto_hash_digestsize(mdev->verify_tfm); digest_size = crypto_hash_digestsize(mdev->verify_tfm);
digest = kmalloc(digest_size, GFP_NOIO); digest = kmalloc(digest_size, GFP_NOIO);
if (digest) { if (digest) {
drbd_csum_ee(mdev, mdev->verify_tfm, e, digest); drbd_csum_ee(mdev, mdev->verify_tfm, peer_req, digest);
D_ASSERT(digest_size == di->digest_size); D_ASSERT(digest_size == di->digest_size);
eq = !memcmp(digest, di->digest, digest_size); eq = !memcmp(digest, di->digest, digest_size);
@ -1168,7 +1169,7 @@ int w_e_end_ov_reply(struct drbd_conf *mdev, struct drbd_work *w, int cancel)
* some distributed deadlock, if the other side blocks on * some distributed deadlock, if the other side blocks on
* congestion as well, because our receiver blocks in * congestion as well, because our receiver blocks in
* drbd_pp_alloc due to pp_in_use > max_buffers. */ * drbd_pp_alloc due to pp_in_use > max_buffers. */
drbd_free_ee(mdev, e); drbd_free_ee(mdev, peer_req);
if (!eq) if (!eq)
drbd_ov_oos_found(mdev, sector, size); drbd_ov_oos_found(mdev, sector, size);
else else