diff options
author | Christoph Hellwig <hch@sgi.com> | 2005-09-04 18:34:18 -0400 |
---|---|---|
committer | Nathan Scott <nathans@sgi.com> | 2005-09-04 18:34:18 -0400 |
commit | 4df08c52582be558e12316ae60bf077ca8f17a1e (patch) | |
tree | 11d32ac6553e26198ec1be4b830f57c8668d7cca /fs/xfs/linux-2.6/xfs_buf.c | |
parent | 2f926587512869ebf6bc820bd5f030e127aae774 (diff) |
[XFS] Switch kernel thread handling to the kthread_ API
SGI-PV: 942063
SGI-Modid: xfs-linux:xfs-kern:198388a
Signed-off-by: Christoph Hellwig <hch@sgi.com>
Signed-off-by: Nathan Scott <nathans@sgi.com>
Diffstat (limited to 'fs/xfs/linux-2.6/xfs_buf.c')
-rw-r--r-- | fs/xfs/linux-2.6/xfs_buf.c | 24 |
1 files changed, 8 insertions, 16 deletions
diff --git a/fs/xfs/linux-2.6/xfs_buf.c b/fs/xfs/linux-2.6/xfs_buf.c index e6340906342c..655bf4a78afe 100644 --- a/fs/xfs/linux-2.6/xfs_buf.c +++ b/fs/xfs/linux-2.6/xfs_buf.c | |||
@@ -54,6 +54,7 @@ | |||
54 | #include <linux/percpu.h> | 54 | #include <linux/percpu.h> |
55 | #include <linux/blkdev.h> | 55 | #include <linux/blkdev.h> |
56 | #include <linux/hash.h> | 56 | #include <linux/hash.h> |
57 | #include <linux/kthread.h> | ||
57 | 58 | ||
58 | #include "xfs_linux.h" | 59 | #include "xfs_linux.h" |
59 | 60 | ||
@@ -1742,9 +1743,7 @@ pagebuf_runall_queues( | |||
1742 | } | 1743 | } |
1743 | 1744 | ||
1744 | /* Defines for pagebuf daemon */ | 1745 | /* Defines for pagebuf daemon */ |
1745 | STATIC DECLARE_COMPLETION(xfsbufd_done); | ||
1746 | STATIC struct task_struct *xfsbufd_task; | 1746 | STATIC struct task_struct *xfsbufd_task; |
1747 | STATIC int xfsbufd_active; | ||
1748 | STATIC int xfsbufd_force_flush; | 1747 | STATIC int xfsbufd_force_flush; |
1749 | STATIC int xfsbufd_force_sleep; | 1748 | STATIC int xfsbufd_force_sleep; |
1750 | 1749 | ||
@@ -1770,14 +1769,8 @@ xfsbufd( | |||
1770 | xfs_buftarg_t *target; | 1769 | xfs_buftarg_t *target; |
1771 | xfs_buf_t *pb, *n; | 1770 | xfs_buf_t *pb, *n; |
1772 | 1771 | ||
1773 | /* Set up the thread */ | ||
1774 | daemonize("xfsbufd"); | ||
1775 | current->flags |= PF_MEMALLOC; | 1772 | current->flags |= PF_MEMALLOC; |
1776 | 1773 | ||
1777 | xfsbufd_task = current; | ||
1778 | xfsbufd_active = 1; | ||
1779 | barrier(); | ||
1780 | |||
1781 | INIT_LIST_HEAD(&tmp); | 1774 | INIT_LIST_HEAD(&tmp); |
1782 | do { | 1775 | do { |
1783 | if (unlikely(freezing(current))) { | 1776 | if (unlikely(freezing(current))) { |
@@ -1825,9 +1818,9 @@ xfsbufd( | |||
1825 | purge_addresses(); | 1818 | purge_addresses(); |
1826 | 1819 | ||
1827 | xfsbufd_force_flush = 0; | 1820 | xfsbufd_force_flush = 0; |
1828 | } while (xfsbufd_active); | 1821 | } while (!kthread_should_stop()); |
1829 | 1822 | ||
1830 | complete_and_exit(&xfsbufd_done, 0); | 1823 | return 0; |
1831 | } | 1824 | } |
1832 | 1825 | ||
1833 | /* | 1826 | /* |
@@ -1910,9 +1903,11 @@ xfs_buf_daemons_start(void) | |||
1910 | if (!xfsdatad_workqueue) | 1903 | if (!xfsdatad_workqueue) |
1911 | goto out_destroy_xfslogd_workqueue; | 1904 | goto out_destroy_xfslogd_workqueue; |
1912 | 1905 | ||
1913 | error = kernel_thread(xfsbufd, NULL, CLONE_FS|CLONE_FILES); | 1906 | xfsbufd_task = kthread_run(xfsbufd, NULL, "xfsbufd"); |
1914 | if (error < 0) | 1907 | if (IS_ERR(xfsbufd_task)) { |
1908 | error = PTR_ERR(xfsbufd_task); | ||
1915 | goto out_destroy_xfsdatad_workqueue; | 1909 | goto out_destroy_xfsdatad_workqueue; |
1910 | } | ||
1916 | return 0; | 1911 | return 0; |
1917 | 1912 | ||
1918 | out_destroy_xfsdatad_workqueue: | 1913 | out_destroy_xfsdatad_workqueue: |
@@ -1929,10 +1924,7 @@ xfs_buf_daemons_start(void) | |||
1929 | STATIC void | 1924 | STATIC void |
1930 | xfs_buf_daemons_stop(void) | 1925 | xfs_buf_daemons_stop(void) |
1931 | { | 1926 | { |
1932 | xfsbufd_active = 0; | 1927 | kthread_stop(xfsbufd_task); |
1933 | barrier(); | ||
1934 | wait_for_completion(&xfsbufd_done); | ||
1935 | |||
1936 | destroy_workqueue(xfslogd_workqueue); | 1928 | destroy_workqueue(xfslogd_workqueue); |
1937 | destroy_workqueue(xfsdatad_workqueue); | 1929 | destroy_workqueue(xfsdatad_workqueue); |
1938 | } | 1930 | } |