On Thu, Nov 01, 2018 at 06:50:03PM +0200, Nikolay Borisov wrote: > > > On 1.11.18 г. 18:44 ч., David Sterba wrote: > > On Thu, Nov 01, 2018 at 09:00:56AM -0700, Omar Sandoval wrote: > >>> That was an assumption for the demonstration purposes, the wording was > >>> confusing sorry. > >> > >> Oh, well in that case, that's exactly what kthread_park() is ;) Stop the > >> thread and make wake_up a noop, and then we don't need to add special > >> cases everywhere else. > > > > The end result is equivalent and should be, I'm now weighing both > > approaches. Explicit state tracking outside of the thread structures > > seems more clear and in case we want to query the status, we can't after > > kthread_stop is called. My current version below. > > > > <snip> > > > +static inline void btrfs_wake_up_transaction(struct btrfs_fs_info *fs_info) > > +{ > > + if (!test_bit(BTRFS_FS_CLOSING_SINGLE, &fs_info->flags)) { > > Why do we need a separate flag for a predicate? If we use > FS_CLOSING_START then waking up becomes a noop from the moment > close_ctree is called.
Yeah it's not strictly necessary, it's a leftover from when I had a WARN_ON in the wakeup helpers that triggered too often so another flag was added just after the threads were stopped.