X-Git-Url: https://git.whamcloud.com/?a=blobdiff_plain;f=lustre%2Fosc%2Fosc_object.c;h=bd2e6f415a4e6d4ae530706a3bd6f58ecbfe0346;hb=c419939a60daa4e41279ccb6e486ae785895cda0;hp=775b888b5a659982479c9b6b77e73e489cfff1e0;hpb=b401ba0c214b184424146dda994470aa3c4356c9;p=fs%2Flustre-release.git diff --git a/lustre/osc/osc_object.c b/lustre/osc/osc_object.c index 775b888..bd2e6f4 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. @@ -26,8 +24,10 @@ * 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, Whamcloud, Inc. */ /* * This file is part of Lustre, http://www.lustre.org/ @@ -38,12 +38,14 @@ * Author: Nikita Danilov */ -/** \addtogroup osc osc @{ */ - #define DEBUG_SUBSYSTEM S_OSC #include "osc_cl_internal.h" +/** \addtogroup osc + * @{ + */ + /***************************************************************************** * * Type conversions. @@ -76,24 +78,52 @@ static int osc_object_init(const struct lu_env *env, struct lu_object *obj, osc->oo_oinfo = cconf->u.coc_oinfo; #ifdef INVARIANT_CHECK - mutex_init(&osc->oo_debug_mutex); + mutex_init(&osc->oo_debug_mutex); #endif - 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); + + 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(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, @@ -115,7 +145,7 @@ static int osc_object_print(const struct lu_env *env, void *cookie, (*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_gr, oinfo->loi_ost_idx, + 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); @@ -149,8 +179,11 @@ int osc_attr_set(const struct lu_env *env, struct cl_object *obj, 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; } @@ -223,7 +256,7 @@ static const struct lu_object_operations osc_lu_obj_ops = { }; struct lu_object *osc_object_alloc(const struct lu_env *env, - const struct lu_object_header *_, + const struct lu_object_header *unused, struct lu_device *dev) { struct osc_object *osc;