* Copyright (c) 2009, 2010, Oracle and/or its affiliates. All rights reserved.
* Use is subject to license terms.
*
- * Copyright (c) 2011, 2012, Whamcloud, Inc.
+ * Copyright (c) 2012, 2013, Intel Corporation.
*/
/*
* This file is part of Lustre, http://www.lustre.org/
#include <obd_class.h>
#include <lustre_param.h>
+#include <lustre_fid.h>
#include "ofd_internal.h"
* precreate request size (see ofd_grant_create()
*/
ofd_grant_connect(env, dev->ld_obd->obd_self_export,
- OST_MAX_PRECREATE * ofd->ofd_dt_conf.ddp_inodespace);
+ OST_MAX_PRECREATE * ofd->ofd_dt_conf.ddp_inodespace,
+ false);
rc = next->ld_ops->ldo_recovery_complete(env, next);
RETURN(rc);
}
lprocfs_counter_init(obd->obd_stats, LPROC_OFD_WRITE_BYTES,
LPROCFS_CNTR_AVGMINMAX, "write_bytes", "bytes");
- rc = lproc_ofd_attach_seqstat(obd);
- if (rc) {
- CERROR("%s: create seqstat failed: %d.\n", obd->obd_name, rc);
- GOTO(free_obd_stats, rc);
- }
-
entry = lprocfs_register("exports", obd->obd_proc_entry, NULL, NULL);
if (IS_ERR(entry)) {
rc = PTR_ERR(entry);
CERROR("%s: error %d setting up lprocfs for %s\n",
obd->obd_name, rc, "exports");
- GOTO(free_obd_stats, rc);
+ GOTO(obd_cleanup, rc);
}
obd->obd_proc_exports_entry = entry;
rc = PTR_ERR(entry);
CERROR("%s: add proc entry 'clear' failed: %d.\n",
obd->obd_name, rc);
- GOTO(free_obd_stats, rc);
+ GOTO(obd_cleanup, rc);
}
rc = lprocfs_job_stats_init(obd, LPROC_OFD_STATS_LAST,
RETURN(0);
remove_entry_clear:
lprocfs_remove_proc_entry("clear", obd->obd_proc_exports_entry);
-free_obd_stats:
- lprocfs_free_obd_stats(obd);
obd_cleanup:
lprocfs_obd_cleanup(obd);
+ lprocfs_free_obd_stats(obd);
+
return rc;
}
-static int ofd_procfs_fini(struct ofd_device *ofd)
+static void ofd_procfs_add_brw_stats_symlink(struct ofd_device *ofd)
+{
+ struct obd_device *obd = ofd_obd(ofd);
+ struct obd_device *osd_obd = ofd->ofd_osd_exp->exp_obd;
+ cfs_proc_dir_entry_t *osd_root = osd_obd->obd_type->typ_procroot;
+ cfs_proc_dir_entry_t *osd_dir;
+
+ osd_dir = lprocfs_srch(osd_root, obd->obd_name);
+ if (osd_dir == NULL)
+ return;
+
+ if (lprocfs_srch(osd_dir, "brw_stats") != NULL)
+ lprocfs_add_symlink("brw_stats", obd->obd_proc_entry,
+ "../../%s/%s/brw_stats",
+ osd_root->name, osd_dir->name);
+
+ if (lprocfs_srch(osd_dir, "read_cache_enable") != NULL)
+ lprocfs_add_symlink("read_cache_enable", obd->obd_proc_entry,
+ "../../%s/%s/read_cache_enable",
+ osd_root->name, osd_dir->name);
+
+ if (lprocfs_srch(osd_dir, "readcache_max_filesize") != NULL)
+ lprocfs_add_symlink("readcache_max_filesize",
+ obd->obd_proc_entry,
+ "../../%s/%s/readcache_max_filesize",
+ osd_root->name, osd_dir->name);
+
+ if (lprocfs_srch(osd_dir, "writethrough_cache_enable") != NULL)
+ lprocfs_add_symlink("writethrough_cache_enable",
+ obd->obd_proc_entry,
+ "../../%s/%s/writethrough_cache_enable",
+ osd_root->name, osd_dir->name);
+}
+
+static void ofd_procfs_fini(struct ofd_device *ofd)
{
struct obd_device *obd = ofd_obd(ofd);
- lprocfs_job_stats_fini(obd);
+ lprocfs_remove_proc_entry("writethrough_cache_enable",
+ obd->obd_proc_entry);
+ lprocfs_remove_proc_entry("readcache_max_filesize",
+ obd->obd_proc_entry);
+ lprocfs_remove_proc_entry("read_cache_enable", obd->obd_proc_entry);
+ lprocfs_remove_proc_entry("brw_stats", obd->obd_proc_entry);
lprocfs_remove_proc_entry("clear", obd->obd_proc_exports_entry);
lprocfs_free_per_client_stats(obd);
- lprocfs_free_obd_stats(obd);
lprocfs_obd_cleanup(obd);
- return 0;
+ lprocfs_free_obd_stats(obd);
+ lprocfs_job_stats_fini(obd);
}
extern int ost_handle(struct ptlrpc_request *req);
+int ofd_fid_fini(const struct lu_env *env, struct ofd_device *ofd)
+{
+ return seq_site_fini(env, &ofd->ofd_seq_site);
+}
+
+int ofd_fid_init(const struct lu_env *env, struct ofd_device *ofd)
+{
+ struct seq_server_site *ss = &ofd->ofd_seq_site;
+ struct lu_device *lu = &ofd->ofd_dt_dev.dd_lu_dev;
+ char *obd_name = ofd_name(ofd);
+ char *name = NULL;
+ int rc = 0;
+
+ ss = &ofd->ofd_seq_site;
+ lu->ld_site->ld_seq_site = ss;
+ ss->ss_lu = lu->ld_site;
+ ss->ss_node_id = ofd->ofd_lut.lut_lsd.lsd_osd_index;
+
+ OBD_ALLOC_PTR(ss->ss_server_seq);
+ if (ss->ss_server_seq == NULL)
+ GOTO(out_free, rc = -ENOMEM);
+
+ OBD_ALLOC(name, strlen(obd_name) + 10);
+ if (!name) {
+ OBD_FREE_PTR(ss->ss_server_seq);
+ ss->ss_server_seq = NULL;
+ GOTO(out_free, rc = -ENOMEM);
+ }
+
+ rc = seq_server_init(ss->ss_server_seq, ofd->ofd_osd, obd_name,
+ LUSTRE_SEQ_SERVER, ss, env);
+ if (rc) {
+ CERROR("%s : seq server init error %d\n", obd_name, rc);
+ GOTO(out_free, rc);
+ }
+ ss->ss_server_seq->lss_space.lsr_index = ss->ss_node_id;
+
+ OBD_ALLOC_PTR(ss->ss_client_seq);
+ if (ss->ss_client_seq == NULL)
+ GOTO(out_free, -ENOMEM);
+
+ snprintf(name, strlen(obd_name) + 6, "%p-super", obd_name);
+ rc = seq_client_init(ss->ss_client_seq, NULL, LUSTRE_SEQ_DATA,
+ name, NULL);
+ if (rc) {
+ CERROR("%s : seq client init error %d\n", obd_name, rc);
+ GOTO(out_free, rc);
+ }
+ OBD_FREE(name, strlen(obd_name) + 10);
+ name = NULL;
+
+ rc = seq_server_set_cli(ss->ss_server_seq, ss->ss_client_seq, env);
+
+out_free:
+ if (rc) {
+ if (ss->ss_server_seq) {
+ seq_server_fini(ss->ss_server_seq, env);
+ OBD_FREE_PTR(ss->ss_server_seq);
+ ss->ss_server_seq = NULL;
+ }
+
+ if (ss->ss_client_seq) {
+ seq_client_fini(ss->ss_client_seq);
+ OBD_FREE_PTR(ss->ss_client_seq);
+ ss->ss_client_seq = NULL;
+ }
+
+ if (name) {
+ OBD_FREE(name, strlen(obd_name) + 10);
+ name = NULL;
+ }
+ }
+
+ return rc;
+}
+
static int ofd_init0(const struct lu_env *env, struct ofd_device *m,
struct lu_device_type *ldt, struct lustre_cfg *cfg)
{
m->ofd_tot_dirty = 0;
m->ofd_tot_granted = 0;
m->ofd_tot_pending = 0;
- m->ofd_max_group = 0;
+ m->ofd_seq_count = 0;
+ spin_lock_init(&m->ofd_batch_lock);
rwlock_init(&obd->u.filter.fo_sptlrpc_lock);
sptlrpc_rule_set_init(&obd->u.filter.fo_sptlrpc_rset);
}
/* No connection accepted until configurations will finish */
+ spin_lock(&obd->obd_dev_lock);
obd->obd_no_conn = 1;
+ spin_unlock(&obd->obd_dev_lock);
obd->obd_replayable = 1;
if (cfg->lcfg_bufcount > 4 && LUSTRE_CFG_BUFLEN(cfg, 4) > 0) {
char *str = lustre_cfg_string(cfg, 4);
GOTO(err_fini_proc, rc);
}
+ ofd_procfs_add_brw_stats_symlink(m);
+
/* populate cached statfs data */
osfs = &ofd_info(env)->fti_u.osfs;
rc = ofd_statfs_internal(env, m, osfs, 0, NULL);
if (osfs->os_bsize * osfs->os_blocks < OFD_PRECREATE_SMALL_FS)
m->ofd_precreate_batch = OFD_PRECREATE_BATCH_SMALL;
- snprintf(info->fti_u.name, sizeof(info->fti_u.name), "filter-%p", m);
+ snprintf(info->fti_u.name, sizeof(info->fti_u.name), "%s-%s",
+ "filter"/*LUSTRE_OST_NAME*/, obd->obd_uuid.uuid);
m->ofd_namespace = ldlm_namespace_new(obd, info->fti_u.name,
LDLM_NAMESPACE_SERVER,
LDLM_NAMESPACE_GREEDY,