All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jeff Mahoney <jeffm@suse.com>
To: ReiserFS Development List <reiserfs-devel@vger.kernel.org>
Cc: Jan Kara <jack@suse.cz>, Dave Jones <davej@redhat.com>
Subject: [patch 01/29] reiserfs: use per-fs commit workqueues
Date: Wed, 23 Apr 2014 10:00:34 -0400	[thread overview]
Message-ID: <20140423151139.033812424@suse.com> (raw)
In-Reply-To: 20140423140033.704113918@suse.com

[-- Attachment #1: patches.fixes/reiserfs-get-rid-of-reiserfs_mounted_fs_count --]
[-- Type: text/plain, Size: 3775 bytes --]

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>
---
 fs/reiserfs/journal.c  |   22 +++-------------------
 fs/reiserfs/reiserfs.h |    2 ++
 fs/reiserfs/super.c    |   21 +++++++++++++++------
 3 files changed, 20 insertions(+), 25 deletions(-)

--- a/fs/reiserfs/journal.c
+++ b/fs/reiserfs/journal.c
@@ -58,13 +58,6 @@
 #define JOURNAL_WORK_ENTRY(h) (list_entry((h), struct reiserfs_journal_list, \
                                j_working_list))
 
-/* the number of mounted filesystems.  This is used to decide when to
-** start and kill the commit workqueue
-*/
-static int reiserfs_mounted_fs_count;
-
-static struct workqueue_struct *commit_wq;
-
 #define JOURNAL_TRANS_HALF 1018	/* must be correct to keep the desc and commit
 				   structs at 4k */
 #define BUFNR 64		/*read ahead */
@@ -1909,7 +1902,6 @@ static int do_journal_release(struct rei
 		}
 	}
 
-	reiserfs_mounted_fs_count--;
 	/* wait for all commits to finish */
 	cancel_delayed_work(&SB_JOURNAL(sb)->j_work);
 
