From eddc824a759f14d8363f8f18fd9ff1a316dcd18a Mon Sep 17 00:00:00 2001 From: pschwan Date: Thu, 5 Sep 2002 22:05:00 +0000 Subject: [PATCH] Back out some lprocfs changes to common code until they can be reviewed and commented on --- lustre/include/linux/obd.h | 1 - lustre/ldlm/ldlm_lockd.c | 14 +- lustre/lib/l_lock.c | 96 -------------- lustre/obdclass/Makefile.am | 13 +- lustre/obdclass/class_obd.c | 316 +------------------------------------------- 5 files changed, 5 insertions(+), 435 deletions(-) delete mode 100644 lustre/lib/l_lock.c diff --git a/lustre/include/linux/obd.h b/lustre/include/linux/obd.h index c2ce321..780f4ff 100644 --- a/lustre/include/linux/obd.h +++ b/lustre/include/linux/obd.h @@ -240,7 +240,6 @@ struct obd_device { struct snap_obd snap; #endif } u; - void* counters; }; struct io_cb_data; diff --git a/lustre/ldlm/ldlm_lockd.c b/lustre/ldlm/ldlm_lockd.c index 518415b..81fcb01 100644 --- a/lustre/ldlm/ldlm_lockd.c +++ b/lustre/ldlm/ldlm_lockd.c @@ -546,20 +546,16 @@ static int ldlm_setup(struct obd_device *obddev, obd_count len, void *buf) ENTRY; MOD_INC_USE_COUNT; - /* rc = ldlm_proc_setup(obddev); if (rc != 0) GOTO(out_dec, rc); - */ ldlm->ldlm_service = ptlrpc_init_svc(1024, 640, LDLM_REQUEST_PORTAL, LDLM_REPLY_PORTAL, "self", ldlm_callback_handler, "ldlm"); - /* if (!ldlm->ldlm_service) GOTO(out_proc, rc = -ENOMEM); - */ for (i = 0; i < LDLM_NUM_THREADS; i++) { char name[32]; sprintf(name, "lustre_dlm_%02d", i); @@ -583,21 +579,14 @@ static int ldlm_setup(struct obd_device *obddev, obd_count len, void *buf) ptlrpc_stop_all_threads(ldlm->ldlm_service); ptlrpc_unregister_service(ldlm->ldlm_service); out_proc: - printk("Nop\n"); - /* ldlm_proc_cleanup(obddev); - */ out_dec: MOD_DEC_USE_COUNT; return rc; } - static int ldlm_cleanup(struct obd_device *obddev) - - { - struct ldlm_obd *ldlm = &obddev->u.ldlm; ENTRY; @@ -608,8 +597,7 @@ static int ldlm_cleanup(struct obd_device *obddev) ptlrpc_stop_all_threads(ldlm->ldlm_service); ptlrpc_unregister_service(ldlm->ldlm_service); - - /* ldlm_proc_cleanup(obddev); */ + ldlm_proc_cleanup(obddev); MOD_DEC_USE_COUNT; RETURN(0); diff --git a/lustre/lib/l_lock.c b/lustre/lib/l_lock.c deleted file mode 100644 index db072e0..0000000 --- a/lustre/lib/l_lock.c +++ /dev/null @@ -1,96 +0,0 @@ -/* -*- mode: c; c-basic-offset: 8; indent-tabs-mode: nil; -*- - * vim:expandtab:shiftwidth=8:tabstop=8: - * - * Copyright (C) 2001, 2002 Cluster File Systems, Inc. - * - * This file is part of Lustre, http://www.sf.net/projects/lustre/ - * - * Lustre is free 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. - * - * 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 - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with Lustre; if not, write to the Free Software - * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - * - */ - - - -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include -#include - -#include -#include -#include -#include -#include -#include -#include - -#define DEBUG_SUBSYSTEM S_LDLM - -#include -#include - -/* invariants: - - only the owner of the lock changes l_owner/l_depth - - if a non-owner changes or checks the variables a spin lock is taken -*/ - -void l_lock_init(struct lustre_lock *lock) -{ - sema_init(&lock->l_sem, 1); - spin_lock_init(&lock->l_spin); -} - -void l_lock(struct lustre_lock *lock) -{ - int owner = 0; - spin_lock(&lock->l_spin); - if (lock->l_owner == current) { - owner = 1; - } - spin_unlock(&lock->l_spin); - if (owner) - ++lock->l_depth; - else { - down(&lock->l_sem); - spin_lock(&lock->l_spin); - lock->l_owner = current; - lock->l_depth = 0; - spin_unlock(&lock->l_spin); - } -} - -void l_unlock(struct lustre_lock *lock) -{ - if (lock->l_owner != current) - LBUG(); - if (lock->l_depth < 0) - LBUG(); - - spin_lock(&lock->l_spin); - if (--lock->l_depth < 0) { - lock->l_owner = NULL; - spin_unlock(&lock->l_spin); - up(&lock->l_sem); - return ; - } - spin_unlock(&lock->l_spin); -} diff --git a/lustre/obdclass/Makefile.am b/lustre/obdclass/Makefile.am index f38a01d..322df7d 100644 --- a/lustre/obdclass/Makefile.am +++ b/lustre/obdclass/Makefile.am @@ -2,17 +2,6 @@ DEFS= MODULE = obdclass modulefs_DATA = obdclass.o EXTRA_PROGRAMS = obdclass -LINX=page.c debug.c l_lock.c -obdclass_SOURCES = genops.c proc_lustre.c class_obd.c sysctl.c uuid.c \ - lprocfs.c $(LINX) - -debug.c: - test -e debug.c || ln -sf $(top_srcdir)/lib/debug.c - -page.c: - test -e page.c || ln -sf $(top_srcdir)/lib/page.c - -l_lock.c: - test -e l_lock.c || ln -sf $(top_srcdir)/lib/l_lock.c +obdclass_SOURCES = debug.c genops.c proc_lustre.c class_obd.c sysctl.c uuid.c include $(top_srcdir)/Rules diff --git a/lustre/obdclass/class_obd.c b/lustre/obdclass/class_obd.c index 9020c420..5fe7411 100644 --- a/lustre/obdclass/class_obd.c +++ b/lustre/obdclass/class_obd.c @@ -42,7 +42,6 @@ #include #include #include -#include struct semaphore obd_conf_sem; /* serialize configuration commands */ struct obd_device obd_dev[MAX_OBD_DEVICES]; @@ -56,287 +55,6 @@ char obd_recovery_upcall[128] = "/usr/lib/lustre/ha_assist"; extern struct obd_type *class_nm_to_type(char *nm); -/* - * LProcFS specific data structures. These define the namespace for - * the various device classes. We will need to distribute these - * later, to individual modules (e.g. MDS, MDC etc) - */ - -#ifdef LPROCFS_EXISTS - -/* - * Common OBD namespace for lprocFS (these are used very often) - */ - -char* obd_dir_namespace_1[]= { - "mgmt%", - "mgmt/setup", - "mgmt/cleanup", - "mgmt/connect", - "mgmt/disconnect", - 0 -}; - -lprocfs_vars_t obd_var_namespace_1[]= { - - {"num_ops", lprocfs_longlong_read, lprocfs_longlong_write}, - {"min_time", lprocfs_longlong_read, lprocfs_longlong_write}, - {"max_time", lprocfs_longlong_read, lprocfs_longlong_write}, - {"sum_time", lprocfs_longlong_read, lprocfs_longlong_write}, - {"0", 0, 0} -}; - - -/* - * MDC Spcific namespace for lprocFS - */ - -char* mdc_dir_namespace_1[]= { - "reint", - "getstatus", - "getattr", - "setattr", - "open", - "readpage", - "create", - "unlink", - "link", - "rename", - 0 - -}; - -/* - * Create the MDC groupings - */ - -lprocfs_group_t lprocfs_mdc_namespace[]= { - - {obd_dir_namespace_1, obd_var_namespace_1, e_generic}, - {mdc_dir_namespace_1, obd_var_namespace_1, e_generic}, - {0, 0, 0} -}; - -/* - * MDS Device Groupings - */ - -char* mds_dir_namespace_1[]={ - "getstatus", - "connect", - "disconnect_callback", - "getattr", - "readpage", - "open", - "close", - "create", - "unlink", - "link", - "rename", - "reint%", - "reint/summary", - "reint/setattr", - "reint/create", - "reint/unlink", - "reint/link", - "reint/rename", - "reint/recreate", - 0 -}; - -char* mds_dir_namespace_2[]={ - "mstatfs", - 0 - -}; - - -lprocfs_vars_t mds_var_namespace_2[]={ - {"f_type", read_other, write_other}, - {"f_bsize",read_other, write_other}, - {"f_blocks",read_other, write_other}, - {"f_bfree",read_other, write_other}, - {"f_bavail",read_other, write_other}, - {"uuid",read_string, write_string}, - {"0", 0, 0} -}; - - -lprocfs_group_t lprocfs_mds_namespace[]={ - {obd_dir_namespace_1, obd_var_namespace_1, e_generic}, - {mds_dir_namespace_1, obd_var_namespace_1, e_generic}, - {mds_dir_namespace_2, mds_var_namespace_2, e_specific}, - {0, 0, 0} -}; - -/* - * OSC Namespace - */ - -char* osc_dir_namespace_1[]={ - "create", - "destroy", - "getattr", - "setattr", - "open", - "close", - "brw", - "punch", - "summary", - "cancel", - 0 -}; - -lprocfs_group_t lprocfs_osc_namespace[]={ - {obd_dir_namespace_1, obd_var_namespace_1, e_generic}, - {osc_dir_namespace_1, obd_var_namespace_1, e_generic}, - {0, 0, 0} -}; - - -/* - * OST, LOV, OBD_FILTER namespace - * Note: These namespaces are exactly similar to the osc_dir_namespace - * Hence, I use the osc namespace as the base class and add only - * those attributes that are missing in osc_dir_namespace. - */ - -char* ost_lov_obdfilter_dir_namespace_1[]={ - "getinfo", - 0 - -}; -char* ost_lov_obdfilter_dir_namespace_2[]={ - "ostatfs", - 0 -}; - -lprocfs_vars_t ost_lov_obdfilter_var_namespace_2[]={ - {"f_type", read_other, write_other}, - {"f_bsize",read_other, write_other}, - {"f_blocks",read_other, write_other}, - {"f_bfree",read_other, write_other}, - {"f_bavail",read_other, write_other}, - {"f_objects", read_other, write_other}, - {"f_ofree", read_other, write_other}, - {"f_objectgroups", read_other, write_other}, - {"f_uuid", read_string, write_string}, - {"0", 0, 0} -}; - - -lprocfs_group_t lprocfs_ost_lov_obdfilter_namespace[]={ - {obd_dir_namespace_1, obd_var_namespace_1, e_generic}, - {osc_dir_namespace_1, obd_var_namespace_1, e_generic}, - {ost_lov_obdfilter_dir_namespace_1, obd_var_namespace_1, e_generic}, - {ost_lov_obdfilter_dir_namespace_2, ost_lov_obdfilter_var_namespace_2, e_specific}, - {0, 0, 0} -}; - -/* - * LDLM Device namespace - */ - - -char* ldlm_dir_namespace_1[]={ - "locks%", - "locks/enqueus", - "locks/cancels", - "locks/converts", - "locks/matches", - 0 -}; - - -lprocfs_vars_t ldlm_var_namespace_1[]= { - - {"num_total", lprocfs_longlong_read, lprocfs_longlong_write}, - {"num_zerolatency", lprocfs_longlong_read, lprocfs_longlong_write}, - {"num_zerolatency_inflight", lprocfs_longlong_read, lprocfs_longlong_write}, - {"num_zerolatency_done", lprocfs_longlong_read, lprocfs_longlong_write}, - {"nonzero_mintime", lprocfs_longlong_read, lprocfs_longlong_write}, - {"nonzero_maxtime", lprocfs_longlong_read, lprocfs_longlong_write}, - {"nonzero_sumtime", lprocfs_longlong_read, lprocfs_longlong_write}, - {"0", 0, 0} - -}; - -lprocfs_group_t lprocfs_ldlm_namespace[]={ - {obd_dir_namespace_1, obd_var_namespace_1, e_generic}, - {ldlm_dir_namespace_1, ldlm_var_namespace_1, e_generic}, - {0, 0, 0} -}; - -/* - * Note: Need to add namespace for breaking out locks by device class - */ - -/* - * PTLRPC Namespace - */ -char* ptlrpc_dir_namespace_1[]={ - "counters", - 0 -}; - -lprocfs_vars_t ptlrpc_var_namespace_1[]={ - {"msgs_alloc", lprocfs_longlong_read, lprocfs_longlong_write}, - {"msgs_max", lprocfs_longlong_read, lprocfs_longlong_write}, - {"recv_count", lprocfs_longlong_read, lprocfs_longlong_write}, - {"recv_length", lprocfs_longlong_read, lprocfs_longlong_write}, - {"send_count", lprocfs_longlong_read, lprocfs_longlong_write}, - {"send_length", lprocfs_longlong_read, lprocfs_longlong_write}, - {"portal_kmemory", lprocfs_longlong_read, lprocfs_longlong_write}, - {"0", 0, 0} -}; -char* ptlrpc_dir_namespace_2[] = { - "network", - 0 -}; - -lprocfs_vars_t ptlrpc_var_namespace_2[] = { - {"type", read_string, write_string}, - {"mtu", lprocfs_longlong_read, lprocfs_longlong_write}, - {"rxpackets", lprocfs_longlong_read, lprocfs_longlong_write}, - {"txpackets", lprocfs_longlong_read, lprocfs_longlong_write}, - {"txbytes", lprocfs_longlong_read, lprocfs_longlong_write}, - {"0", 0, 0} -}; - -lprocfs_group_t lprocfs_ptlrpc_namespace[]={ - {obd_dir_namespace_1, obd_var_namespace_1, e_generic}, - {ptlrpc_dir_namespace_1, ptlrpc_var_namespace_1, e_generic}, - {ptlrpc_dir_namespace_2, ptlrpc_var_namespace_2, e_specific}, - {0, 0, 0} -}; - - -/* - * Building the entire device namespace. This will be used during attach and - * detach to associate the namespace with the class of the device - */ - -lprocfs_obd_namespace_t obd_namespace[]={ - {"mdc", lprocfs_mdc_namespace, sizeof(struct lprocfs_profiler_gen)}, - {"mds", lprocfs_mds_namespace, sizeof(struct lprocfs_profiler_gen)}, - {"osc", lprocfs_osc_namespace, sizeof(struct lprocfs_profiler_gen)}, - {"ost", lprocfs_ost_lov_obdfilter_namespace, sizeof(struct lprocfs_profiler_gen)}, - {"lov", lprocfs_ost_lov_obdfilter_namespace, sizeof(struct lprocfs_profiler_gen)}, - {"obdfilter", lprocfs_ost_lov_obdfilter_namespace, sizeof(struct lprocfs_profiler_gen)}, - {"ldlm", lprocfs_ldlm_namespace, sizeof(struct lprocfs_profiler_ldlm)}, - {"ptlrpc", lprocfs_ptlrpc_namespace, sizeof(struct lprocfs_profiler_ptlrpc)}, - {"0", 0, 0} - -}; - -#else - -lprocfs_obd_namespace_t* obd_namespace=0; - -#endif - - - /* opening /dev/obd */ static int obd_class_open(struct inode * inode, struct file * file) { @@ -387,7 +105,6 @@ static int obd_class_ioctl (struct inode * inode, struct file * filp, int rw = OBD_BRW_READ; int err = 0; int serialised = 0; - int obd_lprocfs_index = 0; ENTRY; switch (cmd) @@ -609,10 +326,8 @@ static int obd_class_ioctl (struct inode * inode, struct file * filp, LBUG(); } memcpy(obd->obd_name, data->ioc_inlbuf2, len); - /* obd->obd_proc_entry = + obd->obd_proc_entry = proc_lustre_register_obd_device(obd); - */ - } else { CERROR("WARNING: unnamed obd device\n"); obd->obd_proc_entry = NULL; @@ -629,25 +344,8 @@ static int obd_class_ioctl (struct inode * inode, struct file * filp, GOTO(out, err=-EINVAL); } memcpy(obd->obd_uuid, data->ioc_inlbuf3, len); - - } - /* - * Get the LprocFS namespace for this device class - */ - - obd_lprocfs_index=lprocfs_get_namespace(data->ioc_inlbuf1, \ - obd_namespace); - - if(obd_lprocfs_index<0) { - CERROR("Non-existent device class or proc/lustre not compiled \n"); - - } else { - lprocfs_register_dev(obd, \ - obd_namespace[obd_lprocfs_index].obd_namespace, \ - obd_namespace[obd_lprocfs_index].cntr_blk_size); } MOD_INC_USE_COUNT; - } GOTO(out, err); @@ -670,22 +368,15 @@ static int obd_class_ioctl (struct inode * inode, struct file * filp, GOTO(out, err=-EBUSY); } - if(lprocfs_deregister_dev(obd)!=LPROCFS_SUCCESS){ - CERROR("Could not remove Proc Entry\n"); - GOTO(out, err=-ENODEV); - - } - if (obd->obd_name) { OBD_FREE(obd->obd_name, strlen(obd->obd_name)+1); obd->obd_name = NULL; } - /* + if (obd->obd_proc_entry) proc_lustre_release_obd_device(obd); - */ + obd->obd_flags &= ~OBD_ATTACHED; - obd->obd_type->typ_refcnt--; obd->obd_type = NULL; MOD_DEC_USE_COUNT; @@ -887,7 +578,6 @@ static int obd_class_ioctl (struct inode * inode, struct file * filp, } default: obd_data2conn(&conn, data); - err = obd_iocontrol(cmd, &conn, len, data, NULL); if (err) -- 1.8.3.1