FAQ Search Today's Posts Mark Forums Read
» Video Reviews

» Linux Archive

Linux-archive is a website aiming to archive linux email lists and to make them easily accessible for linux users/developers.


» Sponsor

» Partners

» Sponsor

Go Back   Linux Archive > Redhat > Cluster Development

 
 
LinkBack Thread Tools
 
Old 12-07-2011, 12:40 PM
Steven Whitehouse
 
Default 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@redhat.com>

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)
", 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)
", 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)
", 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)
", 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);
 
Old 12-13-2011, 01:53 PM
Bob Peterson
 
Default libgfs2: Remove more unused macros/functions

----- Original Message -----
| 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@redhat.com>
Hi,

ACK,

Regards,

Bob Peterson
Red Hat File Systems
 

Thread Tools




All times are GMT. The time now is 05:41 PM.

VBulletin, Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO ©2007, Crawlability, Inc.
Copyright 2007 - 2008, www.linux-archive.org