On Tue, Apr 02, 2019 at 08:55:32AM +0300, Nikolay Borisov wrote: > > > On 1.04.19 г. 21:26 ч., David Sterba wrote: > > 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. > > > > Valid point, how about adding the following sentence at the end of the > changelog : > > A notable side effect of this change is that modification of the > device's size requires a transaction to be started and committed before > the relocation loop starts. This is necessary to ensure that relocation > process sees the shrunk device size.
Thanks, patch updated.