mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] nilfs2: remove '#if 0' code blocks
@ 2026-09-05  4:48 Joshua Crofts
  2026-09-06 16:47 ` Ryusuke Konishi
  0 siblings, 1 reply; 3+ messages in thread
From: Joshua Crofts @ 2026-09-05  4:48 UTC (permalink / raw)
  To: Ryusuke Konishi, Viacheslav Dubeyko
  Cc: linux-nilfs, linux-kernel, Joshua Crofts

There are two instances of '#if 0' code blocks that are dead code.
Remove these code blocks.

Additionally, remove unnecessary brackets around a single-statement
if per checkpatch rules.

Signed-off-by: Joshua Crofts <joshua.crofts1@gmail.com>
---
Stumbled upon these blocks when grepping the kernel for #if 0. Not sure
if they are actually used for debugging; if so, I have no issues with
the patch being dropped.

Thanks!
---
 fs/nilfs2/inode.c | 5 -----
 fs/nilfs2/super.c | 8 ++------
 2 files changed, 2 insertions(+), 11 deletions(-)

diff --git a/fs/nilfs2/inode.c b/fs/nilfs2/inode.c
index 34e6096069ad..c5b0e9f272b7 100644
--- a/fs/nilfs2/inode.c
+++ b/fs/nilfs2/inode.c
@@ -422,11 +422,6 @@ int nilfs_read_inode_common(struct inode *inode,
 
 	inode->i_blocks = le64_to_cpu(raw_inode->i_blocks);
 	ii->i_flags = le32_to_cpu(raw_inode->i_flags);
-#if 0
-	ii->i_file_acl = le32_to_cpu(raw_inode->i_file_acl);
-	ii->i_dir_acl = S_ISREG(inode->i_mode) ?
-		0 : le32_to_cpu(raw_inode->i_dir_acl);
-#endif
 	ii->i_dir_start_lookup = 0;
 	inode->i_generation = le32_to_cpu(raw_inode->i_generation);
 
diff --git a/fs/nilfs2/super.c b/fs/nilfs2/super.c
index 893a504cb80c..89fa6faa34d2 100644
--- a/fs/nilfs2/super.c
+++ b/fs/nilfs2/super.c
@@ -824,13 +824,9 @@ static int nilfs_setup_super(struct super_block *sb, int is_mount)
 	max_mnt_count = le16_to_cpu(sbp[0]->s_max_mnt_count);
 	mnt_count = le16_to_cpu(sbp[0]->s_mnt_count);
 
-	if (nilfs->ns_mount_state & NILFS_ERROR_FS) {
+	if (nilfs->ns_mount_state & NILFS_ERROR_FS)
 		nilfs_warn(sb, "mounting fs with errors");
-#if 0
-	} else if (max_mnt_count >= 0 && mnt_count >= max_mnt_count) {
-		nilfs_warn(sb, "maximal mount count reached");
-#endif
-	}
+
 	if (!max_mnt_count)
 		sbp[0]->s_max_mnt_count = cpu_to_le16(NILFS_DFL_MAX_MNT_COUNT);
 

---
base-commit: 4d7d9486c04d917265f64c55bd23b2cc4fe7749c
change-id: 20260905-nilfs2-dead-code-cleanup-cefbe2773172

Best regards,
-- 
Kind regards,
Joshua Crofts


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] nilfs2: remove '#if 0' code blocks
  2026-09-05  4:48 [PATCH] nilfs2: remove '#if 0' code blocks Joshua Crofts
@ 2026-09-06 16:47 ` Ryusuke Konishi
  2026-09-06 20:55   ` Joshua Crofts
  0 siblings, 1 reply; 3+ messages in thread
From: Ryusuke Konishi @ 2026-09-06 16:47 UTC (permalink / raw)
  To: Joshua Crofts; +Cc: Viacheslav Dubeyko, linux-nilfs, linux-kernel

On Sat, Sep 5, 2026 at 1:49 PM Joshua Crofts wrote:
>
> There are two instances of '#if 0' code blocks that are dead code.
> Remove these code blocks.
>
> Additionally, remove unnecessary brackets around a single-statement
> if per checkpatch rules.
>
> Signed-off-by: Joshua Crofts <joshua.crofts1@gmail.com>
> ---
> Stumbled upon these blocks when grepping the kernel for #if 0. Not sure
> if they are actually used for debugging; if so, I have no issues with
> the patch being dropped.
>
> Thanks!

Joshua Crofts, thank you for proposing this patch.

I agree that it is appropriate to remove the dead code in both locations.

These sections are not for debugging purposes; rather, they both
relate to features that were never implemented.

Regarding the ACL-related dead code, it can be properly implemented
when the feature is actually added; therefore, removing it is fine
(and indeed preferable, as it reduces the tree-wide maintenance burden
in the interim).

The dead code related to mount counts stems from a legacy feature
designed for periodic full checks upon mounting.
However, mandating a heavy, full-filesystem check simply because a
certain number of mounts has been reached is outdated; in an era where
large-capacity storage is the norm, such a process compromises
availability.
While fsck itself remains necessary, periodic health checks should be
handled via alternative online methods.

I have just one point regarding the ACL dead code removal: in
nilfs_new_inode() within "inode.c", there are lines that are merely
commented out rather than being enclosed in "#if 0" (shown below).

        /* ii->i_file_acl = 0; */
        /* ii->i_dir_acl = 0; */

Could you please revise your patch to remove these lines as well?

Once you have made these changes, I will accept the patch.

Thanks,
Ryusuke Konishi


> ---
>  fs/nilfs2/inode.c | 5 -----
>  fs/nilfs2/super.c | 8 ++------
>  2 files changed, 2 insertions(+), 11 deletions(-)
>
> diff --git a/fs/nilfs2/inode.c b/fs/nilfs2/inode.c
> index 34e6096069ad..c5b0e9f272b7 100644
> --- a/fs/nilfs2/inode.c
> +++ b/fs/nilfs2/inode.c
> @@ -422,11 +422,6 @@ int nilfs_read_inode_common(struct inode *inode,
>
>         inode->i_blocks = le64_to_cpu(raw_inode->i_blocks);
>         ii->i_flags = le32_to_cpu(raw_inode->i_flags);
> -#if 0
> -       ii->i_file_acl = le32_to_cpu(raw_inode->i_file_acl);
> -       ii->i_dir_acl = S_ISREG(inode->i_mode) ?
> -               0 : le32_to_cpu(raw_inode->i_dir_acl);
> -#endif
>         ii->i_dir_start_lookup = 0;
>         inode->i_generation = le32_to_cpu(raw_inode->i_generation);
>
> diff --git a/fs/nilfs2/super.c b/fs/nilfs2/super.c
> index 893a504cb80c..89fa6faa34d2 100644
> --- a/fs/nilfs2/super.c
> +++ b/fs/nilfs2/super.c
> @@ -824,13 +824,9 @@ static int nilfs_setup_super(struct super_block *sb, int is_mount)
>         max_mnt_count = le16_to_cpu(sbp[0]->s_max_mnt_count);
>         mnt_count = le16_to_cpu(sbp[0]->s_mnt_count);
>
> -       if (nilfs->ns_mount_state & NILFS_ERROR_FS) {
> +       if (nilfs->ns_mount_state & NILFS_ERROR_FS)
>                 nilfs_warn(sb, "mounting fs with errors");
> -#if 0
> -       } else if (max_mnt_count >= 0 && mnt_count >= max_mnt_count) {
> -               nilfs_warn(sb, "maximal mount count reached");
> -#endif
> -       }
> +
>         if (!max_mnt_count)
>                 sbp[0]->s_max_mnt_count = cpu_to_le16(NILFS_DFL_MAX_MNT_COUNT);
>
>
> ---
> base-commit: 4d7d9486c04d917265f64c55bd23b2cc4fe7749c
> change-id: 20260905-nilfs2-dead-code-cleanup-cefbe2773172
>
> Best regards,
> --
> Kind regards,
> Joshua Crofts
>

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] nilfs2: remove '#if 0' code blocks
  2026-09-06 16:47 ` Ryusuke Konishi
