Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 346231
b: refs/heads/master
c: 519b6d3
h: refs/heads/master
i:
  346229: 0afc11d
  346227: 06b82b9
  346223: 00245d8
v: v3
  • Loading branch information
Lars Ellenberg authored and Philipp Reisner committed Nov 9, 2012
1 parent 19d3255 commit 264fc77
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 4 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: 80c6eed49d5da3ba97cff4dc316ff051486cd1fc
refs/heads/master: 519b6d3eac823e4ceec10484bc06f239047cebbf
25 changes: 22 additions & 3 deletions trunk/drivers/block/drbd/drbd_req.c
Original file line number Diff line number Diff line change
Expand Up @@ -935,6 +935,20 @@ static int drbd_process_write_request(struct drbd_request *req)
send_oos = drbd_should_send_out_of_sync(mdev->state);
rcu_read_unlock();

/* Need to replicate writes. Unless it is an empty flush,
* which is better mapped to a DRBD P_BARRIER packet,
* also for drbd wire protocol compatibility reasons.
* If this was a flush, just start a new epoch.
* Unless the current epoch was empty anyways, or we are not currently
* replicating, in which case there is no point. */
if (unlikely(req->i.size == 0)) {
/* The only size==0 bios we expect are empty flushes. */
D_ASSERT(req->master_bio->bi_rw & REQ_FLUSH);
if (remote && mdev->tconn->current_tle_writes)
start_new_tl_epoch(mdev->tconn);
return 0;
}

if (!remote && !send_oos)
return 0;

Expand Down Expand Up @@ -1004,8 +1018,10 @@ void __drbd_make_request(struct drbd_conf *mdev, struct bio *bio, unsigned long
* extent. This waits for any resync activity in the corresponding
* resync extent to finish, and, if necessary, pulls in the target
* extent into the activity log, which involves further disk io because
* of transactional on-disk meta data updates. */
if (rw == WRITE && req->private_bio
* of transactional on-disk meta data updates.
* Empty flushes don't need to go into the activity log, they can only
* flush data for pending writes which are already in there. */
if (rw == WRITE && req->private_bio && req->i.size
&& !test_bit(AL_SUSPENDED, &mdev->flags)) {
req->rq_state |= RQ_IN_ACT_LOG;
drbd_al_begin_io(mdev, &req->i);
Expand Down Expand Up @@ -1047,7 +1063,10 @@ void __drbd_make_request(struct drbd_conf *mdev, struct bio *bio, unsigned long
if (rw == WRITE)
mdev->tconn->current_tle_writes++;

list_add_tail(&req->tl_requests, &mdev->tconn->transfer_log);
/* no point in adding empty flushes to the transfer log,
* they are mapped to drbd barriers already. */
if (likely(req->i.size!=0))
list_add_tail(&req->tl_requests, &mdev->tconn->transfer_log);

if (rw == WRITE) {
if (!drbd_process_write_request(req))
Expand Down

0 comments on commit 264fc77

Please sign in to comment.