Btrfs: unplug every once and a while
authorChris Mason <chris.mason@oracle.com>
Thu, 15 Dec 2011 20:38:41 +0000 (15:38 -0500)
committerChris Mason <chris.mason@oracle.com>
Thu, 15 Dec 2011 20:38:41 +0000 (15:38 -0500)
The btrfs io submission threads can build up massive plug lists.  This
keeps things more reasonable so we don't hand over huge dumps of IO at
once.

Signed-off-by: Chris Mason <chris.mason@oracle.com>
fs/btrfs/volumes.c

index 91ea57a1474ac38644a5d5bb2612b6b10048c3ce..f4b839fd3c9dd5cd854cb7bada4e3831d8ea1713 100644 (file)
@@ -295,6 +295,12 @@ loop_lock:
                        btrfs_requeue_work(&device->work);
                        goto done;
                }
+               /* unplug every 64 requests just for good measure */
+               if (batch_run % 64 == 0) {
+                       blk_finish_plug(&plug);
+                       blk_start_plug(&plug);
+                       sync_pending = 0;
+               }
        }
 
        cond_resched();