X-Git-Url: https://git.whamcloud.com/?a=blobdiff_plain;f=lustre%2Fobdclass%2Flu_time.c;h=26513cf8bacc477d048dba44ae9462e61377c70c;hb=9149bb4051b7d33e7e416d3178fc4fc18fef0826;hp=e51b7afbc1ef028f572893e7a8a00d6ed6f0185e;hpb=d2d56f38da01001c92a09afc6b52b5acbd9bc13c;p=fs%2Flustre-release.git diff --git a/lustre/obdclass/lu_time.c b/lustre/obdclass/lu_time.c index e51b7af..26513cf 100644 --- a/lustre/obdclass/lu_time.c +++ b/lustre/obdclass/lu_time.c @@ -1,31 +1,45 @@ /* -*- mode: c; c-basic-offset: 8; indent-tabs-mode: nil; -*- * vim:expandtab:shiftwidth=8:tabstop=8: * - * Lustre Time Tracking. + * GPL HEADER START + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright (C) 2006 Cluster File Systems, Inc. - * Author: Nikita Danilov + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 only, + * as published by the Free Software Foundation. * - * This file is part of the Lustre file system, http://www.lustre.org - * Lustre is a trademark of Cluster File Systems, Inc. + * This program is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License version 2 for more details (a copy is included + * in the LICENSE file that accompanied this code). * - * You may have signed or agreed to another license before downloading - * this software. If so, you are bound by the terms and conditions - * of that agreement, and the following does not apply to you. See the - * LICENSE file included with this distribution for more information. + * You should have received a copy of the GNU General Public License + * version 2 along with this program; If not, see + * http://www.sun.com/software/products/lustre/docs/GPLv2.pdf * - * If you did not agree to a different license, then this copy of Lustre - * is open source software; you can redistribute it and/or modify it - * under the terms of version 2 of the GNU General Public License as - * published by the Free Software Foundation. + * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, + * CA 95054 USA or visit www.sun.com if you need additional information or + * have any questions. + * + * GPL HEADER END + */ +/* + * Copyright 2008 Sun Microsystems, Inc. All rights reserved + * Use is subject to license terms. + */ +/* + * This file is part of Lustre, http://www.lustre.org/ + * Lustre is a trademark of Sun Microsystems, Inc. * - * In either case, Lustre is distributed in the hope that it will be - * useful, but WITHOUT ANY WARRANTY; without even the implied warranty - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * license text for more details. + * lustre/obdclass/lu_time.c * + * Lustre Time Tracking. * These are the only exported functions, they provide some generic - * infrastructure for managing object devices + * infrastructure for managing object devices. + * + * Author: Nikita Danilov */ #define DEBUG_SUBSYSTEM S_CLASS @@ -33,6 +47,7 @@ # define EXPORT_SYMTAB #endif +#include /* OBD_{ALLOC,FREE}_PTR() */ #include #include @@ -48,23 +63,8 @@ struct lu_time_data { unsigned long long ltd_timestamp[LU_TIME_DEPTH_MAX]; }; -static void *lu_time_key_init(const struct lu_context *ctx, - struct lu_context_key *key) -{ - struct lu_time_data *value; - - OBD_ALLOC_PTR(value); - if (value == NULL) - value = ERR_PTR(-ENOMEM); - return value; -} - -static void lu_time_key_fini(const struct lu_context *ctx, - struct lu_context_key *key, void *data) -{ - struct lu_time_data *value = data; - OBD_FREE_PTR(value); -} +/* context key constructor/destructor: lu_time_key_init, lu_time_key_fini */ +LU_KEY_INIT_FINI(lu_time, struct lu_time_data); void lu_time_key_exit(const struct lu_context *ctx, struct lu_context_key *key, void *data) @@ -108,7 +108,7 @@ int lu_time_named_init(struct lprocfs_stats **stats, const char *name, if (nr == 0) RETURN(0); - *stats = lprocfs_alloc_stats(nr); + *stats = lprocfs_alloc_stats(nr, 0); if (*stats != NULL) { result = lprocfs_register_stats(entry, name, *stats); if (result == 0) { @@ -161,13 +161,12 @@ unsigned long long lu_time_stamp_get(void) /* * Return timestamp with microsecond precision. This has to be cheap. */ -//#ifdef CONFIG_X86 +//#ifdef CONFIG_X86 #if defined(CONFIG_X86) && !defined(CONFIG_X86_64) /* * do_gettimeofday() goes backwards sometimes :(. Usethe TSC */ unsigned long long ret; - extern unsigned long cpu_khz; rdtscll(ret); do_div(ret, cpu_khz / 1000);