Skip to content

Commit

Permalink
[GFS2] [-mm patch] fs/gfs2/: possible cleanups
Browse files Browse the repository at this point in the history
This patch contains the following possible cleanups:
- make needlessly global code static
- #if 0 unused functions
- remove the following global function that was both unused and
  unimplemented:
  - super.c: gfs2_do_upgrade()

Signed-off-by: Adrian Bunk <[email protected]>
Signed-off-by: Steven Whitehouse <[email protected]>
  • Loading branch information
AdrianBunk authored and swhiteho committed Apr 28, 2006
1 parent c56b39c commit 08bc2db
Show file tree
Hide file tree
Showing 23 changed files with 79 additions and 77 deletions.
3 changes: 2 additions & 1 deletion fs/gfs2/bmap.c
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ struct strip_mine {
*
* Returns: errno
*/

#if 0
int gfs2_unstuffer_sync(struct gfs2_inode *ip, struct buffer_head *dibh,
uint64_t block, void *private)
{
Expand All @@ -77,6 +77,7 @@ int gfs2_unstuffer_sync(struct gfs2_inode *ip, struct buffer_head *dibh,

return error;
}
#endif /* 0 */

/**
* gfs2_unstuff_dinode - Unstuff a dinode when the data has grown too big
Expand Down
2 changes: 0 additions & 2 deletions fs/gfs2/bmap.h
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,6 @@
typedef int (*gfs2_unstuffer_t) (struct gfs2_inode * ip,
struct buffer_head * dibh, uint64_t block,
void *private);
int gfs2_unstuffer_sync(struct gfs2_inode *ip, struct buffer_head *dibh,
uint64_t block, void *private);
int gfs2_unstuff_dinode(struct gfs2_inode *ip, gfs2_unstuffer_t unstuffer,
void *private);

Expand Down
8 changes: 4 additions & 4 deletions fs/gfs2/dir.c
Original file line number Diff line number Diff line change
Expand Up @@ -669,10 +669,10 @@ static void dirent_del(struct gfs2_inode *dip, struct buffer_head *bh,
* Takes a dent from which to grab space as an argument. Returns the
* newly created dent.
*/
struct gfs2_dirent *gfs2_init_dirent(struct inode *inode,
struct gfs2_dirent *dent,
const struct qstr *name,
struct buffer_head *bh)
static struct gfs2_dirent *gfs2_init_dirent(struct inode *inode,
struct gfs2_dirent *dent,
const struct qstr *name,
struct buffer_head *bh)
{
struct gfs2_inode *ip = inode->u.generic_ip;
struct gfs2_dirent *ndent;
Expand Down
2 changes: 1 addition & 1 deletion fs/gfs2/eaops.c
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,7 @@ static int system_eo_remove(struct gfs2_inode *ip, struct gfs2_ea_request *er)
return gfs2_ea_remove_i(ip, er);
}

struct gfs2_eattr_operations gfs2_user_eaops = {
static struct gfs2_eattr_operations gfs2_user_eaops = {
.eo_get = user_eo_get,
.eo_set = user_eo_set,
.eo_remove = user_eo_remove,
Expand Down
1 change: 0 additions & 1 deletion fs/gfs2/eaops.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ struct gfs2_eattr_operations {

unsigned int gfs2_ea_name2type(const char *name, char **truncated_name);

extern struct gfs2_eattr_operations gfs2_user_eaops;
extern struct gfs2_eattr_operations gfs2_system_eaops;

extern struct gfs2_eattr_operations *gfs2_ea_ops[];
Expand Down
3 changes: 3 additions & 0 deletions fs/gfs2/eattr.c
Original file line number Diff line number Diff line change
Expand Up @@ -358,6 +358,7 @@ static int ea_remove_unstuffed(struct gfs2_inode *ip, struct buffer_head *bh,
return error;
}

#if 0

static int gfs2_ea_repack_i(struct gfs2_inode *ip)
{
Expand All @@ -382,6 +383,8 @@ int gfs2_ea_repack(struct gfs2_inode *ip)
return error;
}

#endif /* 0 */

struct ea_list {
struct gfs2_ea_request *ei_er;
unsigned int ei_size;
Expand Down
2 changes: 0 additions & 2 deletions fs/gfs2/eattr.h
Original file line number Diff line number Diff line change
Expand Up @@ -61,8 +61,6 @@ struct gfs2_ea_location {
struct gfs2_ea_header *el_prev;
};

int gfs2_ea_repack(struct gfs2_inode *ip);

int gfs2_ea_get_i(struct gfs2_inode *ip, struct gfs2_ea_request *er);
int gfs2_ea_set_i(struct gfs2_inode *ip, struct gfs2_ea_request *er);
int gfs2_ea_remove_i(struct gfs2_inode *ip, struct gfs2_ea_request *er);
Expand Down
25 changes: 16 additions & 9 deletions fs/gfs2/glock.c
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,8 @@ struct greedy {

typedef void (*glock_examiner) (struct gfs2_glock * gl);

static int gfs2_dump_lockstate(struct gfs2_sbd *sdp);

/**
* relaxed_state_ok - is a requested lock compatible with the current lock mode?
* @actual: the current state of the lock
Expand Down Expand Up @@ -228,8 +230,8 @@ static struct gfs2_glock *search_bucket(struct gfs2_gl_hash_bucket *bucket,
* Returns: NULL, or the struct gfs2_glock with the requested number
*/

struct gfs2_glock *gfs2_glock_find(struct gfs2_sbd *sdp,
struct lm_lockname *name)
static struct gfs2_glock *gfs2_glock_find(struct gfs2_sbd *sdp,
struct lm_lockname *name)
{
struct gfs2_gl_hash_bucket *bucket = &sdp->sd_gl_hash[gl_hash(name)];
struct gfs2_glock *gl;
Expand Down Expand Up @@ -421,8 +423,9 @@ void gfs2_holder_uninit(struct gfs2_holder *gh)
* Returns: the holder structure, NULL on ENOMEM
*/

struct gfs2_holder *gfs2_holder_get(struct gfs2_glock *gl, unsigned int state,
int flags, gfp_t gfp_flags)
static struct gfs2_holder *gfs2_holder_get(struct gfs2_glock *gl,
unsigned int state,
int flags, gfp_t gfp_flags)
{
struct gfs2_holder *gh;

Expand All @@ -442,7 +445,7 @@ struct gfs2_holder *gfs2_holder_get(struct gfs2_glock *gl, unsigned int state,
*
*/

void gfs2_holder_put(struct gfs2_holder *gh)
static void gfs2_holder_put(struct gfs2_holder *gh)
{
gfs2_holder_uninit(gh);
kfree(gh);
Expand Down Expand Up @@ -674,7 +677,7 @@ void gfs2_glmutex_lock(struct gfs2_glock *gl)
* Returns: 1 if the glock is acquired
*/

int gfs2_glmutex_trylock(struct gfs2_glock *gl)
static int gfs2_glmutex_trylock(struct gfs2_glock *gl)
{
int acquired = 1;

Expand Down Expand Up @@ -1301,7 +1304,8 @@ void gfs2_glock_dq(struct gfs2_holder *gh)
*
*/

void gfs2_glock_prefetch(struct gfs2_glock *gl, unsigned int state, int flags)
static void gfs2_glock_prefetch(struct gfs2_glock *gl, unsigned int state,
int flags)
{
struct gfs2_glock_operations *glops = gl->gl_ops;

Expand Down Expand Up @@ -1329,7 +1333,7 @@ void gfs2_glock_prefetch(struct gfs2_glock *gl, unsigned int state, int flags)
* @gl: the glock
*
*/

#if 0
void gfs2_glock_force_drop(struct gfs2_glock *gl)
{
struct gfs2_holder gh;
Expand All @@ -1345,6 +1349,7 @@ void gfs2_glock_force_drop(struct gfs2_glock *gl)
wait_for_completion(&gh.gh_wait);
gfs2_holder_uninit(&gh);
}
#endif /* 0 */

static void greedy_work(void *data)
{
Expand Down Expand Up @@ -1697,6 +1702,7 @@ void gfs2_lvb_unhold(struct gfs2_glock *gl)
gfs2_glock_put(gl);
}

#if 0
void gfs2_lvb_sync(struct gfs2_glock *gl)
{
gfs2_glmutex_lock(gl);
Expand All @@ -1707,6 +1713,7 @@ void gfs2_lvb_sync(struct gfs2_glock *gl)

gfs2_glmutex_unlock(gl);
}
#endif /* 0 */

static void blocking_cb(struct gfs2_sbd *sdp, struct lm_lockname *name,
unsigned int state)
Expand Down Expand Up @@ -2307,7 +2314,7 @@ static int dump_glock(struct gfs2_glock *gl)
*
*/

int gfs2_dump_lockstate(struct gfs2_sbd *sdp)
static int gfs2_dump_lockstate(struct gfs2_sbd *sdp)
{
struct gfs2_gl_hash_bucket *bucket;
struct gfs2_glock *gl;
Expand Down
12 changes: 0 additions & 12 deletions fs/gfs2/glock.h
Original file line number Diff line number Diff line change
Expand Up @@ -73,8 +73,6 @@ static inline int gfs2_glock_is_blocking(struct gfs2_glock *gl)
return ret;
}

struct gfs2_glock *gfs2_glock_find(struct gfs2_sbd *sdp,
struct lm_lockname *name);
int gfs2_glock_get(struct gfs2_sbd *sdp,
uint64_t number, struct gfs2_glock_operations *glops,
int create, struct gfs2_glock **glp);
Expand All @@ -85,25 +83,18 @@ void gfs2_holder_init(struct gfs2_glock *gl, unsigned int state, unsigned flags,
void gfs2_holder_reinit(unsigned int state, unsigned flags,
struct gfs2_holder *gh);
void gfs2_holder_uninit(struct gfs2_holder *gh);
struct gfs2_holder *gfs2_holder_get(struct gfs2_glock *gl, unsigned int state,
int flags, gfp_t gfp_flags);
void gfs2_holder_put(struct gfs2_holder *gh);

void gfs2_glock_xmote_th(struct gfs2_glock *gl, unsigned int state, int flags);
void gfs2_glock_drop_th(struct gfs2_glock *gl);

void gfs2_glmutex_lock(struct gfs2_glock *gl);
int gfs2_glmutex_trylock(struct gfs2_glock *gl);
void gfs2_glmutex_unlock(struct gfs2_glock *gl);

int gfs2_glock_nq(struct gfs2_holder *gh);
int gfs2_glock_poll(struct gfs2_holder *gh);
int gfs2_glock_wait(struct gfs2_holder *gh);
void gfs2_glock_dq(struct gfs2_holder *gh);

void gfs2_glock_prefetch(struct gfs2_glock *gl, unsigned int state, int flags);
void gfs2_glock_force_drop(struct gfs2_glock *gl);

int gfs2_glock_be_greedy(struct gfs2_glock *gl, unsigned int time);

void gfs2_glock_dq_uninit(struct gfs2_holder *gh);
Expand Down Expand Up @@ -148,7 +139,6 @@ static inline int gfs2_glock_nq_init(struct gfs2_glock *gl,

int gfs2_lvb_hold(struct gfs2_glock *gl);
void gfs2_lvb_unhold(struct gfs2_glock *gl);
void gfs2_lvb_sync(struct gfs2_glock *gl);

void gfs2_glock_cb(lm_fsdata_t *fsdata, unsigned int type, void *data);

Expand All @@ -161,6 +151,4 @@ void gfs2_reclaim_glock(struct gfs2_sbd *sdp);
void gfs2_scand_internal(struct gfs2_sbd *sdp);
void gfs2_gl_hash_clear(struct gfs2_sbd *sdp, int wait);

int gfs2_dump_lockstate(struct gfs2_sbd *sdp);

#endif /* __GLOCK_DOT_H__ */
2 changes: 2 additions & 0 deletions fs/gfs2/lm.c
Original file line number Diff line number Diff line change
Expand Up @@ -188,11 +188,13 @@ void gfs2_lm_unhold_lvb(struct gfs2_sbd *sdp, lm_lock_t *lock, char *lvb)
sdp->sd_lockstruct.ls_ops->lm_unhold_lvb(lock, lvb);
}

#if 0
void gfs2_lm_sync_lvb(struct gfs2_sbd *sdp, lm_lock_t *lock, char *lvb)
{
if (likely(!test_bit(SDF_SHUTDOWN, &sdp->sd_flags)))
sdp->sd_lockstruct.ls_ops->lm_sync_lvb(lock, lvb);
}
#endif /* 0 */

int gfs2_lm_plock_get(struct gfs2_sbd *sdp, struct lm_lockname *name,
struct file *file, struct file_lock *fl)
Expand Down
1 change: 0 additions & 1 deletion fs/gfs2/lm.h
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@ unsigned int gfs2_lm_unlock(struct gfs2_sbd *sdp, lm_lock_t *lock,
void gfs2_lm_cancel(struct gfs2_sbd *sdp, lm_lock_t *lock);
int gfs2_lm_hold_lvb(struct gfs2_sbd *sdp, lm_lock_t *lock, char **lvbp);
void gfs2_lm_unhold_lvb(struct gfs2_sbd *sdp, lm_lock_t *lock, char *lvb);
void gfs2_lm_sync_lvb(struct gfs2_sbd *sdp, lm_lock_t *lock, char *lvb);
int gfs2_lm_plock_get(struct gfs2_sbd *sdp,
struct lm_lockname *name,
struct file *file, struct file_lock *fl);
Expand Down
10 changes: 5 additions & 5 deletions fs/gfs2/locking/dlm/lock.c
Original file line number Diff line number Diff line change
Expand Up @@ -158,8 +158,8 @@ static inline void make_strname(struct lm_lockname *lockname,
str->namelen = GDLM_STRNAME_BYTES;
}

int gdlm_create_lp(struct gdlm_ls *ls, struct lm_lockname *name,
struct gdlm_lock **lpp)
static int gdlm_create_lp(struct gdlm_ls *ls, struct lm_lockname *name,
struct gdlm_lock **lpp)
{
struct gdlm_lock *lp;

Expand Down Expand Up @@ -276,7 +276,7 @@ unsigned int gdlm_do_lock(struct gdlm_lock *lp)
return LM_OUT_ASYNC;
}

unsigned int gdlm_do_unlock(struct gdlm_lock *lp)
static unsigned int gdlm_do_unlock(struct gdlm_lock *lp)
{
struct gdlm_ls *ls = lp->ls;
unsigned int lkf = 0;
Expand Down Expand Up @@ -378,7 +378,7 @@ void gdlm_cancel(lm_lock_t *lock)
clear_bit(LFL_DLM_CANCEL, &lp->flags);
}

int gdlm_add_lvb(struct gdlm_lock *lp)
static int gdlm_add_lvb(struct gdlm_lock *lp)
{
char *lvb;

Expand All @@ -391,7 +391,7 @@ int gdlm_add_lvb(struct gdlm_lock *lp)
return 0;
}

void gdlm_del_lvb(struct gdlm_lock *lp)
static void gdlm_del_lvb(struct gdlm_lock *lp)
{
kfree(lp->lvb);
lp->lvb = NULL;
Expand Down
4 changes: 0 additions & 4 deletions fs/gfs2/locking/dlm/lock_dlm.h
Original file line number Diff line number Diff line change
Expand Up @@ -162,12 +162,8 @@ int16_t gdlm_make_lmstate(int16_t);
void gdlm_queue_delayed(struct gdlm_lock *);
void gdlm_submit_delayed(struct gdlm_ls *);
int gdlm_release_all_locks(struct gdlm_ls *);
int gdlm_create_lp(struct gdlm_ls *, struct lm_lockname *, struct gdlm_lock **);
void gdlm_delete_lp(struct gdlm_lock *);
int gdlm_add_lvb(struct gdlm_lock *);
void gdlm_del_lvb(struct gdlm_lock *);
unsigned int gdlm_do_lock(struct gdlm_lock *);
unsigned int gdlm_do_unlock(struct gdlm_lock *);

int gdlm_get_lock(lm_lockspace_t *, struct lm_lockname *, lm_lock_t **);
void gdlm_put_lock(lm_lock_t *);
Expand Down
4 changes: 2 additions & 2 deletions fs/gfs2/locking/dlm/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ extern int gdlm_drop_period;

extern struct lm_lockops gdlm_ops;

int __init init_lock_dlm(void)
static int __init init_lock_dlm(void)
{
int error;

Expand Down Expand Up @@ -48,7 +48,7 @@ int __init init_lock_dlm(void)
return 0;
}

void __exit exit_lock_dlm(void)
static void __exit exit_lock_dlm(void)
{
gdlm_plock_exit();
gdlm_sysfs_exit();
Expand Down
8 changes: 4 additions & 4 deletions fs/gfs2/locking/nolock/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ struct nolock_lockspace {
unsigned int nl_lvb_size;
};

struct lm_lockops nolock_ops;
static struct lm_lockops nolock_ops;

static int nolock_mount(char *table_name, char *host_data,
lm_callback_t cb, lm_fsdata_t *fsdata,
Expand Down Expand Up @@ -208,7 +208,7 @@ static void nolock_recovery_done(lm_lockspace_t *lockspace, unsigned int jid,
{
}

struct lm_lockops nolock_ops = {
static struct lm_lockops nolock_ops = {
.lm_proto_name = "lock_nolock",
.lm_mount = nolock_mount,
.lm_others_may_mount = nolock_others_may_mount,
Expand All @@ -229,7 +229,7 @@ struct lm_lockops nolock_ops = {
.lm_owner = THIS_MODULE,
};

int __init init_nolock(void)
static int __init init_nolock(void)
{
int error;

Expand All @@ -245,7 +245,7 @@ int __init init_nolock(void)
return 0;
}

void __exit exit_nolock(void)
static void __exit exit_nolock(void)
{
gfs_unregister_lockproto(&nolock_ops);
}
Expand Down
2 changes: 2 additions & 0 deletions fs/gfs2/lvb.c
Original file line number Diff line number Diff line change
Expand Up @@ -43,11 +43,13 @@ void gfs2_quota_lvb_out(struct gfs2_quota_lvb *qb, char *lvb)
str->qb_value = cpu_to_be64(qb->qb_value);
}

#if 0
void gfs2_quota_lvb_print(struct gfs2_quota_lvb *qb)
{
pv(qb, qb_magic, "%u");
pv(qb, qb_limit, "%llu");
pv(qb, qb_warn, "%llu");
pv(qb, qb_value, "%lld");
}
#endif /* 0 */

1 change: 0 additions & 1 deletion fs/gfs2/lvb.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@

void gfs2_quota_lvb_in(struct gfs2_quota_lvb *qb, char *lvb);
void gfs2_quota_lvb_out(struct gfs2_quota_lvb *qb, char *lvb);
void gfs2_quota_lvb_print(struct gfs2_quota_lvb *qb);

#endif /* __LVB_DOT_H__ */

Loading

0 comments on commit 08bc2db

Please sign in to comment.