#ifdef __KERNEL__
# include <libcfs/libcfs.h>
# include <linux/module.h>
-# include <linux/jbd.h>
# include <asm/div64.h>
#else /* __KERNEL__ */
# include <liblustre.h>
#include <obd.h>
#include <obd_class.h>
-#include <lustre_ver.h>
#include <obd_support.h>
#include <lprocfs_status.h>
-
-#include <dt_object.h>
-#include <md_object.h>
#include <lustre_req_layout.h>
#include <lustre_fld.h>
#include <lustre_mdc.h>
static void fld_enter_request(struct client_obd *cli)
{
- struct mdc_cache_waiter mcw;
- struct l_wait_info lwi = { 0 };
-
- client_obd_list_lock(&cli->cl_loi_list_lock);
- if (cli->cl_r_in_flight >= cli->cl_max_rpcs_in_flight) {
- cfs_list_add_tail(&mcw.mcw_entry, &cli->cl_cache_waiters);
- cfs_waitq_init(&mcw.mcw_waitq);
- client_obd_list_unlock(&cli->cl_loi_list_lock);
- l_wait_event(mcw.mcw_waitq, fld_req_avail(cli, &mcw), &lwi);
- } else {
- cli->cl_r_in_flight++;
- client_obd_list_unlock(&cli->cl_loi_list_lock);
- }
+ struct mdc_cache_waiter mcw;
+ struct l_wait_info lwi = { 0 };
+
+ client_obd_list_lock(&cli->cl_loi_list_lock);
+ if (cli->cl_r_in_flight >= cli->cl_max_rpcs_in_flight) {
+ cfs_list_add_tail(&mcw.mcw_entry, &cli->cl_cache_waiters);
+ init_waitqueue_head(&mcw.mcw_waitq);
+ client_obd_list_unlock(&cli->cl_loi_list_lock);
+ l_wait_event(mcw.mcw_waitq, fld_req_avail(cli, &mcw), &lwi);
+ } else {
+ cli->cl_r_in_flight++;
+ client_obd_list_unlock(&cli->cl_loi_list_lock);
+ }
}
static void fld_exit_request(struct client_obd *cli)
{
- cfs_list_t *l, *tmp;
- struct mdc_cache_waiter *mcw;
-
- client_obd_list_lock(&cli->cl_loi_list_lock);
- cli->cl_r_in_flight--;
- cfs_list_for_each_safe(l, tmp, &cli->cl_cache_waiters) {
-
- if (cli->cl_r_in_flight >= cli->cl_max_rpcs_in_flight) {
- /* No free request slots anymore */
- break;
- }
-
- mcw = cfs_list_entry(l, struct mdc_cache_waiter, mcw_entry);
- cfs_list_del_init(&mcw->mcw_entry);
- cli->cl_r_in_flight++;
- cfs_waitq_signal(&mcw->mcw_waitq);
- }
- client_obd_list_unlock(&cli->cl_loi_list_lock);
+ cfs_list_t *l, *tmp;
+ struct mdc_cache_waiter *mcw;
+
+ client_obd_list_lock(&cli->cl_loi_list_lock);
+ cli->cl_r_in_flight--;
+ cfs_list_for_each_safe(l, tmp, &cli->cl_cache_waiters) {
+
+ if (cli->cl_r_in_flight >= cli->cl_max_rpcs_in_flight) {
+ /* No free request slots anymore */
+ break;
+ }
+
+ mcw = cfs_list_entry(l, struct mdc_cache_waiter, mcw_entry);
+ cfs_list_del_init(&mcw->mcw_entry);
+ cli->cl_r_in_flight++;
+ wake_up(&mcw->mcw_waitq);
+ }
+ client_obd_list_unlock(&cli->cl_loi_list_lock);
}
static int fld_rrb_hash(struct lu_client_fld *fld,
}
int fld_client_lookup(struct lu_client_fld *fld, seqno_t seq, mdsno_t *mds,
- __u32 flags, const struct lu_env *env)
+ __u32 flags, const struct lu_env *env)
{
- struct lu_seq_range res;
- struct lu_fld_target *target;
- int rc;
- ENTRY;
+ struct lu_seq_range res = { 0 };
+ struct lu_fld_target *target;
+ int rc;
+ ENTRY;
fld->lcf_flags |= LUSTRE_FLD_RUN;
"target %s (idx "LPU64")\n", fld->lcf_name, seq,
fld_target_name(target), target->ft_idx);
- res.lsr_start = seq;
- res.lsr_flags = flags;
-#ifdef __KERNEL__
- if (target->ft_srv != NULL) {
+ res.lsr_start = seq;
+ fld_range_set_type(&res, flags);
+
+#if defined(__KERNEL__) && defined(HAVE_SERVER_SUPPORT)
+ if (target->ft_srv != NULL) {
LASSERT(env != NULL);
rc = fld_server_lookup(env, target->ft_srv, seq, &res);
- } else {
-#endif
- rc = fld_client_rpc(target->ft_exp,
- &res, FLD_LOOKUP);
-#ifdef __KERNEL__
- }
+ } else
#endif
+ {
+ rc = fld_client_rpc(target->ft_exp, &res, FLD_LOOKUP);
+ }
- if (rc == 0) {
- *mds = res.lsr_index;
-
+ if (rc == 0) {
+ *mds = res.lsr_index;
fld_cache_insert(fld->lcf_cache, &res);
- }
- RETURN(rc);
+ }
+
+ RETURN(rc);
}
EXPORT_SYMBOL(fld_client_lookup);
fld_cache_flush(fld->lcf_cache);
}
EXPORT_SYMBOL(fld_client_flush);
+
+#ifdef __KERNEL__
+
+struct proc_dir_entry *fld_type_proc_dir;
+
+static int __init fld_mod_init(void)
+{
+ fld_type_proc_dir = lprocfs_register(LUSTRE_FLD_NAME,
+ proc_lustre_root,
+ NULL, NULL);
+ if (IS_ERR(fld_type_proc_dir))
+ return PTR_ERR(fld_type_proc_dir);
+
+#ifdef HAVE_SERVER_SUPPORT
+ fld_server_mod_init();
+#endif
+
+ return 0;
+}
+
+static void __exit fld_mod_exit(void)
+{
+#ifdef HAVE_SERVER_SUPPORT
+ fld_server_mod_exit();
+#endif
+
+ if (fld_type_proc_dir != NULL && !IS_ERR(fld_type_proc_dir)) {
+ lprocfs_remove(&fld_type_proc_dir);
+ fld_type_proc_dir = NULL;
+ }
+}
+
+MODULE_AUTHOR("Sun Microsystems, Inc. <http://www.lustre.org/>");
+MODULE_DESCRIPTION("Lustre FLD");
+MODULE_LICENSE("GPL");
+
+cfs_module(mdd, LUSTRE_VERSION_STRING, fld_mod_init, fld_mod_exit);
+#endif /* __KERNEL__ */