* Copyright (c) 2009, 2010, Oracle and/or its affiliates. All rights reserved.
* Use is subject to license terms.
*
- * Copyright (c) 2012, Intel Corporation.
+ * 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 <lustre_lfsck.h>
#include "ofd_internal.h"
/* Slab for OFD object allocation */
-static cfs_mem_cache_t *ofd_object_kmem;
+static struct kmem_cache *ofd_object_kmem;
static struct lu_kmem_descr ofd_caches[] = {
{
ENTRY;
- OBD_SLAB_ALLOC_PTR_GFP(of, ofd_object_kmem, CFS_ALLOC_IO);
+ OBD_SLAB_ALLOC_PTR_GFP(of, ofd_object_kmem, __GFP_IO);
if (of != NULL) {
struct lu_object *o;
struct lu_object_header *h;
static int ofd_prepare(const struct lu_env *env, struct lu_device *pdev,
struct lu_device *dev)
{
- struct ofd_thread_info *info;
- struct ofd_device *ofd = ofd_dev(dev);
- struct obd_device *obd = ofd_obd(ofd);
- struct lu_device *next = &ofd->ofd_osd->dd_lu_dev;
- int rc;
+ struct ofd_thread_info *info;
+ struct ofd_device *ofd = ofd_dev(dev);
+ struct obd_device *obd = ofd_obd(ofd);
+ struct lu_device *next = &ofd->ofd_osd->dd_lu_dev;
+ struct lfsck_start_param lsp;
+ int rc;
ENTRY;
/* initialize lower device */
rc = next->ld_ops->ldo_prepare(env, dev, next);
+ if (rc != 0)
+ RETURN(rc);
+
+ rc = lfsck_register(env, ofd->ofd_osd, &ofd->ofd_dt_dev, false);
+ if (rc != 0) {
+ CERROR("%s: failed to initialize lfsck: rc = %d\n",
+ obd->obd_name, rc);
+ RETURN(rc);
+ }
+
+ lsp.lsp_start = NULL;
+ lsp.lsp_namespace = ofd->ofd_namespace;
+ rc = lfsck_start(env, ofd->ofd_osd, &lsp);
+ if (rc != 0) {
+ CWARN("%s: auto trigger paused LFSCK failed: rc = %d\n",
+ obd->obd_name, rc);
+ rc = 0;
+ }
target_recovery_init(&ofd->ofd_lut, ost_handle);
LASSERT(obd->obd_no_conn);
{
struct ofd_device *ofd = ofd_dev(dev);
struct lu_device *next = &ofd->ofd_osd->dd_lu_dev;
- int rc = 0;
+ int rc = 0, max_precreate;
ENTRY;
/* Grant space for object precreation on the self export.
- * This initial reserved space (i.e. 20MB for zfs and 560KB for ldiskfs)
- * is enough to create 20k objects. It is then adapted based on the
- * precreate request size (see ofd_grant_create()
+ * This initial reserved space (i.e. 10MB for zfs and 280KB for ldiskfs)
+ * is enough to create 10k objects. More space is then acquired for
+ * precreation in ofd_grant_create().
*/
- ofd_grant_connect(env, dev->ld_obd->obd_self_export,
- OST_MAX_PRECREATE * ofd->ofd_dt_conf.ddp_inodespace,
+ max_precreate = OST_MAX_PRECREATE * ofd->ofd_dt_conf.ddp_inodespace / 2;
+ ofd_grant_connect(env, dev->ld_obd->obd_self_export, max_precreate,
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");
+ obd->obd_uses_nid_stats = 1;
+
entry = lprocfs_register("exports", obd->obd_proc_entry, NULL, NULL);
if (IS_ERR(entry)) {
rc = PTR_ERR(entry);
OBD_ALLOC_PTR(ss->ss_client_seq);
if (ss->ss_client_seq == NULL)
- GOTO(out_free, -ENOMEM);
+ GOTO(out_free, rc = -ENOMEM);
snprintf(name, strlen(obd_name) + 6, "%p-super", obd_name);
rc = seq_client_init(ss->ss_client_seq, NULL, LUSTRE_SEQ_DATA,
return rc;
}
+static struct tgt_opc_slice ofd_common_slice[] = {
+ {
+ .tos_opc_start = UPDATE_OBJ,
+ .tos_opc_end = UPDATE_LAST_OPC,
+ .tos_hs = tgt_out_handlers
+ },
+ {
+ .tos_opc_start = SEQ_FIRST_OPC,
+ .tos_opc_end = SEQ_LAST_OPC,
+ .tos_hs = seq_handlers
+ },
+ {
+ .tos_hs = NULL
+ }
+};
+
static int ofd_init0(const struct lu_env *env, struct ofd_device *m,
struct lu_device_type *ldt, struct lustre_cfg *cfg)
{
m->ofd_grant_ratio =
ofd_grant_ratio_conv(m->ofd_dt_conf.ddp_grant_reserved);
- rc = tgt_init(env, &m->ofd_lut, obd, m->ofd_osd);
+ rc = tgt_init(env, &m->ofd_lut, obd, m->ofd_osd, ofd_common_slice,
+ OBD_FAIL_OST_ALL_REQUEST_NET,
+ OBD_FAIL_OST_ALL_REPLY_NET);
if (rc)
GOTO(err_free_ns, rc);
struct obd_device *obd = ofd_obd(m);
struct lu_device *d = &m->ofd_dt_dev.dd_lu_dev;
+ lfsck_stop(env, m->ofd_osd, true);
+ lfsck_degister(env, m->ofd_osd);
target_recovery_fini(obd);
obd_exports_barrier(obd);
obd_zombie_barrier();