Skip to contentSkip to conversation

GFS2: Use lvbs for storing rgrp information

PATCH Superseded Benjamin Marzinski 1 participant 1 message May 22, 2012 GFS2 file system

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 GFS2: Use lvbs for storing rgrp information

Instead of reading in the resource groups when gfs2 is checking for free space to allocate from, gfs2 can store the necessary infromation in the resource group's lvb. Also, instead of searching for unlinked inodes in every resource group that's checked for free space, gfs2 can store the number of unlinked but inodes in the lvb, and only check for unlinked inodes if it will find some.

The first time a resource group is locked, the lvb must initialized. Since this involves counting the unlinked inodes in the resource group, this takes a little extra time. But after that, if the resource group is locked with GL_SKIP, the buffer head won't be read in unless it's actually needed.

---
 fs/gfs2/glock.c             |    1 
 fs/gfs2/incore.h            |    1 
 fs/gfs2/rgrp.c              |  138 +++++++++++++++++++++++++++++++++++++++++---
 include/linux/gfs2_ondisk.h |   10 +++
 4 files changed, 141 insertions(+), 9 deletions(-)
fs/gfs2/glock.c +1 -0
Index: gfs2-3.0-nmw/fs/gfs2/glock.c
===================================================================
@@ -767,6 +767,7 @@ int gfs2_glock_get(struct gfs2_sbd *sdp,
 	gl->gl_stats.stats[GFS2_LKS_DCOUNT] = 0;
 	gl->gl_stats.stats[GFS2_LKS_QCOUNT] = 0;
 	memset(&gl->gl_lksb, 0, sizeof(struct dlm_lksb));
+	memset(gl->gl_lvb, 0, 32 * sizeof(char));
 	gl->gl_lksb.sb_lvbptr = gl->gl_lvb;
 	gl->gl_tchange = jiffies;
 	gl->gl_object = NULL;
fs/gfs2/incore.h +1 -0
Index: gfs2-3.0-nmw/fs/gfs2/incore.h
===================================================================
@@ -89,6 +89,7 @@ struct gfs2_rgrpd {
 	u64 rd_igeneration;
 	struct gfs2_bitmap *rd_bits;
 	struct gfs2_sbd *rd_sbd;
+	struct gfs2_rgrp_lvb *rd_rgl;
 	u32 rd_last_alloc;
 	u32 rd_flags;
 #define GFS2_RDF_CHECK		0x10000000 /* check for unlinked inodes */
fs/gfs2/rgrp.c +129 -9

238 lines not on this page · raw message

include/linux/gfs2_ondisk.h +10 -0
Index: gfs2-3.0-nmw/include/linux/gfs2_ondisk.h
===================================================================
@@ -170,6 +170,16 @@ struct gfs2_rindex {
 #define GFS2_RGF_NOALLOC	0x00000008
 #define GFS2_RGF_TRIMMED	0x00000010
 
+struct gfs2_rgrp_lvb {
+	__be32 rl_magic;
+	__be32 rl_flags;
+	__be32 rl_free;
+	__be32 rl_dinodes;
+	__be64 rl_igeneration;
+	__be32 rl_unlinked;
+	__be32 __pad;
+};
+
 struct gfs2_rgrp {
 	struct gfs2_meta_header rg_header;