Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 147768
b: refs/heads/master
c: d84275c
h: refs/heads/master
v: v3
  • Loading branch information
Chris Mason committed Jun 10, 2009
1 parent f241b75 commit 4a23909
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 8 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: 585ad2c3797dcaa643aeba75b9f072778adf3490
refs/heads/master: d84275c938e1a5e2dc5b89eb9b878e0ddb2c55e0
22 changes: 15 additions & 7 deletions trunk/fs/btrfs/volumes.c
Original file line number Diff line number Diff line change
Expand Up @@ -163,6 +163,7 @@ static noinline int run_scheduled_bios(struct btrfs_device *device)
unsigned long num_sync_run;
unsigned long limit;
unsigned long last_waited = 0;
int force_reg = 0;

bdi = blk_get_backing_dev_info(device->bdev);
fs_info = device->dev_root->fs_info;
Expand All @@ -176,19 +177,22 @@ static noinline int run_scheduled_bios(struct btrfs_device *device)

loop:
spin_lock(&device->io_lock);
num_run = 0;

loop_lock:
num_run = 0;

/* take all the bios off the list at once and process them
* later on (without the lock held). But, remember the
* tail and other pointers so the bios can be properly reinserted
* into the list if we hit congestion
*/
if (device->pending_sync_bios.head)
if (!force_reg && device->pending_sync_bios.head) {
pending_bios = &device->pending_sync_bios;
else
force_reg = 1;
} else {
pending_bios = &device->pending_bios;
force_reg = 0;
}

pending = pending_bios->head;
tail = pending_bios->tail;
Expand Down Expand Up @@ -228,10 +232,14 @@ static noinline int run_scheduled_bios(struct btrfs_device *device)
while (pending) {

rmb();
if (pending_bios != &device->pending_sync_bios &&
device->pending_sync_bios.head &&
num_run > 16) {
cond_resched();
/* we want to work on both lists, but do more bios on the
* sync list than the regular list
*/
if ((num_run > 32 &&
pending_bios != &device->pending_sync_bios &&
device->pending_sync_bios.head) ||
(num_run > 64 && pending_bios == &device->pending_sync_bios &&
device->pending_bios.head)) {
spin_lock(&device->io_lock);
requeue_list(pending_bios, pending, tail);
goto loop_lock;
Expand Down

0 comments on commit 4a23909

Please sign in to comment.