Skip to content

Commit

Permalink
staging/lustre/llite: remove dead code
Browse files Browse the repository at this point in the history
In llite remove unused declarations, parameters, types, and unused,
get-only, or set-only structure members. Add static and const
qualifiers to declarations where possible.

Signed-off-by: John L. Hammond <[email protected]>
Reviewed-on: http://review.whamcloud.com/9767
Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-2675
Reviewed-by: Lai Siyao <[email protected]>
Reviewed-by: Jinshan Xiong <[email protected]>
Signed-off-by: Oleg Drokin <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>
  • Loading branch information
jhammond-intel authored and gregkh committed Apr 27, 2014
1 parent 2c58083 commit 2d95f10
Show file tree
Hide file tree
Showing 21 changed files with 125 additions and 335 deletions.
4 changes: 2 additions & 2 deletions drivers/staging/lustre/lustre/lclient/lcommon_cl.c
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@

#include "../llite/llite_internal.h"

const struct cl_req_operations ccc_req_ops;
static const struct cl_req_operations ccc_req_ops;

/*
* ccc_ prefix stands for "Common Client Code".
Expand Down Expand Up @@ -962,7 +962,7 @@ void ccc_req_attr_set(const struct lu_env *env,
JOBSTATS_JOBID_SIZE);
}

const struct cl_req_operations ccc_req_ops = {
static const struct cl_req_operations ccc_req_ops = {
.cro_attr_set = ccc_req_attr_set,
.cro_completion = ccc_req_completion
};
Expand Down
26 changes: 9 additions & 17 deletions drivers/staging/lustre/lustre/llite/dcache.c
Original file line number Diff line number Diff line change
Expand Up @@ -69,8 +69,7 @@ static void ll_release(struct dentry *de)
ll_intent_release(lld->lld_it);
OBD_FREE(lld->lld_it, sizeof(*lld->lld_it));
}
LASSERT(lld->lld_cwd_count == 0);
LASSERT(lld->lld_mnt_count == 0);

de->d_fsdata = NULL;
call_rcu(&lld->lld_rcu_head, free_dentry_data);
}
Expand All @@ -82,8 +81,9 @@ static void ll_release(struct dentry *de)
* an AST before calling d_revalidate_it(). The dentry still exists (marked
* INVALID) so d_lookup() matches it, but we have no lock on it (so
* lock_match() fails) and we spin around real_lookup(). */
int ll_dcompare(const struct dentry *parent, const struct dentry *dentry,
unsigned int len, const char *str, const struct qstr *name)
static int ll_dcompare(const struct dentry *parent, const struct dentry *dentry,
unsigned int len, const char *str,
const struct qstr *name)
{
if (len != name->len)
return 1;
Expand Down Expand Up @@ -238,7 +238,8 @@ void ll_intent_release(struct lookup_intent *it)
ll_intent_drop_lock(it);
/* We are still holding extra reference on a request, need to free it */
if (it_disposition(it, DISP_ENQ_OPEN_REF))
ptlrpc_req_finished(it->d.lustre.it_data); /* ll_file_open */
ptlrpc_req_finished(it->d.lustre.it_data); /* ll_file_open */

if (it_disposition(it, DISP_ENQ_CREATE_REF)) /* create rec */
ptlrpc_req_finished(it->d.lustre.it_data);

Expand Down Expand Up @@ -316,15 +317,6 @@ void ll_lookup_finish_locks(struct lookup_intent *it, struct dentry *dentry)
}
}

void ll_frob_intent(struct lookup_intent **itp, struct lookup_intent *deft)
{
struct lookup_intent *it = *itp;

if (!it || it->it_op == IT_GETXATTR)
it = *itp = deft;

}

