Skip to contentSkip to conversation

fs: drop pointless static qualifier in bdev_cache_init()

PATCH In review Mao Wenan 2 participants 2 messages Feb 18, 2019

Subsystems (2)
lore
Share & tools
lore

Mao Wenan

author
#0 lore raw

PATCH 1/1 fs: drop pointless static qualifier in bdev_cache_init()

There is no need to have the struct vfsmount *bd_mnt with static since new value always be assigned before use it.

---
 fs/block_dev.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
fs/block_dev.c +1 -1
index 58a4c1217fa8..dcf54494c79e 100644
@@ -847,7 +847,7 @@ EXPORT_SYMBOL_GPL(blockdev_superblock);
 void __init bdev_cache_init(void)
 {
 	int err;
-	static struct vfsmount *bd_mnt;
+	struct vfsmount *bd_mnt;
 
 	bdev_cachep = kmem_cache_create("bdev_cache", sizeof(struct bdev_inode),
 			0, (SLAB_HWCACHE_ALIGN|SLAB_RECLAIM_ACCOUNT|
Signature · 1 line
2.20.1
#1 lore raw
Quoted 2 lines · Mao Wenan

There is no need to have the struct vfsmount *bd_mnt with static since new value always be assigned before use it.

No. The point is to keep a copy of bd_mnt around. Putting it on the stack would lead to it being overwritten.