- Added liunx block device headers to sunldi.h
- Made __taskq_dispatch safe for interrupt context where it turns out we
need to be useing it.
- Fixed NULL const/dest bug for kmem slab caches
- Places debug __dprintf debugging messages under a spin_lock_irqsave
so it's safe to use then in interrupt handlers. For debugging only!
git-svn-id: https://outreach.scidac.gov/svn/spl/trunk@64
7e1ea52c-4ff2-0310-8f11-
9dd32ca42a1c
#define _SPL_SUNLDI_H
#include <sys/types.h>
+#include <linux/fs.h>
+#include <linux/genhd.h>
+#include <linux/hdreg.h>
+#include <linux/bio.h>
+
+#define SECTOR_SIZE 512
typedef struct modlinkage {
int ml_rev;
dev_t li_dev;
} *ldi_ident_t;
-typedef struct ldi_handle {
- uint_t lh_type;
- struct ldi_ident *lh_ident;
-} ldi_handle_t;
+typedef struct block_device *ldi_handle_t;
extern int ldi_ident_from_mod(struct modlinkage *modlp, ldi_ident_t *lip);
extern void ldi_ident_release(ldi_ident_t li);
{
char *sfp, *start, *ptr;
struct timeval tv;
+ unsigned long flags;
va_list ap;
start = ptr = spl_debug_buffer;
sfp = strrchr(file, '/');
do_gettimeofday(&tv);
- spin_lock(&spl_debug_lock);
+ /* XXX: This is particularly bad for performance, but we need to
+ * disable irqs here or two __dprintf()'s may deadlock on each
+ * other if one if called from an irq handler. This is yet another
+ * reason why we really, really, need an internal debug log.
+ */
+ spin_lock_irqsave(&spl_debug_lock, flags);
ptr += snprintf(ptr, MAXMSGLEN - 1,
"spl: %lu.%06lu:%d:%u:%s:%d:%s(): ",
tv.tv_sec, tv.tv_usec, current->pid,
va_end(ap);
printk("%s", start);
- spin_unlock(&spl_debug_lock);
+ spin_unlock_irqrestore(&spl_debug_lock, flags);
}
EXPORT_SYMBOL(__dprintf);
kcc = kmem_cache_find_cache_cb(cache);
BUG_ON(!kcc);
- kcc->kcc_constructor(ptr, kcc->kcc_private, (int)flags);
+ if (kcc->kcc_constructor)
+ kcc->kcc_constructor(ptr, kcc->kcc_private, (int)flags);
+
spin_unlock(&kmem_cache_cb_lock);
/* Linux constructor has no return code, silently eat it */
}
BUG_ON(!kcc);
/* Solaris destructor takes no flags, silently eat them */
- kcc->kcc_destructor(ptr, kcc->kcc_private);
+ if (kcc->kcc_destructor)
+ kcc->kcc_destructor(ptr, kcc->kcc_private);
+
spin_unlock(&kmem_cache_cb_lock);
}
taskq_work_wrapper_t *tww;
int rc;
-
- BUG_ON(in_interrupt());
BUG_ON(tq == NULL);
BUG_ON(func == NULL);
- tww = (taskq_work_wrapper_t *)kmalloc(sizeof(*tww), GFP_KERNEL);
+ /* Use GFP_ATOMIC since this may be called in interrupt context */
+ tww = (taskq_work_wrapper_t *)kmalloc(sizeof(*tww), GFP_ATOMIC);
if (!tww)
return (taskqid_t)0;