Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 346060
b: refs/heads/master
c: 7dc1d67
h: refs/heads/master
v: v3
  • Loading branch information
Lars Ellenberg authored and Philipp Reisner committed Nov 8, 2012
1 parent 57a0fbd commit b28e986
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 9 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: 6139f60dc192e2c5478c1126d1aff7905dc0a98a
refs/heads/master: 7dc1d67f7c324e5bf23883b94508112ca7a70f62
18 changes: 10 additions & 8 deletions trunk/drivers/block/drbd/drbd_actlog.c
Original file line number Diff line number Diff line change
Expand Up @@ -212,27 +212,29 @@ void drbd_al_begin_io(struct drbd_conf *mdev, struct drbd_interval *i)
unsigned first = i->sector >> (AL_EXTENT_SHIFT-9);
unsigned last = (i->sector + (i->size >> 9) - 1) >> (AL_EXTENT_SHIFT-9);
unsigned enr;
bool locked = false;


D_ASSERT(atomic_read(&mdev->local_cnt) > 0);

for (enr = first; enr <= last; enr++)
wait_event(mdev->al_wait, _al_get(mdev, enr) != NULL);

if (mdev->act_log->pending_changes) {
/* Serialize multiple transactions.
* This uses test_and_set_bit, memory barrier is implicit.
*/
wait_event(mdev->al_wait,
mdev->act_log->pending_changes == 0 ||
(locked = lc_try_lock_for_transaction(mdev->act_log)));

if (locked) {
/* drbd_al_write_transaction(mdev,al_ext,enr);
* recurses into generic_make_request(), which
* disallows recursion, bios being serialized on the
* current->bio_tail list now.
* we have to delegate updates to the activity log
* to the worker thread. */

/* Serialize multiple transactions.
* This uses test_and_set_bit, memory barrier is implicit.
* Optimization potential:
* first check for transaction number > old transaction number,
* so not all waiters have to lock/unlock. */
wait_event(mdev->al_wait, lc_try_lock_for_transaction(mdev->act_log));

/* Double check: it may have been committed by someone else,
* while we have been waiting for the lock. */
if (mdev->act_log->pending_changes) {
Expand Down

0 comments on commit b28e986

Please sign in to comment.