# define libcfs_kmem_dec(ptr, size) do {} while (0)
#endif /* LIBCFS_DEBUG */
-#define LIBCFS_VMALLOC_SIZE 16384
+#define LIBCFS_VMALLOC_SIZE (2 << CFS_PAGE_SHIFT) /* 2 pages */
#define LIBCFS_ALLOC_GFP(ptr, size, mask) \
do { \
break; \
} \
libcfs_kmem_inc((ptr), (size)); \
- if (!((mask) & CFS_ALLOC_ZERO)) \
- memset((ptr), 0, (size)); \
+ memset((ptr), 0, (size)); \
CDEBUG(D_MALLOC, "kmalloced '" #ptr "': %d at %p (tot %d).\n", \
(int)(size), (ptr), cfs_atomic_read (&libcfs_kmemory)); \
} while (0)
strcpy(cld->cld_logname, logname);
if (cfg)
cld->cld_cfg = *cfg;
+ cfs_mutex_init(&cld->cld_lock);
cld->cld_cfg.cfg_last_idx = 0;
cld->cld_cfg.cfg_flags = 0;
cld->cld_cfg.cfg_sb = sb;
if (IS_ERR(cld))
RETURN(PTR_ERR(cld));
- cfs_down(&llog_process_lock);
+ cfs_mutex_lock(&cld->cld_lock);
/*
* if cld_stopping is set, it means we didn't start the log thus
* not owning the start ref. this can happen after previous umount:
* calling start_log.
*/
if (unlikely(cld->cld_stopping)) {
- cfs_up(&llog_process_lock);
+ cfs_mutex_unlock(&cld->cld_lock);
/* drop the ref from the find */
config_log_put(cld);
RETURN(rc);
}
cld->cld_stopping = 1;
- cfs_up(&llog_process_lock);
+ cfs_mutex_unlock(&cld->cld_lock);
cfs_spin_lock(&config_list_lock);
cld_sptlrpc = cld->cld_sptlrpc;
sounds like badness. It actually might be fine, as long as
we're not trying to update from the same log
simultaneously (in which case we should use a per-log sem.) */
- cfs_down(&llog_process_lock);
+ cfs_mutex_lock(&cld->cld_lock);
if (cld->cld_stopping) {
- cfs_up(&llog_process_lock);
+ cfs_mutex_unlock(&cld->cld_lock);
RETURN(0);
}
ctxt = llog_get_context(mgc, LLOG_CONFIG_REPL_CTXT);
if (!ctxt) {
CERROR("missing llog context\n");
- cfs_up(&llog_process_lock);
+ cfs_mutex_unlock(&cld->cld_lock);
RETURN(-EINVAL);
}
CDEBUG(D_MGC, "%s: configuration from log '%s' %sed (%d).\n",
mgc->obd_name, cld->cld_logname, rc ? "fail" : "succeed", rc);
- cfs_up(&llog_process_lock);
+ cfs_mutex_unlock(&cld->cld_lock);
RETURN(rc);
}