Whamcloud - gitweb
LU-694 config: make 'jobid_var' global
[fs/lustre-release.git] / lustre / obdclass / llog.c
index 14ed25d..fec344f 100644 (file)
@@ -1,6 +1,4 @@
-/* -*- mode: c; c-basic-offset: 8; indent-tabs-mode: nil; -*-
- * vim:expandtab:shiftwidth=8:tabstop=8:
- *
+/*
  * GPL HEADER START
  *
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -26,7 +24,7 @@
  * GPL HEADER END
  */
 /*
- * Copyright  2008 Sun Microsystems, Inc. All rights reserved
+ * Copyright (c) 2003, 2010, Oracle and/or its affiliates. All rights reserved.
  * Use is subject to license terms.
  */
 /*
@@ -242,7 +240,8 @@ static int llog_process_thread(void *arg)
                 return 0;
         }
 
-        cfs_daemonize_ctxt("llog_process_thread");
+        if (!(lpi->lpi_flags & LLOG_FLAG_NODEAMON))
+                cfs_daemonize_ctxt("llog_process_thread");
 
         if (cd != NULL) {
                 last_called_index = cd->lpcd_first_idx;
@@ -354,8 +353,8 @@ static int llog_process_thread(void *arg)
         return 0;
 }
 
-int llog_process(struct llog_handle *loghandle, llog_cb_t cb,
-                 void *data, void *catdata)
+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;
@@ -370,10 +369,11 @@ int llog_process(struct llog_handle *loghandle, llog_cb_t cb,
         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);
+        rc = cfs_create_thread(llog_process_thread, lpi, CFS_DAEMON_FLAGS);
         if (rc < 0) {
                 CERROR("cannot start thread: %d\n", rc);
                 OBD_FREE_PTR(lpi);
@@ -387,6 +387,13 @@ int llog_process(struct llog_handle *loghandle, llog_cb_t cb,
         OBD_FREE_PTR(lpi);
         RETURN(rc);
 }
+EXPORT_SYMBOL(llog_process_flags);
+
+int llog_process(struct llog_handle *loghandle, llog_cb_t cb,
+                 void *data, void *catdata)
+{
+        return llog_process_flags(loghandle, cb, data, catdata, 0);
+}
 EXPORT_SYMBOL(llog_process);
 
 inline int llog_get_size(struct llog_handle *loghandle)