Skip to contentSkip to conversation

gfs2: Don't reread inodes unnecessarily

PATCH New Andreas Gruenbacher 1 participant 1 message Apr 22, 2025 GFS2 file system

lore
Share & tools
lore

Andreas Gruenbacher

author maintainer
#0 lore raw

PATCH 1/1 gfs2: Don't reread inodes unnecessarily

In gfs2_create_inode(), we initialize the inode from scratch and then we write the result to disk. Clear the GLF_INSTANTIATE_NEEDED glock flag to indicate that the inode is up to date. Otherwise, the next time the inode glock is acquired, gfs2_instantiate() would reread the inode from disk, which isn't necessary.

---
 fs/gfs2/inode.c | 1 +
 1 file changed, 1 insertion(+)
fs/gfs2/inode.c +1 -0
index 9621680814b8..62ff09264f0f 100644
@@ -768,6 +768,7 @@ static int gfs2_create_inode(struct inode *dir, struct dentry *dentry,
 	error = gfs2_glock_nq_init(ip->i_gl, LM_ST_EXCLUSIVE, GL_SKIP, &gh);
 	if (error)
 		goto fail_gunlock3;
+	clear_bit(GLF_INSTANTIATE_NEEDED, &ip->i_gl->gl_flags);
 
 	error = gfs2_trans_begin(sdp, blocks, 0);
 	if (error)
Signature · 1 line
2.49.0