aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJeff Mahoney <jeffm@suse.com>2014-04-23 10:00:34 -0400
committerJan Kara <jack@suse.cz>2014-05-06 16:44:45 -0400
commit797d9016ceca69879bb273218810fa0beef46aac (patch)
tree5a1e4e6bb653d4887fbc55915ecb8eea3c50edf1
parent38583f095c5a8138ae2a1c9173d0fd8a9f10e8aa (diff)
reiserfs: use per-fs commit workqueues
The reiserfs write lock hasn't been the BKL for some time. There's no need to have different file systems queued up on the same workqueue. Signed-off-by: Jeff Mahoney <jeffm@suse.com> Signed-off-by: Jan Kara <jack@suse.cz>
-rw-r--r--fs/reiserfs/journal.c22
-rw-r--r--fs/reiserfs/reiserfs.h2
-rw-r--r--fs/reiserfs/super.c21
3 files changed, 20 insertions, 25 deletions
diff --git a/fs/reiserfs/journal.c b/fs/reiserfs/journal.c
index fd777032c2ba..225921126455 100644
--- a/fs/reiserfs/journal.c
+++ b/fs/reiserfs/journal.c
@@ -58,13 +58,6 @@
58#define JOURNAL_WORK_ENTRY(h) (list_entry((h), struct reiserfs_journal_list, \ 58#define JOURNAL_WORK_ENTRY(h) (list_entry((h), struct reiserfs_journal_list, \
59 j_working_list)) 59 j_working_list))
60 60
61/* the number of mounted filesystems. This is used to decide when to
62** start and kill the commit workqueue
63*/
64static int reiserfs_mounted_fs_count;
65
66static struct workqueue_struct *commit_wq;
67
68#define JOURNAL_TRANS_HALF 1018 /* must be correct to keep the desc and commit 61#define JOURNAL_TRANS_HALF 1018 /* must be correct to keep the desc and commit
69 structs at 4k */ 62 structs at 4k */
70#define BUFNR 64 /*read ahead */ 63#define BUFNR 64 /*read ahead */
@@ -1882,7 +1875,6 @@ static int do_journal_release(struct reiserfs_transaction_handle *th,
1882 } 1875 }
1883 } 1876 }
1884 1877
1885 reiserfs_mounted_fs_count--;
1886 /* wait for all commits to finish */ 1878 /* wait for all commits to finish */
1887 cancel_delayed_work(&SB_JOURNAL(sb)->j_work); 1879 cancel_delayed_work(&SB_JOURNAL(sb)->j_work);
1888 1880
@@ -1893,12 +1885,7 @@ static int do_journal_release(struct reiserfs_transaction_handle *th,
1893 reiserfs_write_unlock(sb); 1885 reiserfs_write_unlock(sb);
1894 1886
1895 cancel_delayed_work_sync(&REISERFS_SB(sb)->old_work); 1887 cancel_delayed_work_sync(&REISERFS_SB(sb)->old_work);
1896 flush_workqueue(commit_wq); 1888 flush_workqueue(REISERFS_SB(sb)->commit_wq);
1897
1898 if (!reiserfs_mounted_fs_count) {
1899 destroy_workqueue(commit_wq);
1900 commit_wq = NULL;
1901 }
1902 1889
1903 free_journal_ram(sb); 1890 free_journal_ram(sb);
1904 1891
@@ -2807,10 +2794,6 @@ int journal_init(struct super_block *sb, const char *j_dev_name,
2807 goto free_and_return; 2794 goto free_and_return;
2808 } 2795 }
2809 2796
2810 reiserfs_mounted_fs_count++;
2811 if (reiserfs_mounted_fs_count <= 1)
2812 commit_wq = alloc_workqueue("reiserfs", WQ_MEM_RECLAIM, 0);
2813
2814 INIT_DELAYED_WORK(&journal->j_work, flush_async_commits); 2797 INIT_DELAYED_WORK(&journal->j_work, flush_async_commits);
2815 journal->j_work_sb = sb; 2798 journal->j_work_sb = sb;
2816 return 0; 2799 return 0;
@@ -4134,7 +4117,8 @@ static int do_journal_end(struct reiserfs_transaction_handle *th,
4134 flush_commit_list(sb, jl, 1); 4117 flush_commit_list(sb, jl, 1);
4135 flush_journal_list(sb, jl, 1); 4118 flush_journal_list(sb, jl, 1);
4136 } else if (!(jl->j_state & LIST_COMMIT_PENDING)) 4119 } else if (!(jl->j_state & LIST_COMMIT_PENDING))
4137 queue_delayed_work(commit_wq, &journal->j_work, HZ / 10); 4120 queue_delayed_work(REISERFS_SB(sb)->commit_wq,
4121 &journal->j_work, HZ / 10);
4138 4122
4139 /* if the next transaction has any chance of wrapping, flush 4123 /* if the next transaction has any chance of wrapping, flush
4140 ** transactions that might get overwritten. If any journal lists are very 4124 ** transactions that might get overwritten. If any journal lists are very
diff --git a/fs/reiserfs/reiserfs.h b/fs/reiserfs/reiserfs.h
index 83d4eac8059a..3f56746f0237 100644
--- a/fs/reiserfs/reiserfs.h
+++ b/fs/reiserfs/reiserfs.h
@@ -431,6 +431,8 @@ struct reiserfs_sb_info {
431 /* Depth of the lock, start from -1 like the bkl */ 431 /* Depth of the lock, start from -1 like the bkl */
432 int lock_depth; 432 int lock_depth;
433 433
434 struct workqueue_struct *commit_wq;
435
434 /* Comment? -Hans */ 436 /* Comment? -Hans */
435 void (*end_io_handler) (struct buffer_head *, int); 437 void (*end_io_handler) (struct buffer_head *, int);
436 hashf_t s_hash_function; /* pointer to function which is used 438 hashf_t s_hash_function; /* pointer to function which is used
diff --git a/fs/reiserfs/super.c b/fs/reiserfs/super.c
index 9fb20426005e..16927b800562 100644
--- a/fs/reiserfs/super.c
+++ b/fs/reiserfs/super.c
@@ -559,6 +559,7 @@ static void reiserfs_put_super(struct super_block *s)
559 559
560 reiserfs_write_unlock(s); 560 reiserfs_write_unlock(s);
561 mutex_destroy(&REISERFS_SB(s)->lock); 561 mutex_destroy(&REISERFS_SB(s)->lock);
562 destroy_workqueue(REISERFS_SB(s)->commit_wq);
562 kfree(s->s_fs_info); 563 kfree(s->s_fs_info);
563 s->s_fs_info = NULL; 564 s->s_fs_info = NULL;
564} 565}
@@ -1796,6 +1797,14 @@ static int reiserfs_fill_super(struct super_block *s, void *data, int silent)
1796 mutex_init(&sbi->lock); 1797 mutex_init(&sbi->lock);
1797 sbi->lock_depth = -1; 1798 sbi->lock_depth = -1;
1798 1799
1800 sbi->commit_wq = alloc_workqueue("reiserfs/%s", WQ_MEM_RECLAIM, 0,
1801 s->s_id);
1802 if (!sbi->commit_wq) {
1803 SWARN(silent, s, "", "Cannot allocate commit workqueue");
1804 errval = -ENOMEM;
1805 goto error_unlocked;
1806 }
1807
1799 jdev_name = NULL; 1808 jdev_name = NULL;
1800 if (reiserfs_parse_options 1809 if (reiserfs_parse_options
1801 (s, (char *)data, &(sbi->s_mount_opt), &blocks, &jdev_name, 1810 (s, (char *)data, &(sbi->s_mount_opt), &blocks, &jdev_name,
@@ -2402,18 +2411,18 @@ static int __init init_reiserfs_fs(void)
2402{ 2411{
2403 int ret; 2412 int ret;
2404 2413
2405 if ((ret = init_inodecache())) { 2414 ret = init_inodecache();
2415 if (ret)
2406 return ret; 2416 return ret;
2407 }
2408 2417
2409 reiserfs_proc_info_global_init(); 2418 reiserfs_proc_info_global_init();
2410 2419
2411 ret = register_filesystem(&reiserfs_fs_type); 2420 ret = register_filesystem(&reiserfs_fs_type);
2421 if (ret)
2422 goto out;
2412 2423
2413 if (ret == 0) { 2424 return 0;
2414 return 0; 2425out:
2415 }
2416
2417 reiserfs_proc_info_global_done(); 2426 reiserfs_proc_info_global_done();
2418 destroy_inodecache(); 2427 destroy_inodecache();
2419 2428