1 /* -*- mode: c; c-basic-offset: 8; indent-tabs-mode: nil; -*-
2 * vim:expandtab:shiftwidth=8:tabstop=8:
4 * Copyright (C) 2001, 2002 Cluster File Systems, Inc.
6 * This file is part of Lustre, http://www.lustre.org.
8 * Lustre is free software; you can redistribute it and/or
9 * modify it under the terms of version 2 of the GNU General Public
10 * License as published by the Free Software Foundation.
12 * Lustre is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
17 * You should have received a copy of the GNU General Public License
18 * along with Lustre; if not, write to the Free Software
19 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
26 #include <linux/autoconf.h>
27 #include <linux/slab.h>
28 #include <linux/kp30.h>
30 /* global variables */
31 extern unsigned long obd_memory;
32 extern unsigned long obd_drop_packet;
35 OBD_INST_MDS_GETATTR = 1,
36 OBD_INST_MDS_READPAGE,
37 OBD_INST_MDS_READPAGE_BULK,
42 OBD_INST_OST_DISCONNECT,
43 OBD_INST_OST_GET_INFO,
54 #define OBD_CHECK_DROP_PACKET(req, id) \
56 if (obd_drop_packet != id) \
59 CDEBUG(D_OTHER, "obd_drop_packet=%d, dropping packet.\n", id); \
63 #define OBD_ALLOC(ptr, size) \
66 (ptr) = kmalloc(s, GFP_KERNEL); \
67 if ((ptr) == NULL) { \
68 CERROR("kernel malloc of %ld bytes failed at " \
69 "%s:%d\n", s, __FILE__, __LINE__); \
71 memset((ptr), 0, s); \
74 CDEBUG(D_MALLOC, "kmalloced: %ld at %x (tot %ld).\n", \
75 s, (int)(ptr), obd_memory); \
78 #define OBD_FREE(ptr, size) \
82 CDEBUG(D_MALLOC, "kfreed: %d at %x (tot %ld).\n", \
83 s, (int)(ptr), obd_memory); \