+ lpi->lpi_rc = rc;
+#ifdef __KERNEL__
+ cfs_complete(&lpi->lpi_completion);
+#endif
+ return 0;
+}
+
+int llog_process_flags(struct llog_handle *loghandle, llog_cb_t cb,
+ void *data, void *catdata, int flags)
+{
+ struct llog_process_info *lpi;
+ int rc;
+ ENTRY;
+
+ OBD_ALLOC_PTR(lpi);
+ if (lpi == NULL) {
+ CERROR("cannot alloc pointer\n");
+ RETURN(-ENOMEM);
+ }
+ lpi->lpi_loghandle = loghandle;
+ lpi->lpi_cb = cb;
+ lpi->lpi_cbdata = data;
+ lpi->lpi_catdata = catdata;
+ lpi->lpi_flags = flags;
+
+#ifdef __KERNEL__
+ cfs_init_completion(&lpi->lpi_completion);
+ rc = cfs_kernel_thread(llog_process_thread, lpi, CLONE_VM | CLONE_FILES);
+ if (rc < 0) {
+ CERROR("cannot start thread: %d\n", rc);
+ OBD_FREE_PTR(lpi);
+ RETURN(rc);
+ }
+ cfs_wait_for_completion(&lpi->lpi_completion);
+#else
+ llog_process_thread(lpi);
+#endif
+ rc = lpi->lpi_rc;
+ OBD_FREE_PTR(lpi);