raid5-cache: free I/O units earlier
authorChristoph Hellwig <hch@lst.de>
Mon, 5 Oct 2015 07:31:06 +0000 (09:31 +0200)
committerNeilBrown <neilb@suse.com>
Sun, 1 Nov 2015 02:48:27 +0000 (13:48 +1100)
commit170364619ac21c2b14869571eeaf767ae825f96c
treedb7a32b63816e0523aef421588aedd8b99402180
parente6c033f79a0a1e9ca850575dcfa51bb583b592fa
raid5-cache: free I/O units earlier

There is no good reason to keep the I/O unit structures around after the
stripe has been written back to the RAID array.  The only information
we need is the log sequence number, and the checkpoint offset of the
highest successfull writeback.  Store those in the log structure, and
free the IO units from __r5l_stripe_write_finished.

Besides simplifying the code this also avoid having to keep the allocation
for the I/O unit around for a potentially long time as superblock updates
that checkpoint the log do not happen very often.

This also fixes the previously incorrect calculation of 'free' in
r5l_do_reclaim as a side effect: previous if took the last unit which
isn't checkpointed into account.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Shaohua Li <shli@fb.com>
Signed-off-by: NeilBrown <neilb@suse.com>
drivers/md/raid5-cache.c