-/* -*- mode: c; c-basic-offset: 8; indent-tabs-mode: nil; -*-
- * vim:expandtab:shiftwidth=8:tabstop=8:
- *
+/*
* GPL HEADER START
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* GPL HEADER END
*/
/*
- * Copyright 2008 Sun Microsystems, Inc. All rights reserved.
+ * Copyright (c) 2008, 2010, Oracle and/or its affiliates. All rights reserved.
* Use is subject to license terms.
+ *
+ * Copyright (c) 2011, 2012, Intel Corporation.
*/
/*
* This file is part of Lustre, http://www.lustre.org/
osc->oo_oinfo = cconf->u.coc_oinfo;
#ifdef INVARIANT_CHECK
- cfs_mutex_init(&osc->oo_debug_mutex);
+ mutex_init(&osc->oo_debug_mutex);
#endif
- cfs_spin_lock_init(&osc->oo_seatbelt);
+ spin_lock_init(&osc->oo_seatbelt);
for (i = 0; i < CRT_NR; ++i)
CFS_INIT_LIST_HEAD(&osc->oo_inflight[i]);
- return 0;
+
+ CFS_INIT_LIST_HEAD(&osc->oo_ready_item);
+ CFS_INIT_LIST_HEAD(&osc->oo_hp_ready_item);
+ CFS_INIT_LIST_HEAD(&osc->oo_write_item);
+ CFS_INIT_LIST_HEAD(&osc->oo_read_item);
+
+ osc->oo_root.rb_node = NULL;
+ CFS_INIT_LIST_HEAD(&osc->oo_hp_exts);
+ CFS_INIT_LIST_HEAD(&osc->oo_urgent_exts);
+ CFS_INIT_LIST_HEAD(&osc->oo_rpc_exts);
+ CFS_INIT_LIST_HEAD(&osc->oo_reading_exts);
+ cfs_atomic_set(&osc->oo_nr_reads, 0);
+ cfs_atomic_set(&osc->oo_nr_writes, 0);
+ spin_lock_init(&osc->oo_lock);
+
+ cl_object_page_init(lu2cl(obj), sizeof(struct osc_page));
+
+ return 0;
}
static void osc_object_free(const struct lu_env *env, struct lu_object *obj)
{
- struct osc_object *osc = lu2osc(obj);
- int i;
-
- for (i = 0; i < CRT_NR; ++i)
- LASSERT(cfs_list_empty(&osc->oo_inflight[i]));
-
- lu_object_fini(obj);
- OBD_SLAB_FREE_PTR(osc, osc_object_kmem);
+ struct osc_object *osc = lu2osc(obj);
+ int i;
+
+ for (i = 0; i < CRT_NR; ++i)
+ LASSERT(cfs_list_empty(&osc->oo_inflight[i]));
+
+ LASSERT(cfs_list_empty(&osc->oo_ready_item));
+ LASSERT(cfs_list_empty(&osc->oo_hp_ready_item));
+ LASSERT(cfs_list_empty(&osc->oo_write_item));
+ LASSERT(cfs_list_empty(&osc->oo_read_item));
+
+ LASSERT(osc->oo_root.rb_node == NULL);
+ LASSERT(cfs_list_empty(&osc->oo_hp_exts));
+ LASSERT(cfs_list_empty(&osc->oo_urgent_exts));
+ LASSERT(cfs_list_empty(&osc->oo_rpc_exts));
+ LASSERT(cfs_list_empty(&osc->oo_reading_exts));
+ LASSERT(cfs_atomic_read(&osc->oo_nr_reads) == 0);
+ LASSERT(cfs_atomic_read(&osc->oo_nr_writes) == 0);
+
+ lu_object_fini(obj);
+ OBD_SLAB_FREE_PTR(osc, osc_object_kmem);
}
int osc_lvb_print(const struct lu_env *env, void *cookie,
lvb->lvb_ctime = attr->cat_ctime;
if (valid & CAT_BLOCKS)
lvb->lvb_blocks = attr->cat_blocks;
- if (valid & CAT_KMS)
+ if (valid & CAT_KMS) {
+ CDEBUG(D_CACHE, "set kms from "LPU64"to "LPU64"\n",
+ oinfo->loi_kms, (__u64)attr->cat_kms);
loi_kms_set(oinfo, attr->cat_kms);
+ }
return 0;
}