Btrfs: add a io_ctl struct and helpers for dealing with the space cache
commita67509c30079f4c5025fb19ea443fb2906c3a85e
authorJosef Bacik <josef@redhat.com>
Wed, 5 Oct 2011 19:18:58 +0000 (5 15:18 -0400)
committerJosef Bacik <josef@redhat.com>
Wed, 19 Oct 2011 19:12:52 +0000 (19 15:12 -0400)
treeff8bd615b4fd447c044f06f29e2ad3b65db35ea2
parentf75b130e9bb361850787e156c79311adb84f551e
Btrfs: add a io_ctl struct and helpers for dealing with the space cache

In writing and reading the space cache we have one big loop that keeps track of
which page we are on and then a bunch of sizeable loops underneath this big loop
to try and read/write out properly.  Especially in the write case this makes
things hugely complicated and hard to follow, and makes our error checking and
recovery equally as complex.  So add a io_ctl struct with a bunch of helpers to
keep track of the pages we have, where we are, if we have enough space etc.
This unifies how we deal with the pages we're writing and keeps all the messy
tracking internal.  This allows us to kill the big loops in both the read and
write case and makes reviewing and chaning the write and read paths much
simpler.  I've run xfstests and stress.sh on this code and it survives.  Thanks,

Signed-off-by: Josef Bacik <josef@redhat.com>
fs/btrfs/free-space-cache.c