+#ifdef __KERNEL__
+int llog_cat_process_thread(void *data)
+{
+ struct llog_process_cat_args *args = data;
+ struct llog_ctxt *ctxt = args->lpca_ctxt;
+ struct llog_handle *llh = NULL;
+ llog_cb_t cb = args->lpca_cb;
+ struct llog_logid logid;
+ int rc;
+ ENTRY;
+
+ cfs_daemonize_ctxt("ll_log_process");
+
+ logid = *(struct llog_logid *)(args->lpca_arg);
+ rc = llog_create(ctxt, &llh, &logid, NULL);
+ if (rc) {
+ CERROR("llog_create() failed %d\n", rc);
+ GOTO(out, rc);
+ }
+ rc = llog_init_handle(llh, LLOG_F_IS_CAT, NULL);
+ if (rc) {
+ CERROR("llog_init_handle failed %d\n", rc);
+ GOTO(release_llh, rc);
+ }
+
+ if (cb) {
+ rc = llog_cat_process(llh, cb, NULL, 0, 0);
+ if (rc != LLOG_PROC_BREAK && rc != 0)
+ CERROR("llog_cat_process() failed %d\n", rc);
+ cb(llh, NULL, NULL);
+ } else {
+ CWARN("No callback function for recovery\n");
+ }
+
+ /*
+ * Make sure that all cached data is sent.
+ */
+ llog_sync(ctxt, NULL, 0);
+ GOTO(release_llh, rc);
+release_llh:
+ rc = llog_cat_put(llh);
+ if (rc)
+ CERROR("llog_cat_put() failed %d\n", rc);
+out:
+ llog_ctxt_put(ctxt);
+ OBD_FREE_PTR(args);
+ return rc;
+}
+EXPORT_SYMBOL(llog_cat_process_thread);
+#endif
+