Linux Btrfs filesystem development
 help / color / mirror / Atom feed
From: Boris Burkov <boris@bur.io>
To: linux-btrfs@vger.kernel.org, Filipe Manana <fdmanana@suse.com>
Subject: Re: [PATCH] btrfs: directly wake up cleaner kthread in the BTRFS_IOC_SYNC ioctl
Date: Wed, 7 Aug 2024 11:25:15 -0700	[thread overview]
Message-ID: <ZrO8C/hMDp52cYXs@devvm12410.ftw0.facebook.com> (raw)
In-Reply-To: <b4c0f0bc574a1b105a02132c2ebedb0e31f235eb.1723052137.git.fdmanana@suse.com>

On Wed, Aug 07, 2024 at 06:47:50PM +0100, Filipe Manana wrote:
> The BTRFS_IOC_SYNC ioctl wants to wake up the cleaner kthread so that it
> does any pending work (subvolume deletion, delayed iputs, etc), however
> it is waking up the transaction kthread, which in turn wakes up the
> cleaner. Since we don't have any transaction to commit, as any ongoing
> transaction was already committed when it called btrfs_sync_fs() and
> the goal is just to wake up the cleaner thread, directly wake up the
> cleaner instead of the transaction kthread.
> 
> Signed-off-by: Filipe Manana <fdmanana@suse.com>
Reviewed-by: Boris Burkov <boris@bur.io>
> ---
>  fs/btrfs/ioctl.c | 7 +++----
>  1 file changed, 3 insertions(+), 4 deletions(-)
> 
> diff --git a/fs/btrfs/ioctl.c b/fs/btrfs/ioctl.c
> index e0a664b8a46a..ee01cc828883 100644
> --- a/fs/btrfs/ioctl.c
> +++ b/fs/btrfs/ioctl.c
> @@ -4765,11 +4765,10 @@ long btrfs_ioctl(struct file *file, unsigned int
>  			return ret;
>  		ret = btrfs_sync_fs(inode->i_sb, 1);
>  		/*
> -		 * The transaction thread may want to do more work,
> -		 * namely it pokes the cleaner kthread that will start
> -		 * processing uncleaned subvols.
> +		 * There may be work for the cleaner kthread to do (subvolume
> +		 * deletion, delayed iputs, defrag inodes, etc), so wake it up.
>  		 */
> -		wake_up_process(fs_info->transaction_kthread);
> +		wake_up_process(fs_info->cleaner_kthread);
>  		return ret;
>  	}
>  	case BTRFS_IOC_START_SYNC:
> -- 
> 2.43.0

  reply	other threads:[~2024-08-07 18:25 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-08-07 17:47 [PATCH] btrfs: directly wake up cleaner kthread in the BTRFS_IOC_SYNC ioctl fdmanana
2024-08-07 18:25 ` Boris Burkov [this message]
2024-08-07 22:27 ` Qu Wenruo

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=ZrO8C/hMDp52cYXs@devvm12410.ftw0.facebook.com \
    --to=boris@bur.io \
    --cc=fdmanana@suse.com \
    --cc=linux-btrfs@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox