/* 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,
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);
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
#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) { \
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, "\
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 { \
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--;
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;
}
}
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;
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;
}
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;
}
return err;
}
}
-}
+} /* obd_class_ioctl */
/* Driver interface done, utility functions follow */
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;
}
OBD_FREE(type, sizeof(*type));
MOD_DEC_USE_COUNT;
return 0;
-}
+} /* obd_unregister_type */
/* declare character device */
static struct file_operations obd_psdev_fops = {
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;
}
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;
}
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;
}
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;
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];
/* now put the page away */
put_page(page);
}
- iput(inode);
obd_up(&obdfs_i2sbi(inode)->osi_list_mutex);
} /* obdfs_dequeue_reqs */
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;
}
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 */
/* 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;
}
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;
}
obdfs_options(data, &device, &version);
if ( !device ) {
- printk("No device\n");
+ printk(__FUNCTION__ ": no device\n");
MOD_DEC_USE_COUNT;
EXIT;
return NULL;
}
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;
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;
"blocksize", &scratch,
(void *)&blocksize);
if ( err ) {
- printk("Getinfo call to drive failed (blocksize)\n");
+ printk("getinfo call to drive failed (blocksize)\n");
goto ERR;
}
"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;
}
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);
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;
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) */;
}
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); */
ENTRY;
oa = obdo_alloc();
if ( !oa ) {
- printk("obdfs_write_inode: obdo_alloc failed\n");
+ printk(__FUNCTION__ ": obdo_alloc failed\n");
return;
}
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
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;
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;
}
ENTRY;
oa = obdo_alloc();
if ( !oa ) {
- printk("obdfs_notify_change: obdo_alloc failed\n");
+ printk(__FUNCTION__ ": obdo_alloc failed\n");
return -ENOMEM;
}
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
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<sizeof(tmp)) ? bufsize : sizeof(tmp));