journal.c (c13f3af9247db929fe1be86c0442ef161e615ac4) | journal.c (2a285686c109816ba71a00b9278262cf02648258) |
---|---|
1/* 2 * bcache journalling code, for btree insertions 3 * 4 * Copyright 2012 Google, Inc. 5 */ 6 7#include "bcache.h" 8#include "btree.h" --- 367 unchanged lines hidden (view full) --- 376 btree_current_write(best)->journal, 377 btree_current_write(b)->journal)) { 378 best = b; 379 } 380 } 381 382 b = best; 383 if (b) { | 1/* 2 * bcache journalling code, for btree insertions 3 * 4 * Copyright 2012 Google, Inc. 5 */ 6 7#include "bcache.h" 8#include "btree.h" --- 367 unchanged lines hidden (view full) --- 376 btree_current_write(best)->journal, 377 btree_current_write(b)->journal)) { 378 best = b; 379 } 380 } 381 382 b = best; 383 if (b) { |
384 rw_lock(true, b, b->level); 385 | 384 mutex_lock(&b->write_lock); |
386 if (!btree_current_write(b)->journal) { | 385 if (!btree_current_write(b)->journal) { |
387 rw_unlock(true, b); | 386 mutex_unlock(&b->write_lock); |
388 /* We raced */ 389 goto retry; 390 } 391 | 387 /* We raced */ 388 goto retry; 389 } 390 |
392 bch_btree_node_write(b, NULL); 393 rw_unlock(true, b); | 391 __bch_btree_node_write(b, NULL); 392 mutex_unlock(&b->write_lock); |
394 } 395} 396 397#define last_seq(j) ((j)->seq - fifo_used(&(j)->pin) + 1) 398 399static void journal_discard_endio(struct bio *bio, int error) 400{ 401 struct journal_device *ja = --- 415 unchanged lines hidden --- | 393 } 394} 395 396#define last_seq(j) ((j)->seq - fifo_used(&(j)->pin) + 1) 397 398static void journal_discard_endio(struct bio *bio, int error) 399{ 400 struct journal_device *ja = --- 415 unchanged lines hidden --- |