All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] reiserfs: remove flush_old_commits
@ 2013-06-17 18:57 Jeff Mahoney
  2013-06-27  1:14 ` tomm
  0 siblings, 1 reply; 2+ messages in thread
From: Jeff Mahoney @ 2013-06-17 18:57 UTC (permalink / raw)
  To: reiserfs-devel

[-- Attachment #1: Type: text/plain, Size: 4942 bytes --]

Commit 033369d1 (reiserfs: get rid of resierfs_sync_super) was introduced
to replace the old s->dirt method of superblock writeback. Reiserfs
always journals the superblock on modification so we weren't really using
it anyway.

It also introduced a bug that causes reiserfs_sync_fs to be called in
5 second intervals once sync is called, whether the file system needs it
or not.

Let's just rip it all out. reiserfs_sync_fs has done the right thing
for ages.

Signed-off-by: Jeff Mahoney <jeffm@suse.com>
---
 fs/reiserfs/journal.c  |  4 ----
 fs/reiserfs/reiserfs.h |  6 ------
 fs/reiserfs/super.c    | 49 -------------------------------------------------
 3 files changed, 59 deletions(-)

diff --git a/fs/reiserfs/journal.c b/fs/reiserfs/journal.c
index 742fdd4..3b6b108 100644
--- a/fs/reiserfs/journal.c
+++ b/fs/reiserfs/journal.c
@@ -1923,8 +1923,6 @@ static int do_journal_release(struct reiserfs_transaction_handle *th,
 	 * the workqueue job (flush_async_commit) needs this lock
 	 */
 	reiserfs_write_unlock(sb);
-
-	cancel_delayed_work_sync(&REISERFS_SB(sb)->old_work);
 	flush_workqueue(commit_wq);
 
 	if (!reiserfs_mounted_fs_count) {
@@ -3306,7 +3304,6 @@ int journal_mark_dirty(struct reiserfs_transaction_handle *th,
 		journal->j_first = cn;
 		journal->j_last = cn;
 	}
-	reiserfs_schedule_old_flush(sb);
 	return 0;
 }
 
@@ -3944,7 +3941,6 @@ static int do_journal_end(struct reiserfs_transaction_handle *th,
 	 ** it tells us if we should continue with the journal_end, or just return
 	 */
 	if (!check_journal_end(th, sb, nblocks, flags)) {
-		reiserfs_schedule_old_flush(sb);
 		wake_queued_writers(sb);
 		reiserfs_async_progress_wait(sb);
 		goto out;
diff --git a/fs/reiserfs/reiserfs.h b/fs/reiserfs/reiserfs.h
index 157e474..055f512 100644
--- a/fs/reiserfs/reiserfs.h
+++ b/fs/reiserfs/reiserfs.h
@@ -480,11 +480,6 @@ struct reiserfs_sb_info {
 	struct dentry *priv_root;	/* root of /.reiserfs_priv */
 	struct dentry *xattr_root;	/* root of /.reiserfs_priv/xattrs */
 	int j_errno;
-
-	int work_queued;              /* non-zero delayed work is queued */
-	struct delayed_work old_work; /* old transactions flush delayed work */
-	spinlock_t old_work_lock;     /* protects old_work and work_queued */
-
 #ifdef CONFIG_QUOTA
 	char *s_qf_names[MAXQUOTAS];
 	int s_jquota_fmt;
@@ -2493,7 +2488,6 @@ void reiserfs_abort(struct super_block *sb, int errno, const char *fmt, ...);
 int reiserfs_allocate_list_bitmaps(struct super_block *s,
 				   struct reiserfs_list_bitmap *, unsigned int);
 
-void reiserfs_schedule_old_flush(struct super_block *s);
 void add_save_link(struct reiserfs_transaction_handle *th,
 		   struct inode *inode, int truncate);
 int remove_save_link(struct inode *inode, int truncate);
diff --git a/fs/reiserfs/super.c b/fs/reiserfs/super.c
index f8a23c3..dc2cd06 100644
--- a/fs/reiserfs/super.c
+++ b/fs/reiserfs/super.c
@@ -81,54 +81,9 @@ static int reiserfs_sync_fs(struct super_block *s, int wait)
 	return 0;
 }
 
-static void flush_old_commits(struct work_struct *work)
-{
-	struct reiserfs_sb_info *sbi;
-	struct super_block *s;
-
-	sbi = container_of(work, struct reiserfs_sb_info, old_work.work);
-	s = sbi->s_journal->j_work_sb;
-
-	spin_lock(&sbi->old_work_lock);
-	sbi->work_queued = 0;
-	spin_unlock(&sbi->old_work_lock);
-
-	reiserfs_sync_fs(s, 1);
-}
-
-void reiserfs_schedule_old_flush(struct super_block *s)
-{
-	struct reiserfs_sb_info *sbi = REISERFS_SB(s);
-	unsigned long delay;
-
-	if (s->s_flags & MS_RDONLY)
-		return;
-
-	spin_lock(&sbi->old_work_lock);
-	if (!sbi->work_queued) {
-		delay = msecs_to_jiffies(dirty_writeback_interval * 10);
-		queue_delayed_work(system_long_wq, &sbi->old_work, delay);
-		sbi->work_queued = 1;
-	}
-	spin_unlock(&sbi->old_work_lock);
-}
-
-static void cancel_old_flush(struct super_block *s)
-{
-	struct reiserfs_sb_info *sbi = REISERFS_SB(s);
-
-	cancel_delayed_work_sync(&REISERFS_SB(s)->old_work);
-	spin_lock(&sbi->old_work_lock);
-	sbi->work_queued = 0;
-	spin_unlock(&sbi->old_work_lock);
-}
-
 static int reiserfs_freeze(struct super_block *s)
 {
 	struct reiserfs_transaction_handle th;
-
-	cancel_old_flush(s);
-
 	reiserfs_write_lock(s);
 	if (!(s->s_flags & MS_RDONLY)) {
 		int err = journal_begin(&th, s, 1);
@@ -1796,8 +1751,6 @@ static int reiserfs_fill_super(struct super_block *s, void *data, int silent)
 	/* setup default block allocator options */
 	reiserfs_init_alloc_options(s);
 
-	spin_lock_init(&sbi->old_work_lock);
-	INIT_DELAYED_WORK(&sbi->old_work, flush_old_commits);
 	mutex_init(&sbi->lock);
 	sbi->lock_depth = -1;
 
@@ -2060,8 +2013,6 @@ error_unlocked:
 		reiserfs_write_unlock(s);
 	}
 
-	cancel_delayed_work_sync(&REISERFS_SB(s)->old_work);
-
 	reiserfs_free_bitmap_cache(s);
 	if (SB_BUFFER_WITH_SB(s))
 		brelse(SB_BUFFER_WITH_SB(s));



[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 841 bytes --]

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] reiserfs: remove flush_old_commits
  2013-06-17 18:57 [PATCH] reiserfs: remove flush_old_commits Jeff Mahoney
@ 2013-06-27  1:14 ` tomm
  0 siblings, 0 replies; 2+ messages in thread
From: tomm @ 2013-06-27  1:14 UTC (permalink / raw)
  To: reiserfs-devel

Jeff Mahoney <jeffm <at> suse.com> writes:

> 
> Commit 033369d1 (reiserfs: get rid of resierfs_sync_super) was introduced
> to replace the old s->dirt method of superblock writeback. Reiserfs
> always journals the superblock on modification so we weren't really using
> it anyway.

A bug with this patch is that uncommitted journal entries are left in memory
so that if the machine is reset or loses power, you are guaranteed to lose data.



^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2013-06-27  1:14 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-06-17 18:57 [PATCH] reiserfs: remove flush_old_commits Jeff Mahoney
2013-06-27  1:14 ` tomm

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.