Skip to contentSkip to conversation

fs: udf: Optimize udf_free_in_core_inode and udf_find_fileset function

PATCH In review Li zeming 2 participants 2 messages Oct 12, 2022 UDF filesystem

lore
Share & tools
lore

Li zeming

author
#0 lore raw

PATCH 1/1 fs: udf: Optimize udf_free_in_core_inode and udf_find_fileset function

These two functions perform the following optimizations.
1. Delete the type cast of foo pointer. Void * does not need to convert the type.
2. Delete the initialization assignment of bh variable, which is assigned first.

---
 fs/udf/super.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
fs/udf/super.c +2 -2
index 4042d9739fb7..06eda8177b5f 100644
@@ -162,7 +162,7 @@ static void udf_free_in_core_inode(struct inode *inode)
 
 static void init_once(void *foo)
 {
-	struct udf_inode_info *ei = (struct udf_inode_info *)foo;
+	struct udf_inode_info *ei = foo;
 
 	ei->i_data = NULL;
 	inode_init_once(&ei->vfs_inode);
@@ -820,7 +820,7 @@ static int udf_find_fileset(struct super_block *sb,
 			    struct kernel_lb_addr *fileset,
 			    struct kernel_lb_addr *root)
 {
-	struct buffer_head *bh = NULL;
+	struct buffer_head *bh;
 	uint16_t ident;
 	int ret;
 
Signature · 1 line
2.18.2
#1 lore raw
Quoted 7 lines · Li zeming

These two functions perform the following optimizations.
1. Delete the type cast of foo pointer. Void * does not need to convert the type.
2. Delete the initialization assignment of bh variable, which is assigned first.

Thanks for the patch. It looks good, I'll queue it into my tree once the merge window closes.

Honza

Quoted 29 lines
---
 fs/udf/super.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
fs/udf/super.c +2 -2
index 4042d9739fb7..06eda8177b5f 100644
@@ -162,7 +162,7 @@ static void udf_free_in_core_inode(struct inode *inode)
 
 static void init_once(void *foo)
 {
-	struct udf_inode_info *ei = (struct udf_inode_info *)foo;
+	struct udf_inode_info *ei = foo;
 
 	ei->i_data = NULL;
 	inode_init_once(&ei->vfs_inode);
@@ -820,7 +820,7 @@ static int udf_find_fileset(struct super_block *sb,
 			    struct kernel_lb_addr *fileset,
 			    struct kernel_lb_addr *root)
 {
-	struct buffer_head *bh = NULL;
+	struct buffer_head *bh;
 	uint16_t ident;
 	int ret;
 
Signature · 1 line
2.18.2
Signature · 2 lines
Jan Kara <[email protected]>
SUSE Labs, CR