static int ll_revalidate_dentry(struct dentry *dentry,
unsigned int lookup_flags)
{
Expand Down Expand Up @@ -356,7 +348,7 @@ static int ll_revalidate_dentry(struct dentry *dentry,
/*
* Always trust cached dentries. Update statahead window if necessary.
*/
int ll_revalidate_nd(struct dentry *dentry, unsigned int flags)
static int ll_revalidate_nd(struct dentry *dentry, unsigned int flags)
{
int rc;

Expand All @@ -368,15 +360,15 @@ int ll_revalidate_nd(struct dentry *dentry, unsigned int flags)
}


void ll_d_iput(struct dentry *de, struct inode *inode)
static void ll_d_iput(struct dentry *de, struct inode *inode)
{
LASSERT(inode);
if (!find_cbdata(inode))
clear_nlink(inode);
iput(inode);
}

struct dentry_operations ll_d_ops = {
const struct dentry_operations ll_d_ops = {
.d_revalidate = ll_revalidate_nd,
.d_release = ll_release,
.d_delete = ll_ddelete,
Expand Down
8 changes: 4 additions & 4 deletions drivers/staging/lustre/lustre/llite/dir.c
Original file line number Diff line number Diff line change
Expand Up @@ -632,7 +632,7 @@ static int ll_readdir(struct file *filp, struct dir_context *ctx)
return rc;
}

int ll_send_mgc_param(struct obd_export *mgc, char *string)
static int ll_send_mgc_param(struct obd_export *mgc, char *string)
{
struct mgs_send_param *msp;
int rc = 0;
Expand Down Expand Up @@ -1964,17 +1964,17 @@ static loff_t ll_dir_seek(struct file *file, loff_t offset, int origin)
return ret;
}

int ll_dir_open(struct inode *inode, struct file *file)
static int ll_dir_open(struct inode *inode, struct file *file)
{
return ll_file_open(inode, file);
}

int ll_dir_release(struct inode *inode, struct file *file)
static int ll_dir_release(struct inode *inode, struct file *file)
{
return ll_file_release(inode, file);
}

struct file_operations ll_dir_operations = {
const struct file_operations ll_dir_operations = {
.llseek = ll_dir_seek,
.open = ll_dir_open,
.release = ll_dir_release,
Expand Down
89 changes: 46 additions & 43 deletions drivers/staging/lustre/lustre/llite/file.c
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,17 @@

#include "cl_object.h"

struct ll_file_data *ll_file_data_get(void)
static int
ll_put_grouplock(struct inode *inode, struct file *file, unsigned long arg);

static int ll_lease_close(struct obd_client_handle *och, struct inode *inode,
bool *lease_broken);

static enum llioc_iter
ll_iocontrol_call(struct inode *inode, struct file *file,
unsigned int cmd, unsigned long arg, int *rcp);

static struct ll_file_data *ll_file_data_get(void)
{
struct ll_file_data *fd;

Expand Down Expand Up @@ -247,8 +257,8 @@ int ll_md_real_close(struct inode *inode, fmode_t fmode)
return rc;
}

int ll_md_close(struct obd_export *md_exp, struct inode *inode,
struct file *file)
static int ll_md_close(struct obd_export *md_exp, struct inode *inode,
struct file *file)
{
struct ll_file_data *fd = LUSTRE_FPRIVATE(file);
struct ll_inode_info *lli = ll_i2info(inode);
Expand Down Expand Up @@ -482,8 +492,8 @@ static int ll_och_fill(struct obd_export *md_exp, struct lookup_intent *it,
return md_set_open_replay_data(md_exp, och, it);
}

int ll_local_open(struct file *file, struct lookup_intent *it,
struct ll_file_data *fd, struct obd_client_handle *och)
static int ll_local_open(struct file *file, struct lookup_intent *it,
struct ll_file_data *fd, struct obd_client_handle *och)
{
struct inode *inode = file->f_dentry->d_inode;
struct ll_inode_info *lli = ll_i2info(inode);
Expand Down Expand Up @@ -733,8 +743,9 @@ static int ll_md_blocking_lease_ast(struct ldlm_lock *lock,
/**
* Acquire a lease and open the file.
*/
struct obd_client_handle *ll_lease_open(struct inode *inode, struct file *file,
fmode_t fmode, __u64 open_flags)
static struct obd_client_handle *
ll_lease_open(struct inode *inode, struct file *file, fmode_t fmode,
__u64 open_flags)
{
struct lookup_intent it = { .it_op = IT_OPEN };
struct ll_sb_info *sbi = ll_i2sbi(inode);
Expand Down Expand Up @@ -862,14 +873,13 @@ struct obd_client_handle *ll_lease_open(struct inode *inode, struct file *file,
OBD_FREE_PTR(och);
return ERR_PTR(rc);
}
EXPORT_SYMBOL(ll_lease_open);

/**
* Release lease and close the file.
* It will check if the lease has ever broken.
*/
int ll_lease_close(struct obd_client_handle *och, struct inode *inode,
bool *lease_broken)
static int ll_lease_close(struct obd_client_handle *och, struct inode *inode,
bool *lease_broken)
{
struct ldlm_lock *lock;
bool cancelled = true;
Expand All @@ -895,7 +905,6 @@ int ll_lease_close(struct obd_client_handle *och, struct inode *inode,
NULL);
return rc;
}
EXPORT_SYMBOL(ll_lease_close);

/* Fills the obdo with the attributes for the lsm */
static int ll_lsm_getattr(struct lov_stripe_md *lsm, struct obd_export *exp,
Expand Down Expand Up @@ -1590,7 +1599,8 @@ static int ll_lov_getstripe(struct inode *inode, unsigned long arg)
return rc;
}

int ll_get_grouplock(struct inode *inode, struct file *file, unsigned long arg)
static int
ll_get_grouplock(struct inode *inode, struct file *file, unsigned long arg)
{
struct ll_inode_info *lli = ll_i2info(inode);
struct ll_file_data *fd = LUSTRE_FPRIVATE(file);
Expand Down Expand Up @@ -1710,8 +1720,8 @@ int ll_release_openhandle(struct dentry *dentry, struct lookup_intent *it)
* Get size for inode for which FIEMAP mapping is requested.
* Make the FIEMAP get_info call and returns the result.
*/
int ll_do_fiemap(struct inode *inode, struct ll_user_fiemap *fiemap,
int num_bytes)
static int ll_do_fiemap(struct inode *inode, struct ll_user_fiemap *fiemap,
int num_bytes)
{
struct obd_export *exp = ll_i2dtexp(inode);
struct lov_stripe_md *lsm = NULL;
Expand Down Expand Up @@ -2190,7 +2200,8 @@ static int ll_hsm_import(struct inode *inode, struct file *file,
return rc;
}

long ll_file_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
static long
ll_file_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
{
struct inode *inode = file->f_dentry->d_inode;
struct ll_file_data *fd = LUSTRE_FPRIVATE(file);
Expand Down Expand Up @@ -2509,7 +2520,7 @@ long ll_file_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
}


loff_t ll_file_seek(struct file *file, loff_t offset, int origin)
static loff_t ll_file_seek(struct file *file, loff_t offset, int origin)
{
struct inode *inode = file->f_dentry->d_inode;
loff_t retval, eof = 0;
Expand All @@ -2533,7 +2544,7 @@ loff_t ll_file_seek(struct file *file, loff_t offset, int origin)
return retval;
}

int ll_flush(struct file *file, fl_owner_t id)
static int ll_flush(struct file *file, fl_owner_t id)
{
struct inode *inode = file->f_dentry->d_inode;
struct ll_inode_info *lli = ll_i2info(inode);
Expand Down Expand Up @@ -2670,7 +2681,8 @@ int ll_fsync(struct file *file, loff_t start, loff_t end, int datasync)
return rc;
}

int ll_file_flock(struct file *file, int cmd, struct file_lock *file_lock)
static int
ll_file_flock(struct file *file, int cmd, struct file_lock *file_lock)
{
struct inode *inode = file->f_dentry->d_inode;
struct ll_sb_info *sbi = ll_i2sbi(inode);
Expand Down Expand Up @@ -2799,7 +2811,8 @@ int ll_file_flock(struct file *file, int cmd, struct file_lock *file_lock)
return rc;
}

int ll_file_noflock(struct file *file, int cmd, struct file_lock *file_lock)
static int
ll_file_noflock(struct file *file, int cmd, struct file_lock *file_lock)
{
return -ENOSYS;
}
Expand Down Expand Up @@ -2891,8 +2904,7 @@ static int ll_inode_revalidate_fini(struct inode *inode, int rc)
return rc;
}

int __ll_inode_revalidate_it(struct dentry *dentry, struct lookup_intent *it,
__u64 ibits)
static int __ll_inode_revalidate(struct dentry *dentry, __u64 ibits)
{
struct inode *inode = dentry->d_inode;
struct ptlrpc_request *req = NULL;
Expand Down Expand Up @@ -2987,13 +2999,12 @@ int __ll_inode_revalidate_it(struct dentry *dentry, struct lookup_intent *it,
return rc;
}

int ll_inode_revalidate_it(struct dentry *dentry, struct lookup_intent *it,
__u64 ibits)
static int ll_inode_revalidate(struct dentry *dentry, __u64 ibits)
{
struct inode *inode = dentry->d_inode;
int rc;

rc = __ll_inode_revalidate_it(dentry, it, ibits);
rc = __ll_inode_revalidate(dentry, ibits);
if (rc != 0)
return rc;

Expand All @@ -3016,16 +3027,15 @@ int ll_inode_revalidate_it(struct dentry *dentry, struct lookup_intent *it,
return rc;
}

int ll_getattr_it(struct vfsmount *mnt, struct dentry *de,
struct lookup_intent *it, struct kstat *stat)
int ll_getattr(struct vfsmount *mnt, struct dentry *de, struct kstat *stat)
{
struct inode *inode = de->d_inode;
struct ll_sb_info *sbi = ll_i2sbi(inode);
struct ll_inode_info *lli = ll_i2info(inode);
int res = 0;

res = ll_inode_revalidate_it(de, it, MDS_INODELOCK_UPDATE |
MDS_INODELOCK_LOOKUP);
res = ll_inode_revalidate(de, MDS_INODELOCK_UPDATE |
MDS_INODELOCK_LOOKUP);
ll_stats_ops_tally(sbi, LPROC_LL_GETATTR, 1);

if (res)
Expand All @@ -3051,15 +3061,9 @@ int ll_getattr_it(struct vfsmount *mnt, struct dentry *de,

return 0;
}
int ll_getattr(struct vfsmount *mnt, struct dentry *de, struct kstat *stat)
{
struct lookup_intent it = { .it_op = IT_GETATTR };

return ll_getattr_it(mnt, de, &it, stat);
}

int ll_fiemap(struct inode *inode, struct fiemap_extent_info *fieinfo,
__u64 start, __u64 len)
static int ll_fiemap(struct inode *inode, struct fiemap_extent_info *fieinfo,
__u64 start, __u64 len)
{
int rc;
size_t num_bytes;
Expand Down Expand Up @@ -3091,7 +3095,7 @@ int ll_fiemap(struct inode *inode, struct fiemap_extent_info *fieinfo,
return rc;
}

struct posix_acl * ll_get_acl(struct inode *inode, int type)
struct posix_acl *ll_get_acl(struct inode *inode, int type)
{
struct ll_inode_info *lli = ll_i2info(inode);
struct posix_acl *acl = NULL;
Expand All @@ -3118,10 +3122,8 @@ int ll_inode_permission(struct inode *inode, int mask)
* need to do it before permission check. */

if (inode == inode->i_sb->s_root->d_inode) {
struct lookup_intent it = { .it_op = IT_LOOKUP };

rc = __ll_inode_revalidate_it(inode->i_sb->s_root, &it,
MDS_INODELOCK_LOOKUP);
rc = __ll_inode_revalidate(inode->i_sb->s_root,
MDS_INODELOCK_LOOKUP);
if (rc)
return rc;
}
Expand Down Expand Up @@ -3273,8 +3275,9 @@ void ll_iocontrol_unregister(void *magic)
EXPORT_SYMBOL(ll_iocontrol_register);
EXPORT_SYMBOL(ll_iocontrol_unregister);

enum llioc_iter ll_iocontrol_call(struct inode *inode, struct file *file,
unsigned int cmd, unsigned long arg, int *rcp)
static enum llioc_iter
ll_iocontrol_call(struct inode *inode, struct file *file,
unsigned int cmd, unsigned long arg, int *rcp)
{
enum llioc_iter ret = LLIOC_CONT;
struct llioc_data *data;
Expand Down
4 changes: 3 additions & 1 deletion drivers/staging/lustre/lustre/llite/llite_capa.c
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,8 @@ static unsigned long long ll_capa_renewal_noent = 0;
static unsigned long long ll_capa_renewal_failed = 0;
static unsigned long long ll_capa_renewal_retries = 0;

static int ll_update_capa(struct obd_capa *ocapa, struct lustre_capa *capa);

static inline void update_capa_timer(struct obd_capa *ocapa, cfs_time_t expiry)
{
if (cfs_time_before(expiry, ll_capa_timer.expires) ||
Expand Down Expand Up @@ -515,7 +517,7 @@ static inline void delay_capa_renew(struct obd_capa *oc, cfs_time_t delay)
oc->c_expiry = cfs_time_add(oc->c_expiry, cfs_time_seconds(delay));
}

int ll_update_capa(struct obd_capa *ocapa, struct lustre_capa *capa)
static int ll_update_capa(struct obd_capa *ocapa, struct lustre_capa *capa)
{
struct inode *inode = ocapa->u.cli.inode;
int rc = 0;
Expand Down
Loading

0 comments on commit 2d95f10

Please sign in to comment.