On 1.04.19 г. 21:44 ч., David Sterba wrote: > On Wed, Mar 27, 2019 at 02:24:16PM +0200, Nikolay Borisov wrote: >> Currently unallocated chunks are always trimmed. For example >> 2 consecutive trims on large storage would trim freespace twice >> irrespective of whether the space was actually allocated or not between >> those trims. >> >> Optimise this behavior by exploiting the newly introduced alloc_state >> tree of btrfs_device. A new CHUNK_TRIMMED bit is used to mark >> those unallocated chunks which have been trimmed and have not been >> allocated afterwards. On chunk allocation the respective underlying devices' >> physical space will have its CHUNK_TRIMMED flag cleared. This avoids >> submitting discards for space which hasn't been changed since the last >> time discard was issued. > > This means during one mount, right? Because the state is not recorded > on-disk anywhere. This also means that a complete unmount / mount > followed by trim will do the discard on the freed blocks again. I don't > thik there's anything wrong with that, just that this should be put to > the docs. Correct, on unmount btrfs_close_devices is called which frees trim state. >
- [PATCH v4 01/15] btrfs: Honour FITRIM range constraints du... Nikolay Borisov
- [PATCH v4 06/15] btrfs: Introduce new bits for device allo... Nikolay Borisov
- [PATCH v4 10/15] btrfs: Transpose btrfs_close_devices/btrf... Nikolay Borisov
- [PATCH v4 12/15] btrfs: Factor out in_range macro Nikolay Borisov
- [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