]> git.proxmox.com Git - mirror_ubuntu-bionic-kernel.git/commit
xfs: reduce lock hold times in buffer writeback
authorDave Chinner <dchinner@redhat.com>
Wed, 1 Jun 2016 07:38:15 +0000 (17:38 +1000)
committerDave Chinner <david@fromorbit.com>
Wed, 1 Jun 2016 07:38:15 +0000 (17:38 +1000)
commit26f1fe858f2744edfc75e92d34a6be0af5e8b45d
tree8a1c5679ed28cfb5815f6fe3ecaa549ef1a26905
parent4478fb1f2db4b1473969ed24cf18264e3a4b1d79
xfs: reduce lock hold times in buffer writeback

When we have a lot of metadata to flush from the AIL, the buffer
list can get very long. The current submission code tries to batch
submission to optimise IO order of the metadata (i.e. ascending
block order) to maximise block layer merging or IO to adjacent
metadata blocks.

Unfortunately, the method used can result in long lock times
occurring as buffers locked early on in the buffer list might not be
dispatched until the end of the IO licst processing. This is because
sorting does not occur util after the buffer list has been processed
and the buffers that are going to be submitted are locked. Hence
when the buffer list is several thousand buffers long, the lock hold
times before IO dispatch can be significant.

To fix this, sort the buffer list before we start trying to lock and
submit buffers. This means we can now submit buffers immediately
after they are locked, allowing merging to occur immediately on the
plug and dispatch to occur as quickly as possible. This means there
is minimal delay between locking the buffer and IO submission
occuring, hence reducing the worst case lock hold times seen during
delayed write buffer IO submission signficantly.

Signed-off-by: Dave Chinner <dchinner@redhat.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Carlos Maiolino <cmaiolino@redhat.com>
Signed-off-by: Dave Chinner <david@fromorbit.com>
fs/xfs/xfs_buf.c