gfs2-utils: master - libgfs2: Remove more unused macros/functions

Steven Whitehouse swhiteho at fedoraproject.org
Tue Dec 13 15:03:26 UTC 2011


Gitweb:        http://git.fedorahosted.org/git/gfs2-utils.git?p=gfs2-utils.git;a=commitdiff;h=72f66b2798c5f8edffba3bcb0722e2a85e0807f0
Commit:        72f66b2798c5f8edffba3bcb0722e2a85e0807f0
Parent:        4761a8a1bd6435c24f13a10202a3f77f820abfab
Author:        Steven Whitehouse <swhiteho at redhat.com>
AuthorDate:    Tue Dec 13 14:58:07 2011 +0000
Committer:     Steven Whitehouse <swhiteho at redhat.com>
CommitterDate: Tue Dec 13 14:58:07 2011 +0000

libgfs2: Remove more unused macros/functions

Two macros in lingfs2.h, bsync and bcommit referred to functions
which no longer exist, so this removes them.

The __bget_generic function was exported, but only ever used
internally to libgfs2, so that is unexported and split
between the two functions which called it, since both had
differing requirements, anyway. This also means that we
can remove the bget wrapper for __bget since this part made
no use of the passed in function name and line number
anyway.

There should be no resulting change in function after this
patch, but another 20 lines of unused code has been removed.

Signed-off-by: Steven Whitehouse <swhiteho at redhat.com>
---
 gfs2/libgfs2/buf.c     |   48 ++++++++++++++++++++----------------------------
 gfs2/libgfs2/libgfs2.h |   13 +------------
 2 files changed, 21 insertions(+), 40 deletions(-)

diff --git a/gfs2/libgfs2/buf.c b/gfs2/libgfs2/buf.c
index 9f074ad..445b0ba 100644
--- a/gfs2/libgfs2/buf.c
+++ b/gfs2/libgfs2/buf.c
@@ -14,9 +14,7 @@
 
 #include "libgfs2.h"
 
-struct gfs2_buffer_head *__bget_generic(struct gfs2_sbd *sdp, uint64_t num,
-					int read_disk,
-					int line, const char *caller)
+struct gfs2_buffer_head *bget(struct gfs2_sbd *sdp, uint64_t num)
 {
 	struct gfs2_buffer_head *bh;
 
@@ -27,37 +25,31 @@ struct gfs2_buffer_head *__bget_generic(struct gfs2_sbd *sdp, uint64_t num,
 	bh->b_blocknr = num;
 	bh->sdp = sdp;
 	bh->b_data = (char *)bh + sizeof(struct gfs2_buffer_head);
-	if (read_disk) {
-		if (lseek(sdp->device_fd, num * sdp->bsize, SEEK_SET) !=
-		    num * sdp->bsize) {
-			fprintf(stderr, "bad seek: %s from %s:%d: block "
-				"%llu (0x%llx)\n", strerror(errno),
-				caller, line, (unsigned long long)num,
-				(unsigned long long)num);
-			exit(-1);
-		}
-		if (read(sdp->device_fd, bh->b_data, sdp->bsize) < 0) {
-			fprintf(stderr, "bad read: %s from %s:%d: block "
-				"%llu (0x%llx)\n", strerror(errno),
-				caller, line, (unsigned long long)num,
-				(unsigned long long)num);
-			exit(-1);
-		}
-	}
-
 	return bh;
 }
 
-struct gfs2_buffer_head *__bget(struct gfs2_sbd *sdp, uint64_t num, int line,
-				const char *caller)
-{
-	return __bget_generic(sdp, num, FALSE, line, caller);
-}
-
 struct gfs2_buffer_head *__bread(struct gfs2_sbd *sdp, uint64_t num, int line,
 				 const char *caller)
 {
-	return __bget_generic(sdp, num, TRUE, line, caller);
+	struct gfs2_buffer_head *bh = bget(sdp, num);
+	if (bh == NULL)
+		return bh;
+	if (lseek(sdp->device_fd, num * sdp->bsize, SEEK_SET) !=
+	    num * sdp->bsize) {
+		fprintf(stderr, "bad seek: %s from %s:%d: block "
+			"%llu (0x%llx)\n", strerror(errno),
+			caller, line, (unsigned long long)num,
+			(unsigned long long)num);
+		exit(-1);
+	}
+	if (read(sdp->device_fd, bh->b_data, sdp->bsize) < 0) {
+		fprintf(stderr, "bad read: %s from %s:%d: block "
+			"%llu (0x%llx)\n", strerror(errno),
+			caller, line, (unsigned long long)num,
+			(unsigned long long)num);
+		exit(-1);
+	}
+	return bh;
 }
 
 int bwrite(struct gfs2_buffer_head *bh)
diff --git a/gfs2/libgfs2/libgfs2.h b/gfs2/libgfs2/libgfs2.h
index ef11221..c356bbf 100644
--- a/gfs2/libgfs2/libgfs2.h
+++ b/gfs2/libgfs2/libgfs2.h
@@ -285,12 +285,7 @@ extern void gfs2_special_clear(struct special_blocks *blocklist,
 			       uint64_t block);
 
 /* buf.c */
-extern struct gfs2_buffer_head *__bget_generic(struct gfs2_sbd *sdp,
-					       uint64_t num,
-					       int read_disk, int line,
-					       const char *caller);
-extern struct gfs2_buffer_head *__bget(struct gfs2_sbd *sdp, uint64_t num,
-				       int line, const char *caller);
+extern struct gfs2_buffer_head *bget(struct gfs2_sbd *sdp, uint64_t num);
 extern struct gfs2_buffer_head *__bread(struct gfs2_sbd *sdp, uint64_t num,
 					int line, const char *caller);
 extern int bwrite(struct gfs2_buffer_head *bh);
@@ -298,13 +293,7 @@ extern int brelse(struct gfs2_buffer_head *bh);
 
 #define bmodified(bh) do { bh->b_modified = 1; } while(0)
 
-#define bget_generic(bl, num, find, read) __bget_generic(bl, num, find, read, \
-							 __LINE__, \
-							 __FUNCTION__)
-#define bget(bl, num) __bget(bl, num, __LINE__, __FUNCTION__)
 #define bread(bl, num) __bread(bl, num, __LINE__, __FUNCTION__)
-#define bsync(bl) do { __bsync(bl, __LINE__, __FUNCTION__); } while(0)
-#define bcommit(bl) do { __bcommit(bl, __LINE__, __FUNCTION__); } while(0)
 
 /* device_geometry.c */
 extern int lgfs2_get_dev_info(int fd, struct lgfs2_dev_info *i);


More information about the cluster-commits mailing list