Skip to contentSkip to conversation

nilfs2: remove '#if 0' code blocks

PATCH Applied Joshua Crofts 3 participants 3 messages Sep 7 NILFS2 filesystem

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 nilfs2: remove '#if 0' code blocks

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

Additionally, remove a commented out section containing similar code as the '#if 0' block and unnecessary brackets around a single-statement if per checkpatch rules.

---
Changes in v2:
- remove block of commented out code (Ryusuke).

---
 fs/nilfs2/inode.c | 7 -------
 fs/nilfs2/super.c | 8 ++------
 2 files changed, 2 insertions(+), 13 deletions(-)
fs/nilfs2/inode.c +0 -7
index 34e6096069ad..778274203f4c 100644
@@ -342,8 +342,6 @@ struct inode *nilfs_new_inode(struct inode *dir, umode_t mode)
 	ii->i_flags = nilfs_mask_flags(
 		mode, NILFS_I(dir)->i_flags & NILFS_FL_INHERITED);
 
-	/* ii->i_file_acl = 0; */
-	/* ii->i_dir_acl = 0; */
 	ii->i_dir_start_lookup = 0;
 	nilfs_set_inode_flags(inode);
 	inode->i_generation = get_random_u32();
@@ -422,11 +420,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);
 
fs/nilfs2/super.c +2 -6
index 893a504cb80c..89fa6faa34d2 100644
@@ -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,

Signature · 2 lines
Kind regards,
Joshua Crofts
maintainer Acked-by on v2 1/1
#1 lore raw
Quoted 4 lines · Joshua Crofts

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

Quoted 8 lines

Additionally, remove a commented out section containing similar code as the '#if 0' block and unnecessary brackets around a single-statement if per checkpatch rules.

---
Changes in v2:
- remove block of commented out code (Ryusuke).

Viacheslav, could you please apply this directly to your tree for the next cycle?

Thanks,
Ryusuke Konishi

Quoted 60 lines
---
 fs/nilfs2/inode.c | 7 -------
 fs/nilfs2/super.c | 8 ++------
 2 files changed, 2 insertions(+), 13 deletions(-)
fs/nilfs2/inode.c +0 -7
index 34e6096069ad..778274203f4c 100644
@@ -342,8 +342,6 @@ struct inode *nilfs_new_inode(struct inode *dir, umode_t mode)
        ii->i_flags = nilfs_mask_flags(
                mode, NILFS_I(dir)->i_flags & NILFS_FL_INHERITED);
 
-       /* ii->i_file_acl = 0; */
-       /* ii->i_dir_acl = 0; */
        ii->i_dir_start_lookup = 0;
        nilfs_set_inode_flags(inode);
        inode->i_generation = get_random_u32();
@@ -422,11 +420,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);
 
fs/nilfs2/super.c +2 -7
index 893a504cb80c..89fa6faa34d2 100644
@@ -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

maintainer Applied
#2 lore raw
Quoted 84 lines · Ryusuke Konishi
Quoted 10 lines · Joshua Crofts

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

Additionally, remove a commented out section containing similar code
as the '#if 0' block and unnecessary brackets around a single- statement
if per checkpatch rules.

Quoted 4 lines

---
Changes in v2:
- remove block of commented out code (Ryusuke).

Viacheslav, could you please apply this directly to your tree for the next cycle?

Thanks,
Ryusuke Konishi

Quoted 60 lines

---
 fs/nilfs2/inode.c | 7 -------
 fs/nilfs2/super.c | 8 ++------

 2 files changed, 2 insertions(+), 13 deletions(-)
fs/nilfs2/inode.c +0 -0
index 34e6096069ad..778274203f4c 100644
@@ -342,8 +342,6 @@ struct inode *nilfs_new_inode(struct inode
 *dir, umode_t mode)

        ii->i_flags = nilfs_mask_flags(
                mode, NILFS_I(dir)->i_flags & NILFS_FL_INHERITED);

-       /* ii->i_file_acl = 0; */
-       /* ii->i_dir_acl = 0; */
        ii->i_dir_start_lookup = 0;
        nilfs_set_inode_flags(inode);
        inode->i_generation = get_random_u32();

fs/nilfs2/inode.c +0 -5
@@ -422,11 +420,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);
fs/nilfs2/super.c +2 -6
index 893a504cb80c..89fa6faa34d2 100644
@@ -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

Quoted 5 lines
Quoted 5 lines

Best regards,
--
Kind regards,
Joshua Crofts

Applied.

Thanks,
Slava.