@@ -1920,12 +1912,7 @@ static int do_journal_release(struct rei
 	reiserfs_write_unlock(sb);
 
 	cancel_delayed_work_sync(&REISERFS_SB(sb)->old_work);
-	flush_workqueue(commit_wq);
-
-	if (!reiserfs_mounted_fs_count) {
-		destroy_workqueue(commit_wq);
-		commit_wq = NULL;
-	}
+	flush_workqueue(REISERFS_SB(sb)->commit_wq);
 
 	free_journal_ram(sb);
 
@@ -2799,10 +2786,6 @@ int journal_init(struct super_block *sb,
 		goto free_and_return;
 	}
 
-	reiserfs_mounted_fs_count++;
-	if (reiserfs_mounted_fs_count <= 1)
-		commit_wq = alloc_workqueue("reiserfs", WQ_MEM_RECLAIM, 0);
-
 	INIT_DELAYED_WORK(&journal->j_work, flush_async_commits);
 	journal->j_work_sb = sb;
 	return 0;
@@ -4115,7 +4098,8 @@ static int do_journal_end(struct reiserf
 		flush_commit_list(sb, jl, 1);
 		flush_journal_list(sb, jl, 1);
 	} else if (!(jl->j_state & LIST_COMMIT_PENDING))
-		queue_delayed_work(commit_wq, &journal->j_work, HZ / 10);
+		queue_delayed_work(REISERFS_SB(sb)->commit_wq,
+				   &journal->j_work, HZ / 10);
 
 	/* if the next transaction has any chance of wrapping, flush
 	 ** transactions that might get overwritten.  If any journal lists are very
--- a/fs/reiserfs/reiserfs.h
+++ b/fs/reiserfs/reiserfs.h
@@ -431,6 +431,8 @@ struct reiserfs_sb_info {
 	/* Depth of the lock, start from -1 like the bkl */
 	int lock_depth;
 
+	struct workqueue_struct *commit_wq;
+
 	/* Comment? -Hans */
 	void (*end_io_handler) (struct buffer_head *, int);
 	hashf_t s_hash_function;	/* pointer to function which is used
--- a/fs/reiserfs/super.c
+++ b/fs/reiserfs/super.c
@@ -560,6 +560,7 @@ static void reiserfs_put_super(struct su
 
 	reiserfs_write_unlock(s);
 	mutex_destroy(&REISERFS_SB(s)->lock);
+	destroy_workqueue(REISERFS_SB(s)->commit_wq);
 	kfree(s->s_fs_info);
 	s->s_fs_info = NULL;
 }
@@ -1796,6 +1797,14 @@ static int reiserfs_fill_super(struct su
 	mutex_init(&sbi->lock);
 	sbi->lock_depth = -1;
 
+	sbi->commit_wq = alloc_workqueue("reiserfs/%s", WQ_MEM_RECLAIM, 0,
+					 s->s_id);
+	if (!sbi->commit_wq) {
+		SWARN(silent, s, "", "Cannot allocate commit workqueue");
+		errval = -ENOMEM;
+		goto error_unlocked;
+	}
+
 	jdev_name = NULL;
 	if (reiserfs_parse_options
 	    (s, (char *)data, &(sbi->s_mount_opt), &blocks, &jdev_name,
@@ -2402,18 +2411,18 @@ static int __init init_reiserfs_fs(void)
 {
 	int ret;
 
-	if ((ret = init_inodecache())) {
+	ret = init_inodecache();
+	if (ret)
 		return ret;
-	}
 
 	reiserfs_proc_info_global_init();
 
 	ret = register_filesystem(&reiserfs_fs_type);
+	if (ret)
+		goto out;
 
-	if (ret == 0) {
-		return 0;
-	}
-
+	return 0;
+out:
 	reiserfs_proc_info_global_done();
 	destroy_inodecache();
 



  reply	other threads:[~2014-04-23 14:00 UTC|newest]

Thread overview: 50+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-04-23 14:00 [patch 00/29] reiserfs cleanup patchset Jeff Mahoney
2014-04-23 14:00 ` Jeff Mahoney [this message]
2014-04-23 14:00 ` [patch 02/29] reiserfs: cleanup, rename key and item accessors to more friendly names Jeff Mahoney
2014-04-23 14:00 ` [patch 04/29] reiserfs: cleanup, remove nblocks argument from journal_end Jeff Mahoney
2014-04-23 14:00 ` [patch 05/29] reiserfs: cleanup, remove sb " Jeff Mahoney
2014-04-23 14:00 ` [patch 06/29] reiserfs: cleanup, remove sb argument from journal_mark_dirty Jeff Mahoney
2014-04-23 14:00 ` [patch 07/29] reiserfs: cleanup, remove blocks arg from journal_join Jeff Mahoney
2014-04-23 14:00 ` [patch 08/29] reiserfs: cleanup, remove leading whitespace from labels Jeff Mahoney
2014-04-23 14:00 ` [patch 09/29] reiserfs: cleanup, remove unnecessary parens Jeff Mahoney
2014-04-23 14:00 ` [patch 10/29] reiserfs: cleanup, remove unnecessary parens in dirent creation Jeff Mahoney
2014-04-23 14:00 ` [patch 11/29] reiserfs: cleanup, make hash detection saner Jeff Mahoney
2014-05-06 21:27   ` Jan Kara
2014-05-07 12:16     ` Jeff Mahoney
2014-05-07 15:50       ` Jan Kara
2014-04-23 14:00 ` [patch 12/29] reiserfs: balance_leaf refactor, reformat balance_leaf comments Jeff Mahoney
2014-04-23 14:00 ` [patch 13/29] reiserfs: balance_leaf refactor, move state variables into tree_balance Jeff Mahoney
2014-04-23 14:00 ` [patch 14/29] reiserfs: balance_leaf refactor, pull out balance_leaf_insert_left Jeff Mahoney
2014-04-23 14:00 ` [patch 15/29] reiserfs: balance_leaf refactor, pull out balance_leaf_paste_left Jeff Mahoney
2014-04-23 14:00 ` [patch 16/29] reiserfs: balance_leaf refactor, pull out balance_leaf_insert_right Jeff Mahoney
2014-04-23 14:00 ` [patch 17/29] reiserfs: balance_leaf refactor, pull out balance_leaf_paste_right Jeff Mahoney
2014-04-23 14:00 ` [patch 18/29] reiserfs: balance_leaf refactor, pull out balance_leaf_new_nodes_insert Jeff Mahoney
2014-04-23 14:00 ` [patch 19/29] reiserfs: balance_leaf refactor, pull out balance_leaf_new_nodes_paste Jeff Mahoney
2014-04-23 14:00 ` [patch 20/29] reiserfs: balance_leaf refactor pull out balance_leaf_finish_node_insert Jeff Mahoney
2014-04-23 14:00 ` [patch 21/29] reiserfs: balance_leaf refactor, pull out balance_leaf_finish_node_paste Jeff Mahoney
2014-04-23 14:00 ` [patch 22/29] reiserfs: balance_leaf refactor, pull out balance_leaf{left, right, new_nodes, finish_node} Jeff Mahoney
2014-04-23 14:00 ` [patch 23/29] reiserfs: balance_leaf refactor, format balance_leaf_insert_left Jeff Mahoney
2014-04-23 14:00 ` [patch 24/29] reiserfs: balance_leaf refactor, format balance_leaf_paste_left Jeff Mahoney
2014-04-23 14:00 ` [patch 25/29] reiserfs: balance_leaf refactor, format balance_leaf_insert_right Jeff Mahoney
2014-04-23 14:00 ` [patch 26/29] reiserfs: balance_leaf refactor, format balance_leaf_paste_right Jeff Mahoney
2014-04-23 14:01 ` [patch 27/29] reiserfs: balance_leaf refactor, format balance_leaf_new_nodes_paste Jeff Mahoney
2014-04-23 14:01 ` [patch 28/29] reiserfs: balance_leaf refactor, format balance_leaf_finish_node Jeff Mahoney
2014-04-23 14:01 ` [patch 29/29] reiserfs: balance_leaf refactor, split up balance_leaf_when_delete Jeff Mahoney
2014-04-26  3:46 ` [patch 00/29] reiserfs cleanup patchset doiggl
2014-04-26 15:14   ` Jeff Mahoney
2014-05-16 10:47     ` doiggl
2014-05-22  8:24       ` doiggl
2014-05-22 13:51         ` Jeff Mahoney
2014-05-26  4:12           ` doiggl
2014-05-26 18:24             ` Jeff Mahoney
2014-06-12 14:31           ` doiggl
2014-06-12 14:38             ` Jeff Mahoney
2014-06-13  4:20               ` doiggl
2014-06-13  4:25                 ` Jeff Mahoney
2014-06-13 15:09                   ` Jeff Mahoney
2014-05-13 14:13 ` Jan Kara
2014-05-13 14:15   ` Jeff Mahoney
2014-05-27  9:23 ` doiggl
2014-05-27 12:36   ` Jeff Mahoney
2014-06-05  3:21     ` Jose R R
     [not found]       ` <47aabceb9575031270f0940059da157c@mail.velocitynet.com.au>
2014-06-26 14:27         ` [patch 00/29] reiserfs cleanup patchset - 03/29 attached [reiserfs: cleanup, reformat comments to normal kernel style] Jose R R

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20140423151139.033812424@suse.com \
    --to=jeffm@suse.com \
    --cc=davej@redhat.com \
    --cc=jack@suse.cz \
    --cc=reiserfs-devel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.