From nobody Wed Feb 11 14:44:09 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 4EEEDC77B75 for ; Mon, 8 May 2023 01:20:48 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232498AbjEHBTw (ORCPT ); Sun, 7 May 2023 21:19:52 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39522 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232291AbjEHBTl (ORCPT ); Sun, 7 May 2023 21:19:41 -0400 Received: from bombadil.infradead.org (bombadil.infradead.org [IPv6:2607:7c80:54:3::133]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 04996124B3; Sun, 7 May 2023 18:19:36 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20210309; h=Sender:Content-Transfer-Encoding: MIME-Version:References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From: Reply-To:Content-Type:Content-ID:Content-Description; bh=Iq+GJy0SYT3EQ729uzX+WNTK2VcOhGS7edVn1rT+bXU=; b=cxcuXLswjH61dwpHVdEYkT59Qa pleqlWyhX5duQKH30dhD/5GI2gFJvg2gpVm0Rr5DVj5BXtEU/UO4Cg6LLvBM4E1hmPL9aPqBxl/mz yLDtJZ3SgJRQ2PFgkf4vcnRyx4MTml7DGYxXqi9AwyzDmrdOZsJIX9ozSAhtBneTGZc9nJNxwGmT7 vZ2hkNH7dKAFjsV2UZFx/Q4U6QTTA0avlF9shdGnT4P1g/iHcEXuC96K33DnDeHR6BAeMet7Yh37d ZSDEURcJ8nazX9pHqEE70ymf9kQ31FdLezxqKVp2boGJXFaTsFCmMyww4rP8l5oZIA7tFlgaY6pXl dRPsB6Cw==; Received: from mcgrof by bombadil.infradead.org with local (Exim 4.96 #2 (Red Hat Linux)) id 1pvpXE-00Gw8O-1P; Mon, 08 May 2023 01:19:28 +0000 From: Luis Chamberlain To: hch@infradead.org, djwong@kernel.org, sandeen@sandeen.net, song@kernel.org, rafael@kernel.org, gregkh@linuxfoundation.org, viro@zeniv.linux.org.uk, jack@suse.cz, jikos@kernel.org, bvanassche@acm.org, ebiederm@xmission.com Cc: mchehab@kernel.org, keescook@chromium.org, p.raghav@samsung.com, da.gomez@samsung.com, linux-fsdevel@vger.kernel.org, kernel@tuxforce.de, kexec@lists.infradead.org, linux-kernel@vger.kernel.org, Luis Chamberlain Subject: [PATCH 1/3] ext4: replace kthread freezing with auto fs freezing Date: Sun, 7 May 2023 18:19:25 -0700 Message-Id: <20230508011927.4036707-2-mcgrof@kernel.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20230508011927.4036707-1-mcgrof@kernel.org> References: <20230508011927.4036707-1-mcgrof@kernel.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Sender: Luis Chamberlain Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" The kernel power management now supports allowing the VFS to handle filesystem freezing freezes and thawing. Take advantage of that and remove the kthread freezing. This is needed so that we properly really stop IO in flight without races after userspace has been frozen. Without this we rely on kthread freezing and its semantics are loose and error prone. The filesystem therefore is in charge of properly dealing with quiescing of the filesystem through its callbacks if it thinks it knows better than how the VFS handles it. The following Coccinelle rule was used as to remove the now superfluous freezer calls: make coccicheck MODE=3Dpatch SPFLAGS=3D"--in-place --no-show-diff" COCCI=3D= ./fs-freeze-cleanup.cocci M=3Dfs/ext4 virtual patch @ remove_set_freezable @ expression time; statement S, S2; expression task, current; @@ ( - set_freezable(); | - if (try_to_freeze()) - continue; | - try_to_freeze(); | - freezable_schedule(); + schedule(); | - freezable_schedule_timeout(time); + schedule_timeout(time); | - if (freezing(task)) { S } | - if (freezing(task)) { S } - else { S2 } | - freezing(current) ) @ remove_wq_freezable @ expression WQ_E, WQ_ARG1, WQ_ARG2, WQ_ARG3, WQ_ARG4; identifier fs_wq_fn; @@ ( WQ_E =3D alloc_workqueue(WQ_ARG1, - WQ_ARG2 | WQ_FREEZABLE, + WQ_ARG2, ...); | WQ_E =3D alloc_workqueue(WQ_ARG1, - WQ_ARG2 | WQ_FREEZABLE | WQ_ARG3, + WQ_ARG2 | WQ_ARG3, ...); | WQ_E =3D alloc_workqueue(WQ_ARG1, - WQ_ARG2 | WQ_ARG3 | WQ_FREEZABLE, + WQ_ARG2 | WQ_ARG3, ...); | WQ_E =3D alloc_workqueue(WQ_ARG1, - WQ_ARG2 | WQ_ARG3 | WQ_FREEZABLE | WQ_ARG4, + WQ_ARG2 | WQ_ARG3 | WQ_ARG4, ...); | WQ_E =3D - WQ_ARG1 | WQ_FREEZABLE + WQ_ARG1 | WQ_E =3D - WQ_ARG1 | WQ_FREEZABLE | WQ_ARG3 + WQ_ARG1 | WQ_ARG3 | fs_wq_fn( - WQ_FREEZABLE | WQ_ARG2 | WQ_ARG3 + WQ_ARG2 | WQ_ARG3 ) | fs_wq_fn( - WQ_FREEZABLE | WQ_ARG2 + WQ_ARG2 ) | fs_wq_fn( - WQ_FREEZABLE + 0 ) ) @ add_auto_flag @ expression E1; identifier fs_type; @@ struct file_system_type fs_type =3D { .fs_flags =3D E1 + | FS_AUTOFREEZE , }; Generated-by: Coccinelle SmPL Signed-off-by: Luis Chamberlain --- fs/ext4/super.c | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/fs/ext4/super.c b/fs/ext4/super.c index d39f386e9baf..1f436938d8be 100644 --- a/fs/ext4/super.c +++ b/fs/ext4/super.c @@ -136,7 +136,7 @@ static struct file_system_type ext2_fs_type =3D { .init_fs_context =3D ext4_init_fs_context, .parameters =3D ext4_param_specs, .kill_sb =3D kill_block_super, - .fs_flags =3D FS_REQUIRES_DEV, + .fs_flags =3D FS_REQUIRES_DEV | FS_AUTOFREEZE, }; MODULE_ALIAS_FS("ext2"); MODULE_ALIAS("ext2"); @@ -152,7 +152,7 @@ static struct file_system_type ext3_fs_type =3D { .init_fs_context =3D ext4_init_fs_context, .parameters =3D ext4_param_specs, .kill_sb =3D kill_block_super, - .fs_flags =3D FS_REQUIRES_DEV, + .fs_flags =3D FS_REQUIRES_DEV | FS_AUTOFREEZE, }; MODULE_ALIAS_FS("ext3"); MODULE_ALIAS("ext3"); @@ -3790,7 +3790,6 @@ static int ext4_lazyinit_thread(void *arg) unsigned long next_wakeup, cur; =20 BUG_ON(NULL =3D=3D eli); - set_freezable(); =20 cont_thread: while (true) { @@ -3842,8 +3841,6 @@ static int ext4_lazyinit_thread(void *arg) } mutex_unlock(&eli->li_list_mtx); =20 - try_to_freeze(); - cur =3D jiffies; if ((time_after_eq(cur, next_wakeup)) || (MAX_JIFFY_OFFSET =3D=3D next_wakeup)) { @@ -7245,7 +7242,7 @@ static struct file_system_type ext4_fs_type =3D { .init_fs_context =3D ext4_init_fs_context, .parameters =3D ext4_param_specs, .kill_sb =3D kill_block_super, - .fs_flags =3D FS_REQUIRES_DEV | FS_ALLOW_IDMAP, + .fs_flags =3D FS_REQUIRES_DEV | FS_ALLOW_IDMAP | FS_AUTOFREEZE, }; MODULE_ALIAS_FS("ext4"); =20 --=20 2.39.2 From nobody Wed Feb 11 14:44:09 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 54402C77B7C for ; Mon, 8 May 2023 01:19:57 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232473AbjEHBTr (ORCPT ); Sun, 7 May 2023 21:19:47 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39568 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232442AbjEHBTl (ORCPT ); Sun, 7 May 2023 21:19:41 -0400 Received: from bombadil.infradead.org (bombadil.infradead.org [IPv6:2607:7c80:54:3::133]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E0079120BC; Sun, 7 May 2023 18:19:34 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20210309; h=Sender:Content-Transfer-Encoding: MIME-Version:References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From: Reply-To:Content-Type:Content-ID:Content-Description; bh=EsvFyZdxKR9Xo2oUHLItivX9RP06VANJ3BHs/qzrgb8=; b=NtUMcEp2/YdBVpX/d7jO0SgEsc JY+bficTtXU0MiAkClFvxXTn1N3z4sKyVhGFd8KWbwfbGDTT7SmBZI61a1xuJuZqtMsJ5h6QMXGv0 AEgWEFOFfAV6Hp9L0Ead0gG+eyH/YOElBM5q00Ufhb4tcxiYaIjuwi+PmxHs2CbcbIPAO/2iMjiG/ cGPC8od2t7HSuhQGXLey4F5JnRqXYVUselIg/VW+jxIYeg+nR+8MoKVNfOXkF47vOrLKwaxZzjNCj 6jiGtCIukSBekGHbw4Mluj26qO48ty3HroFFQp7pLE1WKBUW3pyJYapuAOpjpgWfbmlzHfMdhnzwZ gUxYPydw==; Received: from mcgrof by bombadil.infradead.org with local (Exim 4.96 #2 (Red Hat Linux)) id 1pvpXE-00Gw8b-1Y; Mon, 08 May 2023 01:19:28 +0000 From: Luis Chamberlain To: hch@infradead.org, djwong@kernel.org, sandeen@sandeen.net, song@kernel.org, rafael@kernel.org, gregkh@linuxfoundation.org, viro@zeniv.linux.org.uk, jack@suse.cz, jikos@kernel.org, bvanassche@acm.org, ebiederm@xmission.com Cc: mchehab@kernel.org, keescook@chromium.org, p.raghav@samsung.com, da.gomez@samsung.com, linux-fsdevel@vger.kernel.org, kernel@tuxforce.de, kexec@lists.infradead.org, linux-kernel@vger.kernel.org, Luis Chamberlain Subject: [PATCH 2/3] btrfs: replace kthread freezing with auto fs freezing Date: Sun, 7 May 2023 18:19:26 -0700 Message-Id: <20230508011927.4036707-3-mcgrof@kernel.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20230508011927.4036707-1-mcgrof@kernel.org> References: <20230508011927.4036707-1-mcgrof@kernel.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Sender: Luis Chamberlain Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" The kernel power management now supports allowing the VFS to handle filesystem freezing freezes and thawing. Take advantage of that and remove the kthread freezing. This is needed so that we properly really stop IO in flight without races after userspace has been frozen. Without this we rely on kthread freezing and its semantics are loose and error prone. The filesystem therefore is in charge of properly dealing with quiescing of the filesystem through its callbacks if it thinks it knows better than how the VFS handles it. The following Coccinelle rule was used as to remove the now superfluous freezer calls: make coccicheck MODE=3Dpatch SPFLAGS=3D"--in-place --no-show-diff" COCCI=3D= ./fs-freeze-cleanup.cocci M=3Dfs/btrfs virtual patch @ remove_set_freezable @ expression time; statement S, S2; expression task, current; @@ ( - set_freezable(); | - if (try_to_freeze()) - continue; | - try_to_freeze(); | - freezable_schedule(); + schedule(); | - freezable_schedule_timeout(time); + schedule_timeout(time); | - if (freezing(task)) { S } | - if (freezing(task)) { S } - else { S2 } | - freezing(current) ) @ remove_wq_freezable @ expression WQ_E, WQ_ARG1, WQ_ARG2, WQ_ARG3, WQ_ARG4; identifier fs_wq_fn; @@ ( WQ_E =3D alloc_workqueue(WQ_ARG1, - WQ_ARG2 | WQ_FREEZABLE, + WQ_ARG2, ...); | WQ_E =3D alloc_workqueue(WQ_ARG1, - WQ_ARG2 | WQ_FREEZABLE | WQ_ARG3, + WQ_ARG2 | WQ_ARG3, ...); | WQ_E =3D alloc_workqueue(WQ_ARG1, - WQ_ARG2 | WQ_ARG3 | WQ_FREEZABLE, + WQ_ARG2 | WQ_ARG3, ...); | WQ_E =3D alloc_workqueue(WQ_ARG1, - WQ_ARG2 | WQ_ARG3 | WQ_FREEZABLE | WQ_ARG4, + WQ_ARG2 | WQ_ARG3 | WQ_ARG4, ...); | WQ_E =3D - WQ_ARG1 | WQ_FREEZABLE + WQ_ARG1 | WQ_E =3D - WQ_ARG1 | WQ_FREEZABLE | WQ_ARG3 + WQ_ARG1 | WQ_ARG3 | fs_wq_fn( - WQ_FREEZABLE | WQ_ARG2 | WQ_ARG3 + WQ_ARG2 | WQ_ARG3 ) | fs_wq_fn( - WQ_FREEZABLE | WQ_ARG2 + WQ_ARG2 ) | fs_wq_fn( - WQ_FREEZABLE + 0 ) ) @ add_auto_flag @ expression E1; identifier fs_type; @@ struct file_system_type fs_type =3D { .fs_flags =3D E1 + | FS_AUTOFREEZE , }; Generated-by: Coccinelle SmPL Signed-off-by: Luis Chamberlain --- fs/btrfs/disk-io.c | 4 ++-- fs/btrfs/scrub.c | 2 +- fs/btrfs/super.c | 4 ++-- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/fs/btrfs/disk-io.c b/fs/btrfs/disk-io.c index 59ea049fe7ee..6552ade25ef2 100644 --- a/fs/btrfs/disk-io.c +++ b/fs/btrfs/disk-io.c @@ -2176,7 +2176,7 @@ static void btrfs_init_qgroup(struct btrfs_fs_info *f= s_info) static int btrfs_init_workqueues(struct btrfs_fs_info *fs_info) { u32 max_active =3D fs_info->thread_pool_size; - unsigned int flags =3D WQ_MEM_RECLAIM | WQ_FREEZABLE | WQ_UNBOUND; + unsigned int flags =3D WQ_MEM_RECLAIM | WQ_UNBOUND; =20 fs_info->workers =3D btrfs_alloc_workqueue(fs_info, "worker", flags, max_active, 16); @@ -2217,7 +2217,7 @@ static int btrfs_init_workqueues(struct btrfs_fs_info= *fs_info) fs_info->qgroup_rescan_workers =3D btrfs_alloc_workqueue(fs_info, "qgroup-rescan", flags, 1, 0); fs_info->discard_ctl.discard_workers =3D - alloc_workqueue("btrfs_discard", WQ_UNBOUND | WQ_FREEZABLE, 1); + alloc_workqueue("btrfs_discard", WQ_UNBOUND, 1); =20 if (!(fs_info->workers && fs_info->hipri_workers && fs_info->delalloc_workers && fs_info->flush_workers && diff --git a/fs/btrfs/scrub.c b/fs/btrfs/scrub.c index 836725a19661..55b82a55de19 100644 --- a/fs/btrfs/scrub.c +++ b/fs/btrfs/scrub.c @@ -2727,7 +2727,7 @@ static noinline_for_stack int scrub_workers_get(struc= t btrfs_fs_info *fs_info, { struct workqueue_struct *scrub_workers =3D NULL; struct workqueue_struct *scrub_wr_comp =3D NULL; - unsigned int flags =3D WQ_FREEZABLE | WQ_UNBOUND; + unsigned int flags =3D WQ_UNBOUND; int max_active =3D fs_info->thread_pool_size; int ret =3D -ENOMEM; =20 diff --git a/fs/btrfs/super.c b/fs/btrfs/super.c index 0f2f915e42b0..2c08c2a37b8b 100644 --- a/fs/btrfs/super.c +++ b/fs/btrfs/super.c @@ -2145,7 +2145,7 @@ static struct file_system_type btrfs_fs_type =3D { .name =3D "btrfs", .mount =3D btrfs_mount, .kill_sb =3D btrfs_kill_super, - .fs_flags =3D FS_REQUIRES_DEV | FS_BINARY_MOUNTDATA, + .fs_flags =3D FS_REQUIRES_DEV | FS_BINARY_MOUNTDATA | FS_AUTOFREEZE, }; =20 static struct file_system_type btrfs_root_fs_type =3D { @@ -2153,7 +2153,7 @@ static struct file_system_type btrfs_root_fs_type =3D= { .name =3D "btrfs", .mount =3D btrfs_mount_root, .kill_sb =3D btrfs_kill_super, - .fs_flags =3D FS_REQUIRES_DEV | FS_BINARY_MOUNTDATA | FS_ALLOW_IDMAP, + .fs_flags =3D FS_REQUIRES_DEV | FS_BINARY_MOUNTDATA | FS_ALLOW_IDMAP | FS= _AUTOFREEZE, }; =20 MODULE_ALIAS_FS("btrfs"); --=20 2.39.2 From nobody Wed Feb 11 14:44:09 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 87E91C7EE2C for ; Mon, 8 May 2023 01:19:59 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232355AbjEHBT5 (ORCPT ); Sun, 7 May 2023 21:19:57 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39430 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229662AbjEHBTl (ORCPT ); Sun, 7 May 2023 21:19:41 -0400 Received: from bombadil.infradead.org (bombadil.infradead.org [IPv6:2607:7c80:54:3::133]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 87E2D12497; Sun, 7 May 2023 18:19:35 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20210309; h=Sender:Content-Transfer-Encoding: MIME-Version:References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From: Reply-To:Content-Type:Content-ID:Content-Description; bh=mFSy+IpeAoNO9gmuKSxMJ7o9b+gWF7hisZ/u+XSCDT0=; b=AiLYPu87mydoW5nhdS2uIz9lL9 P4fOvdIfPj3TRiSsU+0M+2zF3jsz3MQHTr5tHoH+w7uFFLbjRKrTRgPzZI+qWOed40FV2YeRzhmbx Z+CpzuOk9auE6XVu2qMhXVJRWtyG/hjzDU7eOKEkq8+PjygIt9xyXvjuliCj2ySoB2PjkqvetvEQu XnTTEm0Y5a6c33ZTlzYFVs/6gguM98Dq24y4baFCIUhxa8PGlBZVnvAMSyQzV73ynMOFPOs1Wwa8j lsw8fZ05VdzUnhSvOqyU0FfmDdGhCyH9vQdMgq747jaQXkwQ7LBbVYFlprNJKBJFRdJR1/3TEi8nM Crly1UmQ==; Received: from mcgrof by bombadil.infradead.org with local (Exim 4.96 #2 (Red Hat Linux)) id 1pvpXE-00Gw8i-1i; Mon, 08 May 2023 01:19:28 +0000 From: Luis Chamberlain To: hch@infradead.org, djwong@kernel.org, sandeen@sandeen.net, song@kernel.org, rafael@kernel.org, gregkh@linuxfoundation.org, viro@zeniv.linux.org.uk, jack@suse.cz, jikos@kernel.org, bvanassche@acm.org, ebiederm@xmission.com Cc: mchehab@kernel.org, keescook@chromium.org, p.raghav@samsung.com, da.gomez@samsung.com, linux-fsdevel@vger.kernel.org, kernel@tuxforce.de, kexec@lists.infradead.org, linux-kernel@vger.kernel.org, Luis Chamberlain Subject: [PATCH 3/3] xfs: replace kthread freezing with auto fs freezing Date: Sun, 7 May 2023 18:19:27 -0700 Message-Id: <20230508011927.4036707-4-mcgrof@kernel.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20230508011927.4036707-1-mcgrof@kernel.org> References: <20230508011927.4036707-1-mcgrof@kernel.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Sender: Luis Chamberlain Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" The kernel power management now supports allowing the VFS to handle filesystem freezing freezes and thawing. Take advantage of that and remove the kthread freezing. This is needed so that we properly really stop IO in flight without races after userspace has been frozen. Without this we rely on kthread freezing and its semantics are loose and error prone. The filesystem therefore is in charge of properly dealing with quiescing of the filesystem through its callbacks if it thinks it knows better than how the VFS handles it. The following Coccinelle rule was used as to remove the now superfluous freezer calls: make coccicheck MODE=3Dpatch SPFLAGS=3D"--in-place --no-show-diff" COCCI=3D= ./fs-freeze-cleanup.cocci M=3Dfs/xfs virtual patch @ remove_set_freezable @ expression time; statement S, S2; expression task, current; @@ ( - set_freezable(); | - if (try_to_freeze()) - continue; | - try_to_freeze(); | - freezable_schedule(); + schedule(); | - freezable_schedule_timeout(time); + schedule_timeout(time); | - if (freezing(task)) { S } | - if (freezing(task)) { S } - else { S2 } | - freezing(current) ) @ remove_wq_freezable @ expression WQ_E, WQ_ARG1, WQ_ARG2, WQ_ARG3, WQ_ARG4; identifier fs_wq_fn; @@ ( WQ_E =3D alloc_workqueue(WQ_ARG1, - WQ_ARG2 | WQ_FREEZABLE, + WQ_ARG2, ...); | WQ_E =3D alloc_workqueue(WQ_ARG1, - WQ_ARG2 | WQ_FREEZABLE | WQ_ARG3, + WQ_ARG2 | WQ_ARG3, ...); | WQ_E =3D alloc_workqueue(WQ_ARG1, - WQ_ARG2 | WQ_ARG3 | WQ_FREEZABLE, + WQ_ARG2 | WQ_ARG3, ...); | WQ_E =3D alloc_workqueue(WQ_ARG1, - WQ_ARG2 | WQ_ARG3 | WQ_FREEZABLE | WQ_ARG4, + WQ_ARG2 | WQ_ARG3 | WQ_ARG4, ...); | WQ_E =3D - WQ_ARG1 | WQ_FREEZABLE + WQ_ARG1 | WQ_E =3D - WQ_ARG1 | WQ_FREEZABLE | WQ_ARG3 + WQ_ARG1 | WQ_ARG3 | fs_wq_fn( - WQ_FREEZABLE | WQ_ARG2 | WQ_ARG3 + WQ_ARG2 | WQ_ARG3 ) | fs_wq_fn( - WQ_FREEZABLE | WQ_ARG2 + WQ_ARG2 ) | fs_wq_fn( - WQ_FREEZABLE + 0 ) ) @ add_auto_flag @ expression E1; identifier fs_type; @@ struct file_system_type fs_type =3D { .fs_flags =3D E1 + | FS_AUTOFREEZE , }; Generated-by: Coccinelle SmPL Signed-off-by: Luis Chamberlain --- fs/xfs/xfs_log.c | 3 +-- fs/xfs/xfs_log_cil.c | 2 +- fs/xfs/xfs_mru_cache.c | 2 +- fs/xfs/xfs_pwork.c | 2 +- fs/xfs/xfs_super.c | 16 ++++++++-------- fs/xfs/xfs_trans_ail.c | 3 --- 6 files changed, 12 insertions(+), 16 deletions(-) diff --git a/fs/xfs/xfs_log.c b/fs/xfs/xfs_log.c index fc61cc024023..fbdbc81dc8ad 100644 --- a/fs/xfs/xfs_log.c +++ b/fs/xfs/xfs_log.c @@ -1678,8 +1678,7 @@ xlog_alloc_log( log->l_iclog->ic_prev =3D prev_iclog; /* re-write 1st prev ptr */ =20 log->l_ioend_workqueue =3D alloc_workqueue("xfs-log/%s", - XFS_WQFLAGS(WQ_FREEZABLE | WQ_MEM_RECLAIM | - WQ_HIGHPRI), + XFS_WQFLAGS(WQ_MEM_RECLAIM | WQ_HIGHPRI), 0, mp->m_super->s_id); if (!log->l_ioend_workqueue) goto out_free_iclog; diff --git a/fs/xfs/xfs_log_cil.c b/fs/xfs/xfs_log_cil.c index eccbfb99e894..bcc5c8234ce8 100644 --- a/fs/xfs/xfs_log_cil.c +++ b/fs/xfs/xfs_log_cil.c @@ -1842,7 +1842,7 @@ xlog_cil_init( * concurrency the log spinlocks will be exposed to. */ cil->xc_push_wq =3D alloc_workqueue("xfs-cil/%s", - XFS_WQFLAGS(WQ_FREEZABLE | WQ_MEM_RECLAIM | WQ_UNBOUND), + XFS_WQFLAGS(WQ_MEM_RECLAIM | WQ_UNBOUND), 4, log->l_mp->m_super->s_id); if (!cil->xc_push_wq) goto out_destroy_cil; diff --git a/fs/xfs/xfs_mru_cache.c b/fs/xfs/xfs_mru_cache.c index f85e3b07ab44..98832a84be66 100644 --- a/fs/xfs/xfs_mru_cache.c +++ b/fs/xfs/xfs_mru_cache.c @@ -294,7 +294,7 @@ int xfs_mru_cache_init(void) { xfs_mru_reap_wq =3D alloc_workqueue("xfs_mru_cache", - XFS_WQFLAGS(WQ_MEM_RECLAIM | WQ_FREEZABLE), 1); + XFS_WQFLAGS(WQ_MEM_RECLAIM), 1); if (!xfs_mru_reap_wq) return -ENOMEM; return 0; diff --git a/fs/xfs/xfs_pwork.c b/fs/xfs/xfs_pwork.c index c283b801cc5d..3f5bf53f8778 100644 --- a/fs/xfs/xfs_pwork.c +++ b/fs/xfs/xfs_pwork.c @@ -72,7 +72,7 @@ xfs_pwork_init( trace_xfs_pwork_init(mp, nr_threads, current->pid); =20 pctl->wq =3D alloc_workqueue("%s-%d", - WQ_UNBOUND | WQ_SYSFS | WQ_FREEZABLE, nr_threads, tag, + WQ_UNBOUND | WQ_SYSFS, nr_threads, tag, current->pid); if (!pctl->wq) return -ENOMEM; diff --git a/fs/xfs/xfs_super.c b/fs/xfs/xfs_super.c index 7e706255f165..a3860a1267ad 100644 --- a/fs/xfs/xfs_super.c +++ b/fs/xfs/xfs_super.c @@ -537,37 +537,37 @@ xfs_init_mount_workqueues( struct xfs_mount *mp) { mp->m_buf_workqueue =3D alloc_workqueue("xfs-buf/%s", - XFS_WQFLAGS(WQ_FREEZABLE | WQ_MEM_RECLAIM), + XFS_WQFLAGS(WQ_MEM_RECLAIM), 1, mp->m_super->s_id); if (!mp->m_buf_workqueue) goto out; =20 mp->m_unwritten_workqueue =3D alloc_workqueue("xfs-conv/%s", - XFS_WQFLAGS(WQ_FREEZABLE | WQ_MEM_RECLAIM), + XFS_WQFLAGS(WQ_MEM_RECLAIM), 0, mp->m_super->s_id); if (!mp->m_unwritten_workqueue) goto out_destroy_buf; =20 mp->m_reclaim_workqueue =3D alloc_workqueue("xfs-reclaim/%s", - XFS_WQFLAGS(WQ_FREEZABLE | WQ_MEM_RECLAIM), + XFS_WQFLAGS(WQ_MEM_RECLAIM), 0, mp->m_super->s_id); if (!mp->m_reclaim_workqueue) goto out_destroy_unwritten; =20 mp->m_blockgc_wq =3D alloc_workqueue("xfs-blockgc/%s", - XFS_WQFLAGS(WQ_UNBOUND | WQ_FREEZABLE | WQ_MEM_RECLAIM), + XFS_WQFLAGS(WQ_UNBOUND | WQ_MEM_RECLAIM), 0, mp->m_super->s_id); if (!mp->m_blockgc_wq) goto out_destroy_reclaim; =20 mp->m_inodegc_wq =3D alloc_workqueue("xfs-inodegc/%s", - XFS_WQFLAGS(WQ_FREEZABLE | WQ_MEM_RECLAIM), + XFS_WQFLAGS(WQ_MEM_RECLAIM), 1, mp->m_super->s_id); if (!mp->m_inodegc_wq) goto out_destroy_blockgc; =20 mp->m_sync_workqueue =3D alloc_workqueue("xfs-sync/%s", - XFS_WQFLAGS(WQ_FREEZABLE), 0, mp->m_super->s_id); + XFS_WQFLAGS(0), 0, mp->m_super->s_id); if (!mp->m_sync_workqueue) goto out_destroy_inodegc; =20 @@ -1992,7 +1992,7 @@ static struct file_system_type xfs_fs_type =3D { .init_fs_context =3D xfs_init_fs_context, .parameters =3D xfs_fs_parameters, .kill_sb =3D kill_block_super, - .fs_flags =3D FS_REQUIRES_DEV | FS_ALLOW_IDMAP, + .fs_flags =3D FS_REQUIRES_DEV | FS_ALLOW_IDMAP | FS_AUTOFREEZE, }; MODULE_ALIAS_FS("xfs"); =20 @@ -2231,7 +2231,7 @@ xfs_init_workqueues(void) * max_active value for this workqueue. */ xfs_alloc_wq =3D alloc_workqueue("xfsalloc", - XFS_WQFLAGS(WQ_MEM_RECLAIM | WQ_FREEZABLE), 0); + XFS_WQFLAGS(WQ_MEM_RECLAIM), 0); if (!xfs_alloc_wq) return -ENOMEM; =20 diff --git a/fs/xfs/xfs_trans_ail.c b/fs/xfs/xfs_trans_ail.c index 7d4109af193e..03a9bb64927c 100644 --- a/fs/xfs/xfs_trans_ail.c +++ b/fs/xfs/xfs_trans_ail.c @@ -600,7 +600,6 @@ xfsaild( unsigned int noreclaim_flag; =20 noreclaim_flag =3D memalloc_noreclaim_save(); - set_freezable(); =20 while (1) { if (tout && tout <=3D 20) @@ -666,8 +665,6 @@ xfsaild( =20 __set_current_state(TASK_RUNNING); =20 - try_to_freeze(); - tout =3D xfsaild_push(ailp); } =20 --=20 2.39.2