diff options
author | Mark Brown <broonie@opensource.wolfsonmicro.com> | 2011-04-18 12:12:14 -0400 |
---|---|---|
committer | Mark Brown <broonie@opensource.wolfsonmicro.com> | 2011-04-18 12:12:14 -0400 |
commit | fac56c2df51bc29b07b3c2dcfabf32a015a0522c (patch) | |
tree | 1ff5d84ecf4ea0bcbd42e2ef9624b5ade3810890 /fs/xfs/linux-2.6/xfs_super.c | |
parent | 6caa15d0b84d2ea688fd31f4f172c8353463e109 (diff) | |
parent | a6360dd37e1a144ed11e6548371bade559a1e4df (diff) |
Merge commit 'v2.6.39-rc3' into for-2.6.39
Diffstat (limited to 'fs/xfs/linux-2.6/xfs_super.c')
-rw-r--r-- | fs/xfs/linux-2.6/xfs_super.c | 129 |
1 files changed, 45 insertions, 84 deletions
diff --git a/fs/xfs/linux-2.6/xfs_super.c b/fs/xfs/linux-2.6/xfs_super.c index 1ba5c451da36..b38e58d02299 100644 --- a/fs/xfs/linux-2.6/xfs_super.c +++ b/fs/xfs/linux-2.6/xfs_super.c | |||
@@ -816,75 +816,6 @@ xfs_setup_devices( | |||
816 | return 0; | 816 | return 0; |
817 | } | 817 | } |
818 | 818 | ||
819 | /* | ||
820 | * XFS AIL push thread support | ||
821 | */ | ||
822 | void | ||
823 | xfsaild_wakeup( | ||
824 | struct xfs_ail *ailp, | ||
825 | xfs_lsn_t threshold_lsn) | ||
826 | { | ||
827 | /* only ever move the target forwards */ | ||
828 | if (XFS_LSN_CMP(threshold_lsn, ailp->xa_target) > 0) { | ||
829 | ailp->xa_target = threshold_lsn; | ||
830 | wake_up_process(ailp->xa_task); | ||
831 | } | ||
832 | } | ||
833 | |||
834 | STATIC int | ||
835 | xfsaild( | ||
836 | void *data) | ||
837 | { | ||
838 | struct xfs_ail *ailp = data; | ||
839 | xfs_lsn_t last_pushed_lsn = 0; | ||
840 | long tout = 0; /* milliseconds */ | ||
841 | |||
842 | while (!kthread_should_stop()) { | ||
843 | /* | ||
844 | * for short sleeps indicating congestion, don't allow us to | ||
845 | * get woken early. Otherwise all we do is bang on the AIL lock | ||
846 | * without making progress. | ||
847 | */ | ||
848 | if (tout && tout <= 20) | ||
849 | __set_current_state(TASK_KILLABLE); | ||
850 | else | ||
851 | __set_current_state(TASK_INTERRUPTIBLE); | ||
852 | schedule_timeout(tout ? | ||
853 | msecs_to_jiffies(tout) : MAX_SCHEDULE_TIMEOUT); | ||
854 | |||
855 | /* swsusp */ | ||
856 | try_to_freeze(); | ||
857 | |||
858 | ASSERT(ailp->xa_mount->m_log); | ||
859 | if (XFS_FORCED_SHUTDOWN(ailp->xa_mount)) | ||
860 | continue; | ||
861 | |||
862 | tout = xfsaild_push(ailp, &last_pushed_lsn); | ||
863 | } | ||
864 | |||
865 | return 0; | ||
866 | } /* xfsaild */ | ||
867 | |||
868 | int | ||
869 | xfsaild_start( | ||
870 | struct xfs_ail *ailp) | ||
871 | { | ||
872 | ailp->xa_target = 0; | ||
873 | ailp->xa_task = kthread_run(xfsaild, ailp, "xfsaild/%s", | ||
874 | ailp->xa_mount->m_fsname); | ||
875 | if (IS_ERR(ailp->xa_task)) | ||
876 | return -PTR_ERR(ailp->xa_task); | ||
877 | return 0; | ||
878 | } | ||
879 | |||
880 | void | ||
881 | xfsaild_stop( | ||
882 | struct xfs_ail *ailp) | ||
883 | { | ||
884 | kthread_stop(ailp->xa_task); | ||
885 | } | ||
886 | |||
887 | |||
888 | /* Catch misguided souls that try to use this interface on XFS */ | 819 | /* Catch misguided souls that try to use this interface on XFS */ |
889 | STATIC struct inode * | 820 | STATIC struct inode * |
890 | xfs_fs_alloc_inode( | 821 | xfs_fs_alloc_inode( |
@@ -1191,22 +1122,12 @@ xfs_fs_sync_fs( | |||
1191 | return -error; | 1122 | return -error; |
1192 | 1123 | ||
1193 | if (laptop_mode) { | 1124 | if (laptop_mode) { |
1194 | int prev_sync_seq = mp->m_sync_seq; | ||
1195 | |||
1196 | /* | 1125 | /* |
1197 | * The disk must be active because we're syncing. | 1126 | * The disk must be active because we're syncing. |
1198 | * We schedule xfssyncd now (now that the disk is | 1127 | * We schedule xfssyncd now (now that the disk is |
1199 | * active) instead of later (when it might not be). | 1128 | * active) instead of later (when it might not be). |
1200 | */ | 1129 | */ |
1201 | wake_up_process(mp->m_sync_task); | 1130 | flush_delayed_work_sync(&mp->m_sync_work); |
1202 | /* | ||
1203 | * We have to wait for the sync iteration to complete. | ||
1204 | * If we don't, the disk activity caused by the sync | ||
1205 | * will come after the sync is completed, and that | ||
1206 | * triggers another sync from laptop mode. | ||
1207 | */ | ||
1208 | wait_event(mp->m_wait_single_sync_task, | ||
1209 | mp->m_sync_seq != prev_sync_seq); | ||
1210 | } | 1131 | } |
1211 | 1132 | ||
1212 | return 0; | 1133 | return 0; |
@@ -1490,9 +1411,6 @@ xfs_fs_fill_super( | |||
1490 | spin_lock_init(&mp->m_sb_lock); | 1411 | spin_lock_init(&mp->m_sb_lock); |
1491 | mutex_init(&mp->m_growlock); | 1412 | mutex_init(&mp->m_growlock); |
1492 | atomic_set(&mp->m_active_trans, 0); | 1413 | atomic_set(&mp->m_active_trans, 0); |
1493 | INIT_LIST_HEAD(&mp->m_sync_list); | ||
1494 | spin_lock_init(&mp->m_sync_lock); | ||
1495 | init_waitqueue_head(&mp->m_wait_single_sync_task); | ||
1496 | 1414 | ||
1497 | mp->m_super = sb; | 1415 | mp->m_super = sb; |
1498 | sb->s_fs_info = mp; | 1416 | sb->s_fs_info = mp; |
@@ -1799,6 +1717,38 @@ xfs_destroy_zones(void) | |||
1799 | } | 1717 | } |
1800 | 1718 | ||
1801 | STATIC int __init | 1719 | STATIC int __init |
1720 | xfs_init_workqueues(void) | ||
1721 | { | ||
1722 | /* | ||
1723 | * max_active is set to 8 to give enough concurency to allow | ||
1724 | * multiple work operations on each CPU to run. This allows multiple | ||
1725 | * filesystems to be running sync work concurrently, and scales with | ||
1726 | * the number of CPUs in the system. | ||
1727 | */ | ||
1728 | xfs_syncd_wq = alloc_workqueue("xfssyncd", WQ_CPU_INTENSIVE, 8); | ||
1729 | if (!xfs_syncd_wq) | ||
1730 | goto out; | ||
1731 | |||
1732 | xfs_ail_wq = alloc_workqueue("xfsail", WQ_CPU_INTENSIVE, 8); | ||
1733 | if (!xfs_ail_wq) | ||
1734 | goto out_destroy_syncd; | ||
1735 | |||
1736 | return 0; | ||
1737 | |||
1738 | out_destroy_syncd: | ||
1739 | destroy_workqueue(xfs_syncd_wq); | ||
1740 | out: | ||
1741 | return -ENOMEM; | ||
1742 | } | ||
1743 | |||
1744 | STATIC void | ||
1745 | xfs_destroy_workqueues(void) | ||
1746 | { | ||
1747 | destroy_workqueue(xfs_ail_wq); | ||
1748 | destroy_workqueue(xfs_syncd_wq); | ||
1749 | } | ||
1750 | |||
1751 | STATIC int __init | ||
1802 | init_xfs_fs(void) | 1752 | init_xfs_fs(void) |
1803 | { | 1753 | { |
1804 | int error; | 1754 | int error; |
@@ -1813,10 +1763,14 @@ init_xfs_fs(void) | |||
1813 | if (error) | 1763 | if (error) |
1814 | goto out; | 1764 | goto out; |
1815 | 1765 | ||
1816 | error = xfs_mru_cache_init(); | 1766 | error = xfs_init_workqueues(); |
1817 | if (error) | 1767 | if (error) |
1818 | goto out_destroy_zones; | 1768 | goto out_destroy_zones; |
1819 | 1769 | ||
1770 | error = xfs_mru_cache_init(); | ||
1771 | if (error) | ||
1772 | goto out_destroy_wq; | ||
1773 | |||
1820 | error = xfs_filestream_init(); | 1774 | error = xfs_filestream_init(); |
1821 | if (error) | 1775 | if (error) |
1822 | goto out_mru_cache_uninit; | 1776 | goto out_mru_cache_uninit; |
@@ -1833,6 +1787,10 @@ init_xfs_fs(void) | |||
1833 | if (error) | 1787 | if (error) |
1834 | goto out_cleanup_procfs; | 1788 | goto out_cleanup_procfs; |
1835 | 1789 | ||
1790 | error = xfs_init_workqueues(); | ||
1791 | if (error) | ||
1792 | goto out_sysctl_unregister; | ||
1793 | |||
1836 | vfs_initquota(); | 1794 | vfs_initquota(); |
1837 | 1795 | ||
1838 | error = register_filesystem(&xfs_fs_type); | 1796 | error = register_filesystem(&xfs_fs_type); |
@@ -1850,6 +1808,8 @@ init_xfs_fs(void) | |||
1850 | xfs_filestream_uninit(); | 1808 | xfs_filestream_uninit(); |
1851 | out_mru_cache_uninit: | 1809 | out_mru_cache_uninit: |
1852 | xfs_mru_cache_uninit(); | 1810 | xfs_mru_cache_uninit(); |
1811 | out_destroy_wq: | ||
1812 | xfs_destroy_workqueues(); | ||
1853 | out_destroy_zones: | 1813 | out_destroy_zones: |
1854 | xfs_destroy_zones(); | 1814 | xfs_destroy_zones(); |
1855 | out: | 1815 | out: |
@@ -1866,6 +1826,7 @@ exit_xfs_fs(void) | |||
1866 | xfs_buf_terminate(); | 1826 | xfs_buf_terminate(); |
1867 | xfs_filestream_uninit(); | 1827 | xfs_filestream_uninit(); |
1868 | xfs_mru_cache_uninit(); | 1828 | xfs_mru_cache_uninit(); |
1829 | xfs_destroy_workqueues(); | ||
1869 | xfs_destroy_zones(); | 1830 | xfs_destroy_zones(); |
1870 | } | 1831 | } |
1871 | 1832 | ||