block: simplify bio_check_pages_dirty
authorChristoph Hellwig <hch@lst.de>
Tue, 24 Jul 2018 12:04:12 +0000 (14:04 +0200)
committerJens Axboe <axboe@kernel.dk>
Tue, 24 Jul 2018 20:39:27 +0000 (14:39 -0600)
commit24d5493f207ce0ce38df80ce86c907417e04594a
tree5b4239636db01bf3f2a173ae4f32228afc8ce873
parent76f17d8ba1cbc3d2786955b2f15e071da93527cd
block: simplify bio_check_pages_dirty

bio_check_pages_dirty currently inviolates the invariant that bv_page of
a bio_vec inside bi_vcnt shouldn't be zero, and that is going to become
really annoying with multpath biovecs.  Fortunately there isn't any
all that good reason for it - once we decide to defer freeing the bio
to a workqueue holding onto a few additional pages isn't really an
issue anymore.  So just check if there is a clean page that needs
dirtying in the first path, and do a second pass to free them if there
was none, while the cache is still hot.

Also use the chance to micro-optimize bio_dirty_fn a bit by not saving
irq state - we know we are called from a workqueue.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Ming Lei <ming.lei@redhat.com>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
block/bio.c