On Wed, Mar 27, 2019 at 02:24:06PM +0200, Nikolay Borisov wrote: > During device shrink pinned/pending chunks (i.e those which have been > deleted/created respectively, in the current transaction and haven't > touched disk) need to be accounted when doing device shrink. Presently > this happens after the main relocation loop in btrfs_shrink_device, > which could lead to making another go in the body of the function. > > Since there is no hard requirement to perform pinned/pending chunks > handling after the relocation loop, move the code before it. This leads > to simplifying the code flow around - i.e no need to use 'goto again'.
On the other hand this starts 2 transactions unconditionally, previously it was 1 for the final change and 1 if there were pending chunks. This should be mentioned or explained why this is needed, otherwise the code looks equivalent to the original version. In this case some guidance in the changelog could shorten the time to understand the change, I've been starting at it for half an hour.