X-Git-Url: https://git.whamcloud.com/?a=blobdiff_plain;f=lustre%2Fosc%2Fosc_object.c;h=8d6eec61c4071a1a77833e00354b4db66991c23a;hb=2b13169cd86b4868730f2c45432645b7d2cc0073;hp=d10a372b1e3248779c567719cdcb555a0d3fc1c6;hpb=419016ac3e53e798453106ec04412a4843620916;p=fs%2Flustre-release.git diff --git a/lustre/osc/osc_object.c b/lustre/osc/osc_object.c index d10a372..8d6eec6 100644 --- a/lustre/osc/osc_object.c +++ b/lustre/osc/osc_object.c @@ -1,6 +1,4 @@ -/* -*- 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. @@ -28,6 +26,8 @@ /* * Copyright (c) 2008, 2010, Oracle and/or its affiliates. All rights reserved. * Use is subject to license terms. + * + * Copyright (c) 2011, 2013, Intel Corporation. */ /* * This file is part of Lustre, http://www.lustre.org/ @@ -77,25 +77,55 @@ static int osc_object_init(const struct lu_env *env, struct lu_object *obj, int i; osc->oo_oinfo = cconf->u.coc_oinfo; -#ifdef INVARIANT_CHECK - cfs_mutex_init(&osc->oo_debug_mutex); +#ifdef CONFIG_LUSTRE_DEBUG_EXPENSIVE_CHECK + 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, @@ -110,18 +140,18 @@ int osc_lvb_print(const struct lu_env *env, void *cookie, static int osc_object_print(const struct lu_env *env, void *cookie, lu_printer_t p, const struct lu_object *obj) { - struct osc_object *osc = lu2osc(obj); - struct lov_oinfo *oinfo = osc->oo_oinfo; - struct osc_async_rc *ar = &oinfo->loi_ar; - - (*p)(env, cookie, "id: "LPU64" gr: "LPU64" " - "idx: %d gen: %d kms_valid: %u kms "LPU64" " - "rc: %d force_sync: %d min_xid: "LPU64" ", - oinfo->loi_id, oinfo->loi_seq, oinfo->loi_ost_idx, - oinfo->loi_ost_gen, oinfo->loi_kms_valid, oinfo->loi_kms, - ar->ar_rc, ar->ar_force_sync, ar->ar_min_xid); - osc_lvb_print(env, cookie, p, &oinfo->loi_lvb); - return 0; + struct osc_object *osc = lu2osc(obj); + struct lov_oinfo *oinfo = osc->oo_oinfo; + struct osc_async_rc *ar = &oinfo->loi_ar; + + (*p)(env, cookie, "id: "DOSTID" " + "idx: %d gen: %d kms_valid: %u kms "LPU64" " + "rc: %d force_sync: %d min_xid: "LPU64" ", + POSTID(&oinfo->loi_oi), oinfo->loi_ost_idx, + oinfo->loi_ost_gen, oinfo->loi_kms_valid, oinfo->loi_kms, + ar->ar_rc, ar->ar_force_sync, ar->ar_min_xid); + osc_lvb_print(env, cookie, p, &oinfo->loi_lvb); + return 0; } @@ -234,7 +264,7 @@ struct lu_object *osc_object_alloc(const struct lu_env *env, struct osc_object *osc; struct lu_object *obj; - OBD_SLAB_ALLOC_PTR_GFP(osc, osc_object_kmem, CFS_ALLOC_IO); + OBD_SLAB_ALLOC_PTR_GFP(osc, osc_object_kmem, __GFP_IO); if (osc != NULL) { obj = osc2lu(osc); lu_object_init(obj, NULL, dev);