Skip to contentSkip to conversation

libgfs2: Remove gfs_get_leaf_nr

PATCH New Andrew Price 2 participants 4 messages Apr 30, 2012 – May 1, 2012

lore
Share & tools
lore
#0 lore raw

PATCH 1/2 libgfs2: Remove gfs_get_leaf_nr

gfs2_get_leaf_nr and gfs_get_leaf_nr are identical so we can remove gfs_get_leaf_nr.

---
 gfs2/libgfs2/fs_ops.c  |    2 --
 gfs2/libgfs2/gfs1.c    |   16 ----------------
 gfs2/libgfs2/libgfs2.h |    2 --
 3 files changed, 0 insertions(+), 20 deletions(-)
gfs2/libgfs2/fs_ops.c +0 -2
index a72394f..470916c 100644
@@ -851,8 +851,6 @@ void gfs2_get_leaf_nr(struct gfs2_inode *dip, uint32_t lindex,
 	uint64_t leaf_no;
 	int count;
 
-	if (dip->i_sbd->gfs1)
-		return gfs_get_leaf_nr(dip, lindex, leaf_out);
 	count = gfs2_readi(dip, (char *)&leaf_no, lindex * sizeof(uint64_t),
 			   sizeof(uint64_t));
 	if (count != sizeof(uint64_t)) {
gfs2/libgfs2/gfs1.c +0 -16
index 8e3fc93..d6f8794 100644
@@ -395,22 +395,6 @@ void gfs_rgrp_out(struct gfs_rgrp *rgrp, struct gfs2_buffer_head *rbh)
 	bmodified(rbh);
 }
 
-void gfs_get_leaf_nr(struct gfs2_inode *dip, uint32_t lindex,
-		     uint64_t *leaf_out)
-{
-	uint64_t leaf_no;
-	int count;
-
-	count = gfs2_readi(dip, (char *)&leaf_no, lindex * sizeof(uint64_t),
-			   sizeof(uint64_t));
-	if (count != sizeof(uint64_t)) {
-		fprintf(stderr, "gfs_get_leaf_nr:  Bad internal read.\n");
-		exit(1);
-	}
-
-	*leaf_out = be64_to_cpu(leaf_no);
-}
-
 void gfs_put_leaf_nr(struct gfs2_inode *dip, uint32_t inx, uint64_t leaf_out)
 {
 	uint64_t leaf_no;
gfs2/libgfs2/libgfs2.h +0 -2
index 4bd01a8..e2a7e45 100644
@@ -660,8 +660,6 @@ extern struct gfs2_inode *gfs_inode_read(struct gfs2_sbd *sdp,
 extern void gfs_jindex_in(struct gfs_jindex *jindex, char *buf);
 extern void gfs_rgrp_in(struct gfs_rgrp *rg, struct gfs2_buffer_head *bh);
 extern void gfs_rgrp_out(struct gfs_rgrp *rg, struct gfs2_buffer_head *bh);
-extern void gfs_get_leaf_nr(struct gfs2_inode *dip, uint32_t lindex,
-			    uint64_t *leaf_out);
 extern void gfs_put_leaf_nr(struct gfs2_inode *dip, uint32_t inx,
 			    uint64_t leaf_out);
 
Signature · 1 line
1.7.7.6
#1 lore raw

PATCH 2/2 libgfs2: Clean up some warnings

Fixes these warnings:
fs_geometry.c:80:47: warning: variable 'rlast2' set but not used [-Wunused-but-set-variable]
meta.c:732:3: warning: large integer implicitly truncated to unsigned type [-Woverflow]

---
 gfs2/libgfs2/fs_geometry.c |    3 +--
 gfs2/libgfs2/meta.c        |    2 +-
 2 files changed, 2 insertions(+), 3 deletions(-)
gfs2/libgfs2/fs_geometry.c +1 -2
index fb55697..e248f7c 100644
@@ -77,7 +77,7 @@ void compute_rgrp_layout(struct gfs2_sbd *sdp, struct osi_root *rgtree,
 			 int rgsize_specified)
 {
 	struct device *dev;
-	struct rgrp_tree *rl, *rlast = NULL, *rlast2 = NULL;
+	struct rgrp_tree *rl, *rlast = NULL;
 	struct osi_node *n, *next = NULL;
 	unsigned int rgrp = 0, nrgrp, rglength;
 	uint64_t rgaddr;
@@ -105,7 +105,6 @@ void compute_rgrp_layout(struct gfs2_sbd *sdp, struct osi_root *rgtree,
 				 PRIx64 "), length = %"PRIu64" (0x%"
 				 PRIx64 ")\n", rgrp + 1, rl->start, rl->start,
 				 rl->length, rl->length);
-			rlast2 = rlast;
 			rlast = rl;
 		}
 		rlast->start = rlast->ri.ri_addr;
gfs2/libgfs2/meta.c +1 -1
index 87f8f31..1f796c8 100644
@@ -729,7 +729,7 @@ const struct lgfs2_metadata lgfs2_metadata[] = {
 	},
 	[LGFS2_MT_FREE] = {
 		.gfs1 = 1,
-		.gfs2 = 2,
+		.gfs2 = 1,
 		.name = "free",
 	},
 };
Signature · 1 line
1.7.7.6
#2 lore raw

PATCH 2/2 libgfs2: Clean up some warnings

Hi,

Looks good,

Steve.

Quoted 46 lines · Andrew Price

Fixes these warnings:
fs_geometry.c:80:47: warning: variable 'rlast2' set but not used [-Wunused-but-set-variable]
meta.c:732:3: warning: large integer implicitly truncated to unsigned type [-Woverflow]

---
 gfs2/libgfs2/fs_geometry.c |    3 +--
 gfs2/libgfs2/meta.c        |    2 +-
 2 files changed, 2 insertions(+), 3 deletions(-)
gfs2/libgfs2/fs_geometry.c +1 -2
index fb55697..e248f7c 100644
@@ -77,7 +77,7 @@ void compute_rgrp_layout(struct gfs2_sbd *sdp, struct osi_root *rgtree,
 			 int rgsize_specified)
 {
 	struct device *dev;
-	struct rgrp_tree *rl, *rlast = NULL, *rlast2 = NULL;
+	struct rgrp_tree *rl, *rlast = NULL;
 	struct osi_node *n, *next = NULL;
 	unsigned int rgrp = 0, nrgrp, rglength;
 	uint64_t rgaddr;
@@ -105,7 +105,6 @@ void compute_rgrp_layout(struct gfs2_sbd *sdp, struct osi_root *rgtree,
 				 PRIx64 "), length = %"PRIu64" (0x%"
 				 PRIx64 ")\n", rgrp + 1, rl->start, rl->start,
 				 rl->length, rl->length);
-			rlast2 = rlast;
 			rlast = rl;
 		}
 		rlast->start = rlast->ri.ri_addr;
gfs2/libgfs2/meta.c +1 -1
index 87f8f31..1f796c8 100644
@@ -729,7 +729,7 @@ const struct lgfs2_metadata lgfs2_metadata[] = {
 	},
 	[LGFS2_MT_FREE] = {
 		.gfs1 = 1,
-		.gfs2 = 2,
+		.gfs2 = 1,
 		.name = "free",
 	},
 };
#3 lore raw

PATCH 1/2 libgfs2: Remove gfs_get_leaf_nr

In reply to Andrew Price

Hi,

Looks good to me,

Steve.

Quoted 63 lines · Andrew Price

gfs2_get_leaf_nr and gfs_get_leaf_nr are identical so we can remove gfs_get_leaf_nr.

---
 gfs2/libgfs2/fs_ops.c  |    2 --
 gfs2/libgfs2/gfs1.c    |   16 ----------------
 gfs2/libgfs2/libgfs2.h |    2 --
 3 files changed, 0 insertions(+), 20 deletions(-)
gfs2/libgfs2/fs_ops.c +0 -2
index a72394f..470916c 100644
@@ -851,8 +851,6 @@ void gfs2_get_leaf_nr(struct gfs2_inode *dip, uint32_t lindex,
 	uint64_t leaf_no;
 	int count;
 
-	if (dip->i_sbd->gfs1)
-		return gfs_get_leaf_nr(dip, lindex, leaf_out);
 	count = gfs2_readi(dip, (char *)&leaf_no, lindex * sizeof(uint64_t),
 			   sizeof(uint64_t));
 	if (count != sizeof(uint64_t)) {
gfs2/libgfs2/gfs1.c +0 -16
index 8e3fc93..d6f8794 100644
@@ -395,22 +395,6 @@ void gfs_rgrp_out(struct gfs_rgrp *rgrp, struct gfs2_buffer_head *rbh)
 	bmodified(rbh);
 }
 
-void gfs_get_leaf_nr(struct gfs2_inode *dip, uint32_t lindex,
-		     uint64_t *leaf_out)
-{
-	uint64_t leaf_no;
-	int count;
-
-	count = gfs2_readi(dip, (char *)&leaf_no, lindex * sizeof(uint64_t),
-			   sizeof(uint64_t));
-	if (count != sizeof(uint64_t)) {
-		fprintf(stderr, "gfs_get_leaf_nr:  Bad internal read.\n");
-		exit(1);
-	}
-
-	*leaf_out = be64_to_cpu(leaf_no);
-}
-
 void gfs_put_leaf_nr(struct gfs2_inode *dip, uint32_t inx, uint64_t leaf_out)
 {
 	uint64_t leaf_no;
gfs2/libgfs2/libgfs2.h +0 -2
index 4bd01a8..e2a7e45 100644
@@ -660,8 +660,6 @@ extern struct gfs2_inode *gfs_inode_read(struct gfs2_sbd *sdp,
 extern void gfs_jindex_in(struct gfs_jindex *jindex, char *buf);
 extern void gfs_rgrp_in(struct gfs_rgrp *rg, struct gfs2_buffer_head *bh);
 extern void gfs_rgrp_out(struct gfs_rgrp *rg, struct gfs2_buffer_head *bh);
-extern void gfs_get_leaf_nr(struct gfs2_inode *dip, uint32_t lindex,
-			    uint64_t *leaf_out);
 extern void gfs_put_leaf_nr(struct gfs2_inode *dip, uint32_t inx,
 			    uint64_t leaf_out);