Remove the non seq file version of the cfs_hash functions.
Remove the basic cfs wrappers for procfs definations.
Change-Id: Ie4996656267998b78e44cdedfbf972f358e04d50
Signed-off-by: James Simmons <uja.ornl@gmail.com>
Reviewed-on: http://review.whamcloud.com/11743
Tested-by: Jenkins
Reviewed-by: Dmitry Eremin <dmitry.eremin@intel.com>
Tested-by: Maloo <hpdd-maloo@intel.com>
Reviewed-by: Bob Glossman <bob.glossman@intel.com>
Reviewed-by: Oleg Drokin <oleg.drokin@intel.com>
}
/* Generic debug formatting routines mainly for proc handler */
-#ifndef HAVE_ONLY_PROCFS_SEQ
-int cfs_hash_debug_header(char *str, int size);
-int cfs_hash_debug_str(cfs_hash_t *hs, char *str, int size);
-#endif
struct seq_file;
-int cfs_hash_debug_header_seq(struct seq_file *m);
-int cfs_hash_debug_str_seq(cfs_hash_t *hs, struct seq_file *m);
+int cfs_hash_debug_header(struct seq_file *m);
+int cfs_hash_debug_str(cfs_hash_t *hs, struct seq_file *m);
/*
* Generic djb2 hash algorithm for character arrays.
}
/*
- * Proc file system APIs
- */
-typedef struct proc_dir_entry cfs_proc_dir_entry_t;
-#define cfs_create_proc_entry(n, m, p) create_proc_entry(n, m, p)
-#define cfs_free_proc_entry(e) free_proc_entry(e)
-#define cfs_remove_proc_entry(n, e) remove_proc_entry(n, e)
-
-/*
* Wait Queue
*/
#endif
#ifdef LPROCFS
-typedef struct inode cfs_inode_t;
-typedef struct file_operations cfs_param_file_ops_t;
-typedef struct proc_dir_entry cfs_param_dentry_t;
-typedef struct poll_table_struct cfs_poll_table_t;
-#define CFS_PARAM_MODULE THIS_MODULE
-#define cfs_file_private(file) (file->private_data)
-
#ifndef HAVE_ONLY_PROCFS_SEQ
/* in lprocfs_stat.c, to protect the private data for proc entries */
extern struct rw_semaphore _lprocfs_lock;
#else /* New proc api */
-static inline cfs_param_dentry_t* PDE(struct inode *inode)
+static inline struct proc_dir_entry *PDE(struct inode *inode)
{
return NULL;
}
static inline
-int LPROCFS_ENTRY_CHECK(cfs_param_dentry_t *dp)
+int LPROCFS_ENTRY_CHECK(struct proc_dir_entry *dp)
{
return 0;
}
unsigned int param_flags;
};
-typedef struct cfs_param_inode {
- void *param_private;
-} cfs_inode_t;
+struct inode {
+ void *param_private;
+};
-typedef struct cfs_param_dentry {
- void *param_data;
-} cfs_param_dentry_t;
+struct poll_table_struct {
+ void *pad;
+};
-typedef struct cfs_proc_inode {
- cfs_param_dentry_t *param_pde;
- cfs_inode_t param_inode;
-} cfs_proc_inode_t;
+struct proc_dir_entry {
+ void *param_data;
+};
+
+struct proc_inode {
+ struct proc_dir_entry *param_pde;
+ struct inode param_inode;
+};
struct seq_operations;
struct seq_file {
int (*show) (struct seq_file *m, void *v);
};
-typedef void *cfs_poll_table_t;
-
-typedef struct cfs_param_file_ops {
- struct module *owner;
- int (*open) (cfs_inode_t *, struct file *);
- loff_t (*llseek)(struct file *, loff_t, int);
- int (*release) (cfs_inode_t *, struct file *);
- unsigned int (*poll) (struct file *, cfs_poll_table_t *);
- ssize_t (*write) (struct file *, const char *, size_t, loff_t *);
- ssize_t (*read)(struct file *, char *, size_t, loff_t *);
-} cfs_param_file_ops_t;
-typedef cfs_param_file_ops_t *cfs_lproc_filep_t;
-
-#define CFS_PARAM_MODULE NULL
-#define seq_lseek NULL
+#define seq_lseek NULL
static inline int seq_read(char *buf, size_t count, loff_t *ppos)
{
return 0;
}
-static inline cfs_proc_inode_t *FAKE_PROC_I(const cfs_inode_t *inode)
+static inline struct proc_inode *FAKE_PROC_I(const struct inode *inode)
{
- return container_of(inode, cfs_proc_inode_t, param_inode);
+ return container_of(inode, struct proc_inode, param_inode);
}
-static inline cfs_param_dentry_t *PDE(cfs_inode_t *inode)
+static inline struct proc_dir_entry *PDE(struct inode *inode)
{
return FAKE_PROC_I(inode)->param_pde;
}
static inline
-int LPROCFS_ENTRY_CHECK(cfs_param_dentry_t *dp)
+int LPROCFS_ENTRY_CHECK(struct proc_dir_entry *dp)
{
return 0;
}
# define EXPORT_SYMBOL(s)
#endif
-typedef struct proc_dir_entry cfs_proc_dir_entry_t;
-
/*
* Just present a single processor until will add thread support.
*/
}
EXPORT_SYMBOL(cfs_hash_rehash_key);
-#ifndef HAVE_ONLY_PROCFS_SEQ
-int cfs_hash_debug_header(char *str, int size)
-{
- return snprintf(str, size, "%-*s%6s%6s%6s%6s%6s%6s%6s%7s%8s%8s%8s%s\n",
- CFS_HASH_BIGNAME_LEN,
- "name", "cur", "min", "max", "theta", "t-min", "t-max",
- "flags", "rehash", "count", "maxdep", "maxdepb",
- " distribution");
-}
-EXPORT_SYMBOL(cfs_hash_debug_header);
-#endif
-
-int cfs_hash_debug_header_seq(struct seq_file *m)
+int cfs_hash_debug_header(struct seq_file *m)
{
return seq_printf(m, "%-*s%6s%6s%6s%6s%6s%6s%6s%7s%8s%8s%8s%s\n",
CFS_HASH_BIGNAME_LEN,
"flags", "rehash", "count", "maxdep", "maxdepb",
" distribution");
}
-EXPORT_SYMBOL(cfs_hash_debug_header_seq);
+EXPORT_SYMBOL(cfs_hash_debug_header);
static cfs_hash_bucket_t **
cfs_hash_full_bkts(cfs_hash_t *hs)
CFS_HASH_RH_NBKT(hs) : CFS_HASH_NBKT(hs);
}
-#ifndef HAVE_ONLY_PROCFS_SEQ
-int cfs_hash_debug_str(cfs_hash_t *hs, char *str, int size)
-{
- int dist[8] = { 0, };
- int maxdep = -1;
- int maxdepb = -1;
- int total = 0;
- int c = 0;
- int theta;
- int i;
-
- if (str == NULL || size == 0)
- return 0;
-
- cfs_hash_lock(hs, 0);
- theta = __cfs_hash_theta(hs);
-
- c += snprintf(str + c, size - c, "%-*s ",
- CFS_HASH_BIGNAME_LEN, hs->hs_name);
- c += snprintf(str + c, size - c, "%5d ", 1 << hs->hs_cur_bits);
- c += snprintf(str + c, size - c, "%5d ", 1 << hs->hs_min_bits);
- c += snprintf(str + c, size - c, "%5d ", 1 << hs->hs_max_bits);
- c += snprintf(str + c, size - c, "%d.%03d ",
- __cfs_hash_theta_int(theta),
- __cfs_hash_theta_frac(theta));
- c += snprintf(str + c, size - c, "%d.%03d ",
- __cfs_hash_theta_int(hs->hs_min_theta),
- __cfs_hash_theta_frac(hs->hs_min_theta));
- c += snprintf(str + c, size - c, "%d.%03d ",
- __cfs_hash_theta_int(hs->hs_max_theta),
- __cfs_hash_theta_frac(hs->hs_max_theta));
- c += snprintf(str + c, size - c, " 0x%02x ", hs->hs_flags);
- c += snprintf(str + c, size - c, "%6d ", hs->hs_rehash_count);
-
- /*
- * The distribution is a summary of the chained hash depth in
- * each of the libcfs hash buckets. Each buckets hsb_count is
- * divided by the hash theta value and used to generate a
- * histogram of the hash distribution. A uniform hash will
- * result in all hash buckets being close to the average thus
- * only the first few entries in the histogram will be non-zero.
- * If you hash function results in a non-uniform hash the will
- * be observable by outlier bucks in the distribution histogram.
- *
- * Uniform hash distribution: 128/128/0/0/0/0/0/0
- * Non-Uniform hash distribution: 128/125/0/0/0/0/2/1
- */
- for (i = 0; i < cfs_hash_full_nbkt(hs); i++) {
- cfs_hash_bd_t bd;
-
- bd.bd_bucket = cfs_hash_full_bkts(hs)[i];
- cfs_hash_bd_lock(hs, &bd, 0);
- if (maxdep < bd.bd_bucket->hsb_depmax) {
- maxdep = bd.bd_bucket->hsb_depmax;
-#ifdef __KERNEL__
- maxdepb = ffz(~maxdep);
-#endif
- }
- total += bd.bd_bucket->hsb_count;
- dist[min(fls(bd.bd_bucket->hsb_count/max(theta,1)),7)]++;
- cfs_hash_bd_unlock(hs, &bd, 0);
- }
-
- c += snprintf(str + c, size - c, "%7d ", total);
- c += snprintf(str + c, size - c, "%7d ", maxdep);
- c += snprintf(str + c, size - c, "%7d ", maxdepb);
- for (i = 0; i < 8; i++)
- c += snprintf(str + c, size - c, "%d%c", dist[i],
- (i == 7) ? '\n' : '/');
-
- cfs_hash_unlock(hs, 0);
-
- return c;
-}
-EXPORT_SYMBOL(cfs_hash_debug_str);
-#endif
-
-int cfs_hash_debug_str_seq(cfs_hash_t *hs, struct seq_file *m)
+int cfs_hash_debug_str(cfs_hash_t *hs, struct seq_file *m)
{
int dist[8] = { 0, };
int maxdep = -1;
cfs_hash_unlock(hs, 0);
return c;
}
-EXPORT_SYMBOL(cfs_hash_debug_str_seq);
+EXPORT_SYMBOL(cfs_hash_debug_str);
The QSD API is defined in lustre/include/lustre_quota.h as follows:
struct qsd_instance *qsd_init(const struct lu_env *, char *, struct dt_device *,
- cfs_proc_dir_entry_t *);
+ struct proc_dir_entry *);
int qsd_prepare(const struct lu_env *, struct qsd_instance *);
int qsd_start(const struct lu_env *, struct qsd_instance *);
void qsd_fini(const struct lu_env *, struct qsd_instance *);
#define EXTRA_FIRST_OPC LDLM_GLIMPSE_ENQUEUE
/* class_obd.c */
-extern cfs_proc_dir_entry_t *proc_lustre_root;
+extern struct proc_dir_entry *proc_lustre_root;
struct obd_device;
struct obd_histogram;
struct obd_export;
struct nid_stat;
extern int lprocfs_add_clear_entry(struct obd_device * obd,
- cfs_proc_dir_entry_t *entry);
+ struct proc_dir_entry *entry);
#ifdef HAVE_SERVER_SUPPORT
extern int lprocfs_exp_setup(struct obd_export *exp,
lnet_nid_t *peer_nid, int *newnid);
size_t count, loff_t *off);
extern int lprocfs_nid_stats_clear_seq_show(struct seq_file *file, void *data);
#endif
-extern int lprocfs_register_stats(cfs_proc_dir_entry_t *root, const char *name,
+extern int lprocfs_register_stats(struct proc_dir_entry *root, const char *name,
struct lprocfs_stats *stats);
/* lprocfs_status.c */
#ifndef HAVE_ONLY_PROCFS_SEQ
-extern int lprocfs_add_vars(cfs_proc_dir_entry_t *root,
+extern int lprocfs_add_vars(struct proc_dir_entry *root,
struct lprocfs_vars *var,
void *data);
-extern cfs_proc_dir_entry_t *lprocfs_register(const char *name,
- cfs_proc_dir_entry_t *parent,
+extern struct proc_dir_entry *lprocfs_register(const char *name,
+ struct proc_dir_entry *parent,
struct lprocfs_vars *list,
void *data);
#endif
-extern int lprocfs_seq_add_vars(cfs_proc_dir_entry_t *root,
+extern int lprocfs_seq_add_vars(struct proc_dir_entry *root,
struct lprocfs_seq_vars *var,
void *data);
-extern cfs_proc_dir_entry_t *
-lprocfs_seq_register(const char *name, cfs_proc_dir_entry_t *parent,
+extern struct proc_dir_entry *
+lprocfs_seq_register(const char *name, struct proc_dir_entry *parent,
struct lprocfs_seq_vars *list, void *data);
-extern void lprocfs_remove(cfs_proc_dir_entry_t **root);
+extern void lprocfs_remove(struct proc_dir_entry **root);
extern void lprocfs_remove_proc_entry(const char *name,
struct proc_dir_entry *parent);
#ifndef HAVE_ONLY_PROCFS_SEQ
extern void lprocfs_try_remove_proc_entry(const char *name,
struct proc_dir_entry *parent);
-extern cfs_proc_dir_entry_t *lprocfs_srch(cfs_proc_dir_entry_t *root,
+extern struct proc_dir_entry *lprocfs_srch(struct proc_dir_entry *root,
const char *name);
#endif
extern int lprocfs_obd_setup(struct obd_device *dev);
lprocfs_ir_factor_seq_write(struct file *file, const char *buffer,
size_t count, loff_t *off);
#endif
-extern int lprocfs_single_release(cfs_inode_t *, struct file *);
-extern int lprocfs_seq_release(cfs_inode_t *, struct file *);
+extern int lprocfs_single_release(struct inode *, struct file *);
+extern int lprocfs_seq_release(struct inode *, struct file *);
/* You must use these macros when you want to refer to
* the import in a client obd_device for a lprocfs entry */
a read-write proc entry, and then call LPROC_SEQ_SEQ instead. Finally,
call lprocfs_obd_seq_create(obd, filename, 0444, &name#_fops, data); */
#define __LPROC_SEQ_FOPS(name, custom_seq_write) \
-static int name##_single_open(cfs_inode_t *inode, struct file *file) \
+static int name##_single_open(struct inode *inode, struct file *file) \
{ \
LPROCFS_ENTRY_CHECK(PDE(inode)); \
return single_open(file, name##_seq_show, PDE_DATA(inode)); \
static ssize_t name##_##type##_write(struct file *file, \
const char *buffer, size_t count, loff_t *off) \
{ \
- return lprocfs_##type##_seq_write(file, buffer, count, off); \
+ return lprocfs_##type##_seq_write(file, buffer, count, off);\
} \
- static int name##_##type##_open(cfs_inode_t *inode, struct file *file) \
+ static int name##_##type##_open(struct inode *inode, struct file *file)\
{ \
return single_open(file, NULL, PDE_DATA(inode)); \
} \
{ return; }
static inline void lprocfs_free_stats(struct lprocfs_stats **stats)
{ return; }
-static inline int lprocfs_register_stats(cfs_proc_dir_entry_t *root,
+static inline int lprocfs_register_stats(struct proc_dir_entry *root,
const char *name,
struct lprocfs_stats *stats)
{ return 0; }
const char *format, ...)
{return NULL; }
#ifndef HAVE_ONLY_PROCFS_SEQ
-static inline cfs_proc_dir_entry_t *
-lprocfs_register(const char *name, cfs_proc_dir_entry_t *parent,
+static inline struct proc_dir_entry *
+lprocfs_register(const char *name, struct proc_dir_entry *parent,
struct lprocfs_vars *list, void *data)
{ return NULL; }
-static inline int lprocfs_add_vars(cfs_proc_dir_entry_t *root,
+static inline int lprocfs_add_vars(struct proc_dir_entry *root,
struct lprocfs_vars *var,
void *data)
{ return 0; }
#endif
-static inline int lprocfs_seq_add_vars(cfs_proc_dir_entry_t *root,
+static inline int lprocfs_seq_add_vars(struct proc_dir_entry *root,
struct lprocfs_seq_vars *var,
void *data)
{ return 0; }
-static inline cfs_proc_dir_entry_t *
-lprocfs_seq_register(const char *name, cfs_proc_dir_entry_t *parent,
+static inline struct proc_dir_entry *
+lprocfs_seq_register(const char *name, struct proc_dir_entry *parent,
struct lprocfs_seq_vars *list, void *data)
{ return NULL; }
-static inline void lprocfs_remove(cfs_proc_dir_entry_t **root)
+static inline void lprocfs_remove(struct proc_dir_entry **root)
{ return; }
static inline void lprocfs_remove_proc_entry(const char *name,
struct proc_dir_entry *parent)
static inline void lprocfs_try_remove_proc_entry(const char *name,
struct proc_dir_entry *parent)
{ return; }
-static inline cfs_proc_dir_entry_t *lprocfs_srch(cfs_proc_dir_entry_t *head,
+static inline struct proc_dir_entry *lprocfs_srch(struct proc_dir_entry *head,
const char *name)
{ return 0; }
#endif
struct lu_seq_range lcs_space;
/* Seq related proc */
- cfs_proc_dir_entry_t *lcs_proc_dir;
+ struct proc_dir_entry *lcs_proc_dir;
/* This holds last allocated fid in last obtained seq */
struct lu_fid lcs_fid;
struct dt_object *lss_obj;
/* Seq related proc */
- cfs_proc_dir_entry_t *lss_proc_dir;
+ struct proc_dir_entry *lss_proc_dir;
/* LUSTRE_SEQ_SERVER or LUSTRE_SEQ_CONTROLLER */
enum lu_mgr_type lss_type;
struct lu_server_fld {
/**
* Fld dir proc entry. */
- cfs_proc_dir_entry_t *lsf_proc_dir;
+ struct proc_dir_entry *lsf_proc_dir;
/**
* /fld file object device */
/** limit of threads number for each partition */
int srv_nthrs_cpt_limit;
/** Root of /proc dir tree for this service */
- cfs_proc_dir_entry_t *srv_procroot;
+ struct proc_dir_entry *srv_procroot;
/** Pointer to statistic data for this service */
struct lprocfs_stats *srv_stats;
/** # hp per lp reqs to handle */
* enforcement. Arguments are documented where each function is defined. */
struct qsd_instance *qsd_init(const struct lu_env *, char *, struct dt_device *,
- cfs_proc_dir_entry_t *);
+ struct proc_dir_entry *);
int qsd_prepare(const struct lu_env *, struct qsd_instance *);
int qsd_start(const struct lu_env *, struct qsd_instance *);
void qsd_fini(const struct lu_env *, struct qsd_instance *);
struct dt_device lod_dt_dev;
struct obd_export *lod_child_exp;
struct dt_device *lod_child;
- cfs_proc_dir_entry_t *lod_proc_entry;
+ struct proc_dir_entry *lod_proc_entry;
struct lprocfs_stats *lod_stats;
spinlock_t lod_connects_lock;
int lod_connects;
struct lu_fid mdd_local_root_fid;
struct dt_device_param mdd_dt_conf;
struct dt_object *mdd_orphans; /* PENDING directory */
- cfs_proc_dir_entry_t *mdd_proc_entry;
+ struct proc_dir_entry *mdd_proc_entry;
struct mdd_changelog mdd_cl;
unsigned long mdd_atime_diff;
struct mdd_object *mdd_dot_lustre;
{
static struct ptlrpc_service_conf conf;
struct obd_device *obd = m->mds_md_dev.md_lu_dev.ld_obd;
- cfs_proc_dir_entry_t *procfs_entry;
+ struct proc_dir_entry *procfs_entry;
int rc = 0;
ENTRY;
struct dt_object *mgs_nidtbl_dir;
struct list_head mgs_fs_db_list;
spinlock_t mgs_lock; /* covers mgs_fs_db_list */
- cfs_proc_dir_entry_t *mgs_proc_live;
- cfs_proc_dir_entry_t *mgs_proc_osd;
- cfs_proc_dir_entry_t *mgs_proc_fstype;
- cfs_proc_dir_entry_t *mgs_proc_mntdev;
+ struct proc_dir_entry *mgs_proc_live;
+ struct proc_dir_entry *mgs_proc_osd;
+ struct proc_dir_entry *mgs_proc_fstype;
+ struct proc_dir_entry *mgs_proc_mntdev;
cfs_time_t mgs_start_time;
struct obd_device *mgs_obd;
struct local_oid_storage *mgs_los;
struct obd_export *exp = cfs_hash_object(hs, hnode);
if (exp->exp_lock_hash != NULL) {
- cfs_hash_debug_header_seq(m);
- cfs_hash_debug_str_seq(hs, m);
+ cfs_hash_debug_header(m);
+ cfs_hash_debug_str(hs, m);
}
return 0;
}
if (obd == NULL)
return 0;
- c += cfs_hash_debug_header_seq(m);
- c += cfs_hash_debug_str_seq(obd->obd_uuid_hash, m);
- c += cfs_hash_debug_str_seq(obd->obd_nid_hash, m);
- c += cfs_hash_debug_str_seq(obd->obd_nid_stats_hash, m);
+ c += cfs_hash_debug_header(m);
+ c += cfs_hash_debug_str(obd->obd_uuid_hash, m);
+ c += cfs_hash_debug_str(obd->obd_nid_hash, m);
+ c += cfs_hash_debug_str(obd->obd_nid_stats_hash, m);
return c;
}
EXPORT_SYMBOL(lprocfs_hash_seq_show);
static int ofd_procfs_init(struct ofd_device *ofd)
{
struct obd_device *obd = ofd_obd(ofd);
- cfs_proc_dir_entry_t *entry;
+ struct proc_dir_entry *entry;
int rc = 0;
ENTRY;
struct lustre_capa_key *od_capa_keys;
struct hlist_head *od_capa_hash;
- cfs_proc_dir_entry_t *od_proc_entry;
+ struct proc_dir_entry *od_proc_entry;
struct lprocfs_stats *od_stats;
uint64_t od_root;
struct obd_uuid opd_cluuid;
struct obd_connect_data *opd_connect_data;
int opd_connects;
- cfs_proc_dir_entry_t *opd_proc_entry;
+ struct proc_dir_entry *opd_proc_entry;
struct lprocfs_stats *opd_stats;
/* connection status. */
unsigned int opd_new_connection:1,
/* how often to update statfs data */
int opd_statfs_maxage;
- cfs_proc_dir_entry_t *opd_symlink;
+ struct proc_dir_entry *opd_symlink;
/* If the caller wants to do some idempotent async operations on
* remote server, it can append the async remote requests on the
struct list_head qmt_pool_list;
/* procfs root directory for this qmt */
- cfs_proc_dir_entry_t *qmt_proc;
+ struct proc_dir_entry *qmt_proc;
/* dedicated thread in charge of space rebalancing */
struct ptlrpc_thread qmt_reba_thread;
struct lquota_entry *qpi_grace_lqe[MAXQUOTAS];
/* procfs root directory for this pool */
- cfs_proc_dir_entry_t *qpi_proc;
+ struct proc_dir_entry *qpi_proc;
/* pool directory where all indexes related to this pool instance are
* stored */
/* procfs directory where information related to the underlying slaves
* are exported */
- cfs_proc_dir_entry_t *qsd_proc;
+ struct proc_dir_entry *qsd_proc;
/* export used for the connection to quota master */
struct obd_export *qsd_exp;
*/
struct qsd_instance *qsd_init(const struct lu_env *env, char *svname,
struct dt_device *dev,
- cfs_proc_dir_entry_t *osd_proc)
+ struct proc_dir_entry *osd_proc)
{
struct qsd_thread_info *qti = qsd_info(env);
struct qsd_instance *qsd;