@ 2026-09-06 20:55   ` Joshua Crofts
  0 siblings, 0 replies; 3+ messages in thread
From: Joshua Crofts @ 2026-09-06 20:55 UTC (permalink / raw)
  To: Ryusuke Konishi; +Cc: Viacheslav Dubeyko, linux-nilfs, linux-kernel

On Mon, 7 Sep 2026 01:47:35 +0900
Ryusuke Konishi <konishi.ryusuke@gmail.com> wrote:

> On Sat, Sep 5, 2026 at 1:49 PM Joshua Crofts wrote:
> >
> > There are two instances of '#if 0' code blocks that are dead code.
> > Remove these code blocks.
> >
> > Additionally, remove unnecessary brackets around a single-statement
> > if per checkpatch rules.
> >
> > Signed-off-by: Joshua Crofts <joshua.crofts1@gmail.com>
> > ---
> > Stumbled upon these blocks when grepping the kernel for #if 0. Not sure
> > if they are actually used for debugging; if so, I have no issues with
> > the patch being dropped.
> >
> > Thanks!  
> 
> Joshua Crofts, thank you for proposing this patch.
> 
> I agree that it is appropriate to remove the dead code in both locations.
> 
> These sections are not for debugging purposes; rather, they both
> relate to features that were never implemented.
> 
> Regarding the ACL-related dead code, it can be properly implemented
> when the feature is actually added; therefore, removing it is fine
> (and indeed preferable, as it reduces the tree-wide maintenance burden
> in the interim).
> 
> The dead code related to mount counts stems from a legacy feature
> designed for periodic full checks upon mounting.
> However, mandating a heavy, full-filesystem check simply because a
> certain number of mounts has been reached is outdated; in an era where
> large-capacity storage is the norm, such a process compromises
> availability.
> While fsck itself remains necessary, periodic health checks should be
> handled via alternative online methods.
> 
> I have just one point regarding the ACL dead code removal: in
> nilfs_new_inode() within "inode.c", there are lines that are merely
> commented out rather than being enclosed in "#if 0" (shown below).
> 
>         /* ii->i_file_acl = 0; */
>         /* ii->i_dir_acl = 0; */
> 
> Could you please revise your patch to remove these lines as well?
> 
> Once you have made these changes, I will accept the patch.
> 

Hi Ryusuke,

Thanks for the explanation! 

I'll implement the change you proposed in v2.

-- 
Kind regards,
Joshua Crofts

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2026-09-06 20:55 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-09-05  4:48 [PATCH] nilfs2: remove '#if 0' code blocks Joshua Crofts
2026-09-06 16:47 ` Ryusuke Konishi
2026-09-06 20:55   ` Joshua Crofts

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®