From 00102f342959b094f035b618c0b7acf477de35b4 Mon Sep 17 00:00:00 2001 From: pschwan Date: Sun, 24 Feb 2002 06:36:26 +0000 Subject: [PATCH] - Added DEBUG_SUBSYSTEMs - started using CERROR, which goes both to the console and the ringbuffer, instead of printk --- lustre/include/linux/obd_support.h | 2 +- lustre/lib/mds_pack.c | 3 ++- lustre/lib/mds_updates.c | 3 ++- lustre/lib/obd_pack.c | 3 ++- lustre/lib/page.c | 26 ++++++++++++++++++++++++-- lustre/llite/dir.c | 5 ++++- lustre/llite/file.c | 2 ++ lustre/llite/namei.c | 7 +++++-- lustre/llite/rw.c | 2 ++ lustre/llite/super.c | 5 +++-- lustre/llite/symlink.c | 5 +++-- lustre/mdc/mdc_reint.c | 2 ++ lustre/mdc/mdc_request.c | 16 +++++++++------- lustre/mds/handler.c | 10 ++++++---- lustre/mds/mds_reint.c | 9 ++++++--- lustre/obdclass/class_obd.c | 2 ++ lustre/obdclass/genops.c | 4 ++-- lustre/obdclass/proc_lustre.c | 3 ++- lustre/obdclass/sysctl.c | 2 ++ lustre/obdfilter/filter.c | 3 +++ lustre/obdfs/dir.c | 3 +++ lustre/obdfs/file.c | 2 ++ lustre/obdfs/namei.c | 3 +++ lustre/obdfs/rw.c | 2 ++ lustre/obdfs/super.c | 2 ++ lustre/obdfs/symlink.c | 3 +++ lustre/osc/osc_request.c | 2 ++ lustre/ost/ost_handler.c | 10 ++++++---- lustre/ptlrpc/rpc.c | 4 ++-- 29 files changed, 109 insertions(+), 36 deletions(-) diff --git a/lustre/include/linux/obd_support.h b/lustre/include/linux/obd_support.h index 8ffedcf..4707963 100644 --- a/lustre/include/linux/obd_support.h +++ b/lustre/include/linux/obd_support.h @@ -135,7 +135,7 @@ do { \ CDEBUG(D_MALLOC, "kmalloced: %ld at %x (tot %ld).\n", \ (long)(size), (int)(ptr), obd_memory); \ if (ptr == NULL) { \ - printk("kernel malloc failed at %s:%d\n", \ + CERROR("kernel malloc failed at %s:%d\n", \ __FILE__, __LINE__); \ } else { \ memset((ptr), 0, (size)); \ diff --git a/lustre/lib/mds_pack.c b/lustre/lib/mds_pack.c index 0b4e38b..eebafc3 100644 --- a/lustre/lib/mds_pack.c +++ b/lustre/lib/mds_pack.c @@ -44,12 +44,13 @@ #include #include +#define DEBUG_SUBSYSTEM S_MDS + #include #include #include #include - int mds_pack_req(char *name, int namelen, char *tgt, int tgtlen, struct ptlreq_hdr **hdr, struct mds_req **req, int *len, char **buf) diff --git a/lustre/lib/mds_updates.c b/lustre/lib/mds_updates.c index f5e5b7f..3ad5158 100644 --- a/lustre/lib/mds_updates.c +++ b/lustre/lib/mds_updates.c @@ -27,13 +27,14 @@ #include #include +#define DEBUG_SUBSYSTEM S_MDS + #include #include #include #include /* packing of MDS records */ - void mds_create_pack(struct mds_rec_create *rec, struct inode *inode, const char *name, int namelen, __u32 mode, __u64 id, __u32 uid, __u32 gid, __u64 time, const char *tgt, int tgtlen) { char *tmp = (char *)rec + sizeof(*rec); diff --git a/lustre/lib/obd_pack.c b/lustre/lib/obd_pack.c index e787e26..f811437 100644 --- a/lustre/lib/obd_pack.c +++ b/lustre/lib/obd_pack.c @@ -44,13 +44,14 @@ #include #include +#define DEBUG_SUBSYSTEM S_OST + #include #include #include #include #include - int ost_pack_req(char *buf1, int buflen1, char *buf2, int buflen2, struct ptlreq_hdr **hdr, struct ost_req **req, int *len, char **buf) diff --git a/lustre/lib/page.c b/lustre/lib/page.c index 28f9d8b..ed38895 100644 --- a/lustre/lib/page.c +++ b/lustre/lib/page.c @@ -1,3 +1,25 @@ +/* -*- 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 @@ -18,14 +40,14 @@ #include #include +#define DEBUG_SUBSYSTEM S_OST + #include #include #include #include #include - - /* * Remove page from dirty list */ diff --git a/lustre/llite/dir.c b/lustre/llite/dir.c index f83e6c1..83305e8 100644 --- a/lustre/llite/dir.c +++ b/lustre/llite/dir.c @@ -29,9 +29,12 @@ #include #include #include -#include #include #include + +#define DEBUG_SUBSYSTEM S_LLIGHT + +#include #include #include #include diff --git a/lustre/llite/file.c b/lustre/llite/file.c index 9a4ce69..d35a8f7 100644 --- a/lustre/llite/file.c +++ b/lustre/llite/file.c @@ -34,6 +34,8 @@ #include #include +#define DEBUG_SUBSYSTEM S_LLIGHT + #include #include diff --git a/lustre/llite/namei.c b/lustre/llite/namei.c index 9577ce1..39f5809 100644 --- a/lustre/llite/namei.c +++ b/lustre/llite/namei.c @@ -29,6 +29,9 @@ #include #include #include + +#define DEBUG_SUBSYSTEM S_LLIGHT + #include #include extern struct address_space_operations ll_aops; @@ -163,7 +166,7 @@ static struct inode *ll_create_node(struct inode *dir, const char *name, rep->nlink = 1; rep->atime = rep->ctime = rep->mtime = time; rep->mode = mode; - CDEBUG(D_LLIGHT, "-- new_inode: objid %lld, ino %d, mode %o\n", + CDEBUG(D_INODE, "-- new_inode: objid %lld, ino %d, mode %o\n", rep->objid, rep->ino, rep->mode); inode = iget4(dir->i_sb, rep->ino, NULL, rep); @@ -285,7 +288,7 @@ static int ll_create (struct inode * dir, struct dentry * dentry, int mode) } mode = mode | S_IFREG; - CDEBUG(D_LLIGHT, "name %s mode %o\n", dentry->d_name.name, mode); + CDEBUG(D_DENTRY, "name %s mode %o\n", dentry->d_name.name, mode); inode = ll_create_node(dir, dentry->d_name.name, dentry->d_name.len, NULL, 0, mode, oa.o_id); diff --git a/lustre/llite/rw.c b/lustre/llite/rw.c index cc48ec0..e1341a3 100644 --- a/lustre/llite/rw.c +++ b/lustre/llite/rw.c @@ -24,6 +24,8 @@ #include #include +#define DEBUG_SUBSYSTEM S_LLIGHT + #include #include #include diff --git a/lustre/llite/super.c b/lustre/llite/super.c index b3d6e61..0ad90bb 100644 --- a/lustre/llite/super.c +++ b/lustre/llite/super.c @@ -30,6 +30,8 @@ #include #include +#define DEBUG_SUBSYSTEM S_LLIGHT + #include #include #include @@ -201,7 +203,6 @@ static void ll_put_super(struct super_block *sb) extern inline struct obdo * ll_oa_from_inode(struct inode *inode, int valid); static void ll_delete_inode(struct inode *inode) { - if (S_ISREG(inode->i_mode)) { int err; struct obdo *oa; @@ -211,7 +212,7 @@ static void ll_delete_inode(struct inode *inode) } err = obd_destroy(IID(inode), oa); - CDEBUG(D_LLIGHT, "obd destroy of %Ld error %d\n", + CDEBUG(D_INODE, "obd destroy of %Ld error %d\n", oa->o_id, err); obdo_free(oa); } diff --git a/lustre/llite/symlink.c b/lustre/llite/symlink.c index 00f391e..83c41f4 100644 --- a/lustre/llite/symlink.c +++ b/lustre/llite/symlink.c @@ -25,10 +25,11 @@ #include #include #include -#include /* for ENTRY and EXIT only */ -#include +#define DEBUG_SUBSYSTEM S_LLIGHT +#include /* for ENTRY and EXIT only */ +#include static int ll_fast_readlink(struct dentry *dentry, char *buffer, int buflen) { diff --git a/lustre/mdc/mdc_reint.c b/lustre/mdc/mdc_reint.c index 541eaf2..7ac96e2 100644 --- a/lustre/mdc/mdc_reint.c +++ b/lustre/mdc/mdc_reint.c @@ -42,6 +42,8 @@ #include #include +#define DEBUG_SUBSYSTEM S_MDC + #include #include #include diff --git a/lustre/mdc/mdc_request.c b/lustre/mdc/mdc_request.c index 3235088..600e453 100644 --- a/lustre/mdc/mdc_request.c +++ b/lustre/mdc/mdc_request.c @@ -42,6 +42,8 @@ #include #include +#define DEBUG_SUBSYSTEM S_MDC + #include #include #include @@ -77,7 +79,7 @@ struct ptlrpc_request *mds_prep_req(int opcode, int namelen, char *name, printk("llight request: cannot pack request %d\n", rc); return NULL; } - CDEBUG(D_MDC, "--> mds_prep_req: len %d, req %p, tgtlen %d\n", + CDEBUG(0, "--> mds_prep_req: len %d, req %p, tgtlen %d\n", request->rq_reqlen, request->rq_req.mds, request->rq_req.mds->tgtlen); request->rq_reqhdr->opc = opcode; @@ -108,9 +110,9 @@ static int mds_queue_wait(struct ptlrpc_request *req, struct lustre_peer *peer) } init_waitqueue_head(&req->rq_wait_for_rep); - CDEBUG(D_MDC, "-- sleeping\n"); + CDEBUG(0, "-- sleeping\n"); interruptible_sleep_on(&req->rq_wait_for_rep); - CDEBUG(D_MDC, "-- done\n"); + CDEBUG(0, "-- done\n"); rc = mds_unpack_rep(req->rq_repbuf, req->rq_replen, &req->rq_rephdr, &req->rq_rep.mds); @@ -120,7 +122,7 @@ static int mds_queue_wait(struct ptlrpc_request *req, struct lustre_peer *peer) } if ( req->rq_rephdr->status == 0 ) - CDEBUG(D_MDC, "--> buf %p len %d status %d\n", + CDEBUG(0, "--> buf %p len %d status %d\n", req->rq_repbuf, req->rq_replen, req->rq_rephdr->status); @@ -157,7 +159,7 @@ int mdc_getattr(struct lustre_peer *peer, ino_t ino, int type, int valid, goto out; } - CDEBUG(D_MDC, "mode: %o\n", request->rq_rep.mds->mode); + CDEBUG(0, "mode: %o\n", request->rq_rep.mds->mode); if (rep) { *rep = request->rq_rep.mds; @@ -180,7 +182,7 @@ int mdc_readpage(struct lustre_peer *peer, ino_t ino, int type, __u64 offset, niobuf.addr = (__u64) (long) addr; - CDEBUG(D_MDC, "inode: %ld\n", ino); + CDEBUG(D_INODE, "inode: %ld\n", ino); request = mds_prep_req(MDS_READPAGE, 0, NULL, sizeof(struct niobuf), (char *)&niobuf); @@ -204,7 +206,7 @@ int mdc_readpage(struct lustre_peer *peer, ino_t ino, int type, __u64 offset, goto out; } - CDEBUG(D_MDC, "mode: %o\n", request->rq_rep.mds->mode); + CDEBUG(0, "mode: %o\n", request->rq_rep.mds->mode); if (rep) { *rep = request->rq_rep.mds; diff --git a/lustre/mds/handler.c b/lustre/mds/handler.c index ca77a1c..130f805 100644 --- a/lustre/mds/handler.c +++ b/lustre/mds/handler.c @@ -14,7 +14,6 @@ * */ - #define EXPORT_SYMTAB #include @@ -26,6 +25,9 @@ #include #include #include + +#define DEBUG_SUBSYSTEM S_MDS + #include #include #include @@ -53,7 +55,7 @@ static int mds_queue_req(struct ptlrpc_request *req) return -ENOMEM; } - CDEBUG(D_MDS, "---> MDS at %d %p, incoming req %p, srv_req %p\n", + CDEBUG(0, "---> MDS at %d %p, incoming req %p, srv_req %p\n", __LINE__, MDS, req, srv_req); memset(srv_req, 0, sizeof(*req)); @@ -190,7 +192,7 @@ struct dentry *mds_fid2dentry(struct mds_obd *mds, struct ll_fid *fid, if (inode == NULL) return ERR_PTR(-ENOMEM); - CDEBUG(D_MDS, "--> mds_fid2dentry: sb %p\n", inode->i_sb); + CDEBUG(D_DENTRY, "--> mds_fid2dentry: sb %p\n", inode->i_sb); if (is_bad_inode(inode) || (generation && inode->i_generation != generation) @@ -311,7 +313,7 @@ int mds_readpage(struct ptlrpc_request *req) return 0; } - CDEBUG(D_MDS, "ino %ld\n", de->d_inode->i_ino); + CDEBUG(D_INODE, "ino %ld\n", de->d_inode->i_ino); file = dentry_open(de, mnt, O_RDONLY | O_LARGEFILE); /* note: in case of an error, dentry_open puts dentry */ diff --git a/lustre/mds/mds_reint.c b/lustre/mds/mds_reint.c index fc9beaa..7eeed71 100644 --- a/lustre/mds/mds_reint.c +++ b/lustre/mds/mds_reint.c @@ -24,6 +24,9 @@ #include #include #include + +#define DEBUG_SUBSYSTEM S_MDS + #include #include #include @@ -43,7 +46,7 @@ static int mds_reint_setattr(struct mds_update_record *rec, struct ptlrpc_reques return 0; } - CDEBUG(D_MDS, "ino %ld\n", de->d_inode->i_ino); + CDEBUG(D_INODE, "ino %ld\n", de->d_inode->i_ino); /* a _really_ horrible hack to avoid removing the data stored in the block pointers; this data is the object id @@ -99,7 +102,7 @@ static int mds_reint_create(struct mds_update_record *rec, EXIT; return 0; } - CDEBUG(D_MDS, "ino %ld\n", de->d_inode->i_ino); + CDEBUG(D_INODE, "ino %ld\n", de->d_inode->i_ino); dchild = lookup_one_len(rec->ur_name, de, rec->ur_namelen - 1); rc = PTR_ERR(dchild); @@ -180,7 +183,7 @@ static int mds_reint_unlink(struct mds_update_record *rec, EXIT; return 0; } - CDEBUG(D_MDS, "ino %ld\n", de->d_inode->i_ino); + CDEBUG(D_INODE, "ino %ld\n", de->d_inode->i_ino); dchild = lookup_one_len(rec->ur_name, de, rec->ur_namelen - 1); rc = PTR_ERR(dchild); diff --git a/lustre/obdclass/class_obd.c b/lustre/obdclass/class_obd.c index 92d0e7a..70dd8e0 100644 --- a/lustre/obdclass/class_obd.c +++ b/lustre/obdclass/class_obd.c @@ -52,6 +52,8 @@ #include #include +#define DEBUG_SUBSYSTEM S_CLASS + #include #include diff --git a/lustre/obdclass/genops.c b/lustre/obdclass/genops.c index c24089c..9db8901 100644 --- a/lustre/obdclass/genops.c +++ b/lustre/obdclass/genops.c @@ -10,17 +10,17 @@ * */ - #include #include #include #include #include +#define DEBUG_SUBSYSTEM S_CLASS + #include #include - extern struct obd_device obd_dev[MAX_OBD_DEVICES]; kmem_cache_t *obdo_cachep = NULL; diff --git a/lustre/obdclass/proc_lustre.c b/lustre/obdclass/proc_lustre.c index cf68e0d..4ada516 100644 --- a/lustre/obdclass/proc_lustre.c +++ b/lustre/obdclass/proc_lustre.c @@ -42,10 +42,11 @@ #include #include +#define DEBUG_SUBSYSTEM S_CLASS + #include #include - #ifdef CONFIG_PROC_FS extern struct proc_dir_entry proc_root; diff --git a/lustre/obdclass/sysctl.c b/lustre/obdclass/sysctl.c index e080dad..575cc61 100644 --- a/lustre/obdclass/sysctl.c +++ b/lustre/obdclass/sysctl.c @@ -21,6 +21,8 @@ #include #include +#define DEBUG_SUBSYSTEM S_CLASS + #include struct ctl_table_header *obd_table_header = NULL; diff --git a/lustre/obdfilter/filter.c b/lustre/obdfilter/filter.c index 893a10d..4be0175 100644 --- a/lustre/obdfilter/filter.c +++ b/lustre/obdfilter/filter.c @@ -19,6 +19,9 @@ #include #include #include + +#define DEBUG_SUBSYSTEM S_FILTER + #include #include #include diff --git a/lustre/obdfs/dir.c b/lustre/obdfs/dir.c index d72f2e1..760026d 100644 --- a/lustre/obdfs/dir.c +++ b/lustre/obdfs/dir.c @@ -24,6 +24,9 @@ #include #include #include + +#define DEBUG_SUBSYSTEM S_OBDFS + #include #include diff --git a/lustre/obdfs/file.c b/lustre/obdfs/file.c index a652e42..b1bd823 100644 --- a/lustre/obdfs/file.c +++ b/lustre/obdfs/file.c @@ -34,6 +34,8 @@ #include #include +#define DEBUG_SUBSYSTEM S_OBDFS + #include #include diff --git a/lustre/obdfs/namei.c b/lustre/obdfs/namei.c index eb3fb95..a360c3a 100644 --- a/lustre/obdfs/namei.c +++ b/lustre/obdfs/namei.c @@ -30,6 +30,9 @@ #include #include #include + +#define DEBUG_SUBSYSTEM S_OBDFS + #include #include extern struct address_space_operations obdfs_aops; diff --git a/lustre/obdfs/rw.c b/lustre/obdfs/rw.c index 1b4a7ff..5b04775 100644 --- a/lustre/obdfs/rw.c +++ b/lustre/obdfs/rw.c @@ -33,6 +33,8 @@ #include #include +#define DEBUG_SUBSYSTEM S_OBDFS + #include #include #include diff --git a/lustre/obdfs/super.c b/lustre/obdfs/super.c index 9804e61..aa787c2 100644 --- a/lustre/obdfs/super.c +++ b/lustre/obdfs/super.c @@ -32,6 +32,8 @@ #include #include +#define DEBUG_SUBSYSTEM S_OBDFS + #include #include #include diff --git a/lustre/obdfs/symlink.c b/lustre/obdfs/symlink.c index b7adb80..3ae8a4d 100644 --- a/lustre/obdfs/symlink.c +++ b/lustre/obdfs/symlink.c @@ -27,6 +27,9 @@ #include #include #include + +#define DEBUG_SUBSYSTEM S_OBDFS + #include /* for ENTRY and EXIT only */ #include diff --git a/lustre/osc/osc_request.c b/lustre/osc/osc_request.c index e40bb36..b3a305f 100644 --- a/lustre/osc/osc_request.c +++ b/lustre/osc/osc_request.c @@ -35,6 +35,8 @@ #include #include +#define DEBUG_SUBSYSTEM S_OSC + #include #include #include diff --git a/lustre/ost/ost_handler.c b/lustre/ost/ost_handler.c index 6ddc563..f8c1317 100644 --- a/lustre/ost/ost_handler.c +++ b/lustre/ost/ost_handler.c @@ -19,7 +19,6 @@ * */ - #define EXPORT_SYMTAB #include @@ -30,6 +29,9 @@ #include #include #include + +#define DEBUG_SUBSYSTEM S_OST + #include #include #include @@ -55,7 +57,7 @@ static int ost_queue_req(struct obd_device *obddev, struct ptlrpc_request *req) return -ENOMEM; } - CDEBUG(D_OST, "---> OST at %d %p, incoming req %p, srv_req %p\n", + CDEBUG(0, "---> OST at %d %p, incoming req %p, srv_req %p\n", __LINE__, ost, req, srv_req); memset(srv_req, 0, sizeof(*req)); @@ -252,7 +254,7 @@ static int ost_connect(struct ost_obd *ost, struct ptlrpc_request *req) req->rq_rep.ost->result =ost->ost_tgt->obd_type->typ_ops->o_connect(&conn); - CDEBUG(D_OST, "ost_connect: rep buffer %p, id %d\n", req->rq_repbuf, + CDEBUG(0, "ost_connect: rep buffer %p, id %d\n", req->rq_repbuf, conn.oc_id); req->rq_rep.ost->connid = conn.oc_id; EXIT; @@ -397,7 +399,7 @@ int ost_handle(struct obd_device *obddev, struct ptlrpc_request *req) struct ptlreq_hdr *hdr; ENTRY; - CDEBUG(D_OST, "req at %p\n", req); + CDEBUG(0, "req at %p\n", req); hdr = (struct ptlreq_hdr *)req->rq_reqbuf; if (NTOH__u32(hdr->type) != OST_TYPE_REQ) { diff --git a/lustre/ptlrpc/rpc.c b/lustre/ptlrpc/rpc.c index 160c8a1..fe81f46 100644 --- a/lustre/ptlrpc/rpc.c +++ b/lustre/ptlrpc/rpc.c @@ -26,12 +26,12 @@ #include #include +#define DEBUG_SUBSYSTEM S_RPC + #include #include static ptl_handle_eq_t req_eq, bulk_source_eq, bulk_sink_eq; -int obd_debug_level; -int obd_print_entry; /* * 1. Free the request buffer after it has gone out on the wire -- 1.8.3.1