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.
- [PATCH v4 05/15] btrfs: Populate ->orig_block_len durin... Nikolay Borisov
- [PATCH v4 02/15] btrfs: combine device update operations d... Nikolay Borisov
- [PATCH v4 15/15] btrfs: Switch btrfs_trim_free_extents to ... Nikolay Borisov
- [PATCH v4 07/15] btrfs: Implement set_extent_bits_nowait Nikolay Borisov
- [PATCH v4 13/15] btrfs: Optimize unallocated chunks discar... Nikolay Borisov
- Re: [PATCH v4 13/15] btrfs: Optimize unallocated chun... David Sterba
- Re: [PATCH v4 13/15] btrfs: Optimize unallocated ... Nikolay Borisov
- [PATCH v4 09/15] btrfs: replace pending/pinned chunks list... Nikolay Borisov
- [PATCH v4 03/15] btrfs: Handle pending/pinned chunks befor... Nikolay Borisov
- Re: [PATCH v4 03/15] btrfs: Handle pending/pinned chu... David Sterba
- Re: [PATCH v4 03/15] btrfs: Handle pending/pinned... Nikolay Borisov
- Re: [PATCH v4 03/15] btrfs: Handle pending/pi... David Sterba
- [PATCH v4 04/15] btrfs: Rename and export clear_btree_io_t... Nikolay Borisov
- [PATCH v4 08/15] btrfs: Stop using call_rcu for device fre... Nikolay Borisov
- Re: [PATCH v4 08/15] btrfs: Stop using call_rcu for d... David Sterba
- Re: [PATCH v4 08/15] btrfs: Stop using call_rcu f... Nikolay Borisov
- Re: [PATCH v4 08/15] btrfs: Stop using call_r... David Sterba
- [PATCH v4 11/15] btrfs: Remove 'trans' argument from find_... Nikolay Borisov
- [PATCH v4 14/15] btrfs: Implement find_first_clear_extent_... Nikolay Borisov
- Re: [PATCH v4 00/15] FITRIM improvement David Sterba
- Re: [PATCH v4 00/15] FITRIM improvement Nikolay Borisov