From b09e7f4d94ef26de03dd56a1a75cca0830288cde Mon Sep 17 00:00:00 2001 From: adilger Date: Wed, 26 Jan 2000 07:47:19 +0000 Subject: [PATCH] obdfs/flushd.c: removed iput() from dequeue routine, as we no longer remove inodes from the list here, but instead let flush_reqs do it, which also does an iput() on the inode. others: clean up for printk() when EXT2_OBD_DEBUG is not set --- lustre/include/linux/obd_ext2.h | 18 ++++++++++-------- lustre/include/linux/obd_raid1.h | 14 -------------- lustre/include/linux/obd_support.h | 30 +++++++++++++++++------------- lustre/obdclass/class_obd.c | 23 ++++++++++++----------- lustre/obdclass/genops.c | 13 +++++++++---- lustre/obdclass/sysctl.c | 2 +- lustre/obdfs/flushd.c | 3 +-- lustre/obdfs/rw.c | 8 +++++--- lustre/obdfs/super.c | 38 +++++++++++++++++++------------------- 9 files changed, 74 insertions(+), 75 deletions(-) diff --git a/lustre/include/linux/obd_ext2.h b/lustre/include/linux/obd_ext2.h index e78660a..4ced671 100644 --- a/lustre/include/linux/obd_ext2.h +++ b/lustre/include/linux/obd_ext2.h @@ -48,18 +48,20 @@ inline long ext2_block_map (struct inode * inode, long block); /* super.c */ -#define ext2_warning obd_warning -#undef ext2_error -#define ext2_error obd_warning -#define ext2_panic obd_warning -#ifdef EXT2FS_DEBUG +#ifdef EXT2_OBD_DEBUG # undef ext2_debug # define ext2_debug(format, a...) CDEBUG(D_EXT2, format, ## a) +# define ext2_error ext2_warning +# define ext2_panic ext2_warning +# define ext2_warning(sb, func, format, a...) CDEBUG(D_WARNING, format, ## a) +#else +# undef ext2_debug +# define ext2_debug(format, a...) {} +# define ext2_error(sb, func, format, a...) printk(KERN_ERR "%s: " format, func, ## a); +# define ext2_panic(sb, func, format, a...) printk(KERN_CRIT "%s: " format, func, ## a); +# define ext2_warning(sb, func, format, a...) printk(KERN_WARNING "%s: " format, func, ## a); #endif -#define obd_error obd_warning -#define obd_panic obd_warning -#define obd_warning(sb, func, format, a...) CDEBUG(D_WARNING, format, ## a) int obd_remount (struct super_block * sb, int * flags, char * data); struct super_block * ext2_read_super (struct super_block * sb, void * data, diff --git a/lustre/include/linux/obd_raid1.h b/lustre/include/linux/obd_raid1.h index cebe311..469f209 100644 --- a/lustre/include/linux/obd_raid1.h +++ b/lustre/include/linux/obd_raid1.h @@ -63,20 +63,6 @@ struct buffer_head * obd_getblk (struct inode * inode, long block, int create, int * err); -/* super.c */ -#define ext2_warning obd_warning -#undef ext2_error -#define ext2_error obd_warning -#define ext2_panic obd_warning -#ifdef EXT2FS_DEBUG -# undef ext2_debug -# define ext2_debug(format, a...) CDEBUG(D_EXT2, format, ## a) -#endif - -#define obd_error obd_warning -#define obd_panic obd_warning -#define obd_warning(sb, func, format, a...) CDEBUG(D_WARNING, format, ## a) - int obd_remount (struct super_block * sb, int * flags, char * data); struct super_block * ext2_read_super (struct super_block * sb, void * data, int silent); diff --git a/lustre/include/linux/obd_support.h b/lustre/include/linux/obd_support.h index 68778af..ca9118a 100644 --- a/lustre/include/linux/obd_support.h +++ b/lustre/include/linux/obd_support.h @@ -17,6 +17,9 @@ extern int obd_debug_level; extern int obd_print_entry; +#define CMD(cmd) (( cmd == READ ) ? "read" : "write") + +#ifdef EXT2_OBD_DEBUG /* debugging masks */ #define D_PSDEV 1 /* debug information from psdev.c */ #define D_INODE 2 @@ -30,9 +33,8 @@ extern int obd_print_entry; #define D_INFO 512 /* general information, especially from interface.c */ #define D_IOCTL 1024 /* ioctl related information */ #define D_BLOCKS 2048 /* ext2 block allocation */ -#define D_RPC 4096 /* ext2 block allocation */ +#define D_RPC 4096 /* rpc communications */ -#ifdef EXT2_OBD_DEBUG #define CDEBUG(mask, format, a...) \ do { \ if (obd_debug_level & mask) { \ @@ -48,17 +50,6 @@ extern int obd_print_entry; if (obd_print_entry) \ printk("Process %d leaving %s [%d]\n", current->pid, __FUNCTION__, __LINE__) -#else /* EXT2_OBD_DEBUG */ - -# define CDEBUG ; -# define ENTRY ; -# define EXIT ; - -#endif /* EXT2_OBD_DEBUG */ - - -#define CMD(cmd) (( cmd == READ ) ? "read" : "write") - /* Inode common information printed out (used by obdfs and ext2obd inodes) */ #define ICDEBUG(inode) { \ printk("]]%s line %d[[ ino %ld, atm %ld, mtm %ld, ctm %ld, "\ @@ -114,6 +105,19 @@ extern int obd_print_entry; CDEBUG(D_IOCTL, "** %s, no page\n", __FUNCTION__);\ } +#else /* EXT2_OBD_DEBUG */ + +#define CDEBUG(mask, format, a...) {} +#define ENTRY {} +#define EXIT {} +#define ODEBUG(obdo) {} +#define EXDEBUG(inode) {} +#define OIDEBUG(inode) {} +#define PDEBUG(page, cmd) {} + +#endif /* EXT2_OBD_DEBUG */ + + #define OBD_ALLOC(ptr, cast, size) \ do { \ diff --git a/lustre/obdclass/class_obd.c b/lustre/obdclass/class_obd.c index 87d4b523..ec8beca 100644 --- a/lustre/obdclass/class_obd.c +++ b/lustre/obdclass/class_obd.c @@ -95,7 +95,7 @@ static int obd_class_release(struct inode * inode, struct file * file) return -ENODEV; fsync_dev(inode->i_rdev); if (obd_dev[dev].obd_refcnt <= 0) - printk(KERN_ALERT "presto_psdev_release: refcount(%d) <= 0\n", + printk(KERN_ALERT __FUNCTION__ ": refcount(%d) <= 0\n", obd_dev[dev].obd_refcnt); obd_dev[dev].obd_refcnt--; @@ -206,7 +206,8 @@ static int obd_class_ioctl (struct inode * inode, struct file * filp, type = obd_nm_to_type(input->att_type); OBD_FREE(input->att_type, input->att_typelen + 1); if ( !type ) { - printk("Unknown obd type dev %d\n", dev); + printk(__FUNCTION__ ": unknown obd type dev %d\n", + dev); EXIT; return -EINVAL; } @@ -358,7 +359,7 @@ static int obd_class_ioctl (struct inode * inode, struct file * filp, } if ( !obddev->obd_type->typ_refcnt ) { - printk("OBD_CLEANUP: Dev %d has refcount (%d)!\n", + CDEBUG(D_IOCTL, "dev %d has refcount (%d)!\n", dev, obddev->obd_type->typ_refcnt); EXIT; return -EBUSY; @@ -366,7 +367,7 @@ static int obd_class_ioctl (struct inode * inode, struct file * filp, if ( (!(obddev->obd_flags & OBD_SET_UP)) || (!(obddev->obd_flags & OBD_ATTACHED))) { - CDEBUG(D_IOCTL, "Device not attached or set up\n"); + CDEBUG(D_IOCTL, "device not attached or set up\n"); EXIT; return -ENODEV; } @@ -755,7 +756,7 @@ static int obd_class_ioctl (struct inode * inode, struct file * filp, type = obd_nm_to_type(input.att_type); OBD_FREE(input.att_type, input.att_typelen + 1); if ( !type ) { - printk("Unknown obd type dev %d\n", dev); + printk(__FUNCTION__ ": unknown obd type dev %d\n", dev); EXIT; return -EINVAL; } @@ -785,7 +786,7 @@ static int obd_class_ioctl (struct inode * inode, struct file * filp, return err; } } -} +} /* obd_class_ioctl */ /* Driver interface done, utility functions follow */ @@ -826,15 +827,15 @@ int obd_unregister_type(char *nm) if ( !type ) { MOD_DEC_USE_COUNT; - printk("Unknown obd type\n"); + printk(KERN_INFO __FUNCTION__ ": unknown obd type\n"); EXIT; return -EINVAL; } if ( type->typ_refcnt ) { MOD_DEC_USE_COUNT; - printk("OBD: Type %s has refcount (%d)\n", nm, - type->typ_refcnt); + printk(KERN_ALERT __FUNCTION__ ":type %s has refcount " + "(%d)\n", nm, type->typ_refcnt); EXIT; return -EBUSY; } @@ -843,7 +844,7 @@ int obd_unregister_type(char *nm) OBD_FREE(type, sizeof(*type)); MOD_DEC_USE_COUNT; return 0; -} +} /* obd_unregister_type */ /* declare character device */ static struct file_operations obd_psdev_fops = { @@ -878,7 +879,7 @@ int init_obd(void) if (register_chrdev(OBD_PSDEV_MAJOR,"obd_psdev", &obd_psdev_fops)) { - printk(KERN_ERR "obd_psdev: unable to get major %d\n", + printk(KERN_ERR __FUNCTION__ ": unable to get major %d\n", OBD_PSDEV_MAJOR); return -EIO; } diff --git a/lustre/obdclass/genops.c b/lustre/obdclass/genops.c index c6e7dfd..0564a79 100644 --- a/lustre/obdclass/genops.c +++ b/lustre/obdclass/genops.c @@ -62,10 +62,13 @@ void obd_cleanup_obdo_cache(void) if (obdo_cachep != NULL) { CDEBUG(D_INODE, "destroying obdo_cache at %p\n", obdo_cachep); if (kmem_cache_destroy(obdo_cachep)) - printk(KERN_INFO "obd_cleanup_obdo_cache: unable to free all of cache\n"); + printk(KERN_WARNING __FUNCTION__ + ": unable to free cache\n"); } else - printk(KERN_INFO "obd_cleanup_obdo_cache: called with NULL cache pointer\n"); + printk(KERN_INFO __FUNCTION__ + ": called with NULL cache pointer\n"); + obdo_cachep = NULL; EXIT; } @@ -96,7 +99,7 @@ int gen_connect (struct obd_conn *conn) OBD_ALLOC(cli, struct obd_client *, sizeof(struct obd_client)); if ( !cli ) { - printk("obd_connect (minor %d): no memory!\n", + printk(__FUNCTION__ ": no memory! (minor %d)\n", conn->oc_dev->obd_minor); return -ENOMEM; } @@ -194,7 +197,9 @@ int gen_multi_cleanup(struct obd_device *obddev) rc = OBP(ch_conn->oc_dev, disconnect)(ch_conn); if ( rc != 0 ) { - printk("OBD multi cleanup dev: disconnect failure %d\n", ch_conn->oc_dev->obd_minor); + printk(KERN_WARNING __FUNCTION__ + ": disconnect failure %d\n", + ch_conn->oc_dev->obd_minor); } } return 0; diff --git a/lustre/obdclass/sysctl.c b/lustre/obdclass/sysctl.c index 2b67744..080dc1b 100644 --- a/lustre/obdclass/sysctl.c +++ b/lustre/obdclass/sysctl.c @@ -96,7 +96,7 @@ int obd_sctl_vars (ctl_table * table, int write, return rc; if ( index < 0 || index > 1 ) { - printk("Index illegal!\n"); + printk(KERN_WARNING __FUNCTION__ "Illegal index %d!\n", index); index = 0; } else { obd_table[OBD_VARS_SLOT].data = &vars[index]; diff --git a/lustre/obdfs/flushd.c b/lustre/obdfs/flushd.c index af7341e..ba1c1cb 100644 --- a/lustre/obdfs/flushd.c +++ b/lustre/obdfs/flushd.c @@ -141,7 +141,6 @@ void obdfs_dequeue_reqs(struct inode *inode) /* now put the page away */ put_page(page); } - iput(inode); obd_up(&obdfs_i2sbi(inode)->osi_list_mutex); } /* obdfs_dequeue_reqs */ @@ -376,7 +375,7 @@ int obdfs_flushd_init(void) kernel_thread(bdflush, NULL, CLONE_FS | CLONE_FILES | CLONE_SIGHAND); */ kernel_thread(pupdate, NULL, 0); - printk("flushd inited\n"); + CDEBUG(D_PSDEV, __FUNCTION__ ": flushd inited\n"); return 0; } diff --git a/lustre/obdfs/rw.c b/lustre/obdfs/rw.c index 9bcc915..91f270f 100644 --- a/lustre/obdfs/rw.c +++ b/lustre/obdfs/rw.c @@ -129,9 +129,11 @@ void obdfs_cleanup_pgrqcache(void) CDEBUG(D_INODE, "destroying obdfs_pgrqcache at %p, count %d\n", obdfs_pgrq_cachep, obdfs_cache_count); if (kmem_cache_destroy(obdfs_pgrq_cachep)) - printk(KERN_INFO "obd_cleanup_pgrqcache: unable to free all of cache\n"); + printk(KERN_INFO __FUNCTION__ + ": unable to free all of cache\n"); + obdfs_pgrq_cachep = NULL; } else - printk(KERN_INFO "obd_cleanup_pgrqcache: called with NULL cache pointer\n"); + printk(KERN_INFO __FUNCTION__ ": called with NULL pointer\n"); EXIT; } /* obdfs_cleanup_wreqcache */ @@ -403,7 +405,7 @@ struct page *obdfs_getpage(struct inode *inode, unsigned long offset, /* Yuck, no page */ if (! page) { - printk("grab_cache_page says no dice ...\n"); + printk(KERN_WARNING " grab_cache_page says no dice ...\n"); EXIT; return 0; } diff --git a/lustre/obdfs/super.c b/lustre/obdfs/super.c index 2a79a4e..2358705 100644 --- a/lustre/obdfs/super.c +++ b/lustre/obdfs/super.c @@ -72,7 +72,7 @@ static char *obdfs_read_opt(const char *opt, char *data) value++; OBD_ALLOC(retval, char *, strlen(value) + 1); if ( !retval ) { - printk("OBDFS: Out of memory!\n"); + printk(KERN_ALERT __FUNCTION__ ": out of memory!\n"); return NULL; } @@ -147,7 +147,7 @@ static struct super_block * obdfs_read_super(struct super_block *sb, obdfs_options(data, &device, &version); if ( !device ) { - printk("No device\n"); + printk(__FUNCTION__ ": no device\n"); MOD_DEC_USE_COUNT; EXIT; return NULL; @@ -161,14 +161,15 @@ static struct super_block * obdfs_read_super(struct super_block *sb, } if ( MAJOR(devno) != OBD_PSDEV_MAJOR ) { - printk("Wrong major number!\n"); + printk(__FUNCTION__ ": wrong major number %d!\n", MAJOR(devno)); MOD_DEC_USE_COUNT; EXIT; return NULL; } if ( MINOR(devno) >= MAX_OBD_DEVICES ) { - printk("Minor of %s too high (%d)\n", device, MINOR(devno)); + printk(__FUNCTION__ ": minor of %s too high (%d)\n", + device, MINOR(devno)); MOD_DEC_USE_COUNT; EXIT; return NULL; @@ -178,7 +179,7 @@ static struct super_block * obdfs_read_super(struct super_block *sb, if ( ! (obddev->obd_flags & OBD_ATTACHED) || ! (obddev->obd_flags & OBD_SET_UP) ){ - printk("Device %s not attached or not set up (%d)\n", + printk("device %s not attached or not set up (%d)\n", device, MINOR(devno)); MOD_DEC_USE_COUNT; EXIT; @@ -205,7 +206,7 @@ static struct super_block * obdfs_read_super(struct super_block *sb, "blocksize", &scratch, (void *)&blocksize); if ( err ) { - printk("Getinfo call to drive failed (blocksize)\n"); + printk("getinfo call to drive failed (blocksize)\n"); goto ERR; } @@ -213,14 +214,14 @@ static struct super_block * obdfs_read_super(struct super_block *sb, "blocksize_bits", &scratch, (void *)&blocksize_bits); if ( err ) { - printk("Getinfo call to drive failed (blocksize_bits)\n"); + printk("getinfo call to drive failed (blocksize_bits)\n"); goto ERR; } err = sbi->osi_ops->o_get_info(&sbi->osi_conn, strlen("root_ino"), "root_ino", &scratch, (void *)&root_ino); if ( err ) { - printk("Getinfo call to drive failed (root_ino)\n"); + printk("getinfo call to drive failed (root_ino)\n"); goto ERR; } @@ -243,7 +244,7 @@ static struct super_block * obdfs_read_super(struct super_block *sb, goto ERR; } - printk("obdfs_read_super: sbdev %d, rootino: %ld, dev %s, " + CDEBUG(D_SUPER, "obdfs_read_super: sbdev %d, rootino: %ld, dev %s, " "minor: %d, blocksize: %ld, blocksize bits %ld\n", sb->s_dev, root->i_ino, device, MINOR(devno), blocksize, blocksize_bits); @@ -281,7 +282,7 @@ static void obdfs_put_super(struct super_block *sb) list_del(&sbi->osi_list); memset(sbi, 0, sizeof(*sbi)); - printk("OBDFS: Bye bye.\n"); + printk(KERN_INFO "OBDFS: Bye bye.\n"); MOD_DEC_USE_COUNT; EXIT; @@ -297,7 +298,7 @@ void obdfs_read_inode(struct inode *inode) oa = obdo_fromid(IID(inode), inode->i_ino, OBD_MD_FLNOTOBD | OBD_MD_FLBLOCKS); if ( IS_ERR(oa) ) { - printk("obdfs_read_inode: obdo_fromid failed\n"); + printk(__FUNCTION__ ": obdo_fromid failed\n"); EXIT; return /* PTR_ERR(oa) */; } @@ -307,7 +308,6 @@ void obdfs_read_inode(struct inode *inode) INIT_LIST_HEAD(obdfs_iplist(inode)); /* list of dirty pages on inode */ INIT_LIST_HEAD(obdfs_islist(inode)); /* list of inodes in superblock */ - obdo_free(oa); /* OIDEBUG(inode); */ @@ -337,7 +337,7 @@ static void obdfs_write_inode(struct inode *inode) ENTRY; oa = obdo_alloc(); if ( !oa ) { - printk("obdfs_write_inode: obdo_alloc failed\n"); + printk(__FUNCTION__ ": obdo_alloc failed\n"); return; } @@ -346,7 +346,7 @@ static void obdfs_write_inode(struct inode *inode) err = IOPS(inode, setattr)(IID(inode), oa); if ( err ) { - printk("obdfs_write_inode: obd_setattr fails (%d)\n", err); + printk(__FUNCTION__ ": obd_setattr fails (%d)\n", err); EXIT; } else { /* Copy back attributes from oa, as there may have been @@ -369,7 +369,7 @@ static void obdfs_delete_inode(struct inode *inode) oa = obdo_alloc(); if ( !oa ) { - printk("obdfs_delete_inode: obdo_alloc failed\n"); + printk(__FUNCTION__ ": obdo_alloc failed\n"); return; } oa->o_valid = OBD_MD_FLNOTOBD; @@ -382,7 +382,7 @@ static void obdfs_delete_inode(struct inode *inode) obdo_free(oa); if (err) { - printk("obdfs_delete_node: obd_destroy fails (%d)\n", err); + printk(__FUNCTION__ ": obd_destroy fails (%d)\n", err); EXIT; return; } @@ -400,7 +400,7 @@ static int obdfs_notify_change(struct dentry *de, struct iattr *attr) ENTRY; oa = obdo_alloc(); if ( !oa ) { - printk("obdfs_notify_change: obdo_alloc failed\n"); + printk(__FUNCTION__ ": obdo_alloc failed\n"); return -ENOMEM; } @@ -409,7 +409,7 @@ static int obdfs_notify_change(struct dentry *de, struct iattr *attr) err = IOPS(inode, setattr)(IID(inode), oa); if ( err ) { - printk("obdfs_notify_change: obd_setattr fails (%d)\n", err); + printk(__FUNCTION__ ": obd_setattr fails (%d)\n", err); EXIT; } else { /* Copy back attributes from oa, as there may have been @@ -435,7 +435,7 @@ static int obdfs_statfs(struct super_block *sb, struct statfs *buf, err = OPS(sb,statfs)(ID(sb), &tmp); if ( err ) { - printk("obdfs_notify_change: obd_statfs fails (%d)\n", err); + printk(__FUNCTION__ ": obd_statfs fails (%d)\n", err); return err; } copy_to_user(buf, &tmp, (bufsize