Re: [PATCH v2] btrfs: zstd ensure reclaim timer is properly cleaned up

2019-02-27 Thread Dennis Zhou
On Wed, Feb 27, 2019 at 07:36:50PM +0100, David Sterba wrote: > On Wed, Feb 27, 2019 at 01:29:16PM -0500, Dennis Zhou wrote: > > > I've noticed while reading the code, why do you use the indirect call > > > here? The wsm.ops points to btrfs_zstd_compress so free_workspace is > > > always zstd_free_

Re: [PATCH v2] btrfs: zstd ensure reclaim timer is properly cleaned up

2019-02-27 Thread David Sterba
On Wed, Feb 27, 2019 at 01:29:16PM -0500, Dennis Zhou wrote: > > I've noticed while reading the code, why do you use the indirect call > > here? The wsm.ops points to btrfs_zstd_compress so free_workspace is > > always zstd_free_workspace. > > > > The compiler is usually smart to replace such thin

Re: [PATCH v2] btrfs: zstd ensure reclaim timer is properly cleaned up

2019-02-27 Thread Dennis Zhou
On Wed, Feb 27, 2019 at 05:44:41PM +0100, David Sterba wrote: > On Fri, Feb 22, 2019 at 02:53:48PM -0500, Dennis Zhou wrote: > > The timer function, zstd_reclaim_timer_fn(), reschedules itself under > > certain conditions. When cleaning up, take the lock and remove all > > workspaces. This prevents

Re: [PATCH v2] btrfs: zstd ensure reclaim timer is properly cleaned up

2019-02-27 Thread David Sterba
On Fri, Feb 22, 2019 at 02:53:48PM -0500, Dennis Zhou wrote: > The timer function, zstd_reclaim_timer_fn(), reschedules itself under > certain conditions. When cleaning up, take the lock and remove all > workspaces. This prevents the timer from rearming itself. Lastly, switch > to del_timer_sync()

[PATCH v2] btrfs: zstd ensure reclaim timer is properly cleaned up

2019-02-22 Thread Dennis Zhou
The timer function, zstd_reclaim_timer_fn(), reschedules itself under certain conditions. When cleaning up, take the lock and remove all workspaces. This prevents the timer from rearming itself. Lastly, switch to del_timer_sync() to ensure that the timer function can't trigger as we're unloading.