From: Ben Myers <bpm@sgi.com>
To: Dave Chinner <david@fromorbit.com>, xfs@oss.sgi.com
Cc: Dave Chinner <dchinner@redhat.com>
Subject: [patch v4 03/13] [PATCH 03/13] xfs: dont run the sync work if the filesystem is
Date: Fri, 05 Oct 2012 12:18:56 -0500 [thread overview]
Message-ID: <20121005171945.678198252@sgi.com> (raw)
In-Reply-To: 20121005171853.985930109@sgi.com
[-- Attachment #1: xfs-don-t-run-the-sync-work-if-the-filesystem-is.patch read-only --]
[-- Type: text/plain, Size: 3554 bytes --]
From: Dave Chinner <dchinner@redhat.com>
If the filesystem is mounted or remounted read-only, stop the sync
worker that tries to flush or cover the log if the filesystem is
dirty. It's read-only, so it isn't dirty. Restart it on a remount,rw
as necessary. This avoids the need for RO checks in the work.
Similarly, stop the sync work when the filesystem is frozen, and
start it again when the filesysetm is thawed. This avoids the need
for special freeze checks in the work.
Signed-off-by: Dave Chinner <dchinner@redhat.com>
Reviewed-by: Mark Tinguely <tinguely@sgi.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Ben Myers <bpm@sgi.com>
---
fs/xfs/xfs_super.c | 2 ++
fs/xfs/xfs_sync.c | 29 ++++++++++++++++-------------
2 files changed, 18 insertions(+), 13 deletions(-)
diff --git a/fs/xfs/xfs_super.c b/fs/xfs/xfs_super.c
index 935b2c7..f6147ae 100644
--- a/fs/xfs/xfs_super.c
+++ b/fs/xfs/xfs_super.c
@@ -1107,6 +1107,7 @@ xfs_fs_remount(
* value if it is non-zero, otherwise go with the default.
*/
xfs_restore_resvblks(mp);
+ xfs_syncd_queue_sync(mp);
}
/* rw -> ro */
@@ -1152,6 +1153,7 @@ xfs_fs_unfreeze(
struct xfs_mount *mp = XFS_M(sb);
xfs_restore_resvblks(mp);
+ xfs_syncd_queue_sync(mp);
return 0;
}
diff --git a/fs/xfs/xfs_sync.c b/fs/xfs/xfs_sync.c
index 509190f..5d69f23 100644
--- a/fs/xfs/xfs_sync.c
+++ b/fs/xfs/xfs_sync.c
@@ -323,6 +323,9 @@ xfs_quiesce_data(
* Second stage of a quiesce. The data is already synced, now we have to take
* care of the metadata. New transactions are already blocked, so we need to
* wait for any remaining transactions to drain out before proceeding.
+ *
+ * Note: this stops background sync work - the callers must ensure it is started
+ * again when appropriate.
*/
void
xfs_quiesce_attr(
@@ -341,6 +344,9 @@ xfs_quiesce_attr(
/* flush all pending changes from the AIL */
xfs_ail_push_all_sync(mp->m_ail);
+ /* stop background sync work */
+ cancel_delayed_work_sync(&mp->m_sync_work);
+
/*
* Just warn here till VFS can correctly support
* read-only remount without racing.
@@ -379,9 +385,8 @@ xfs_syncd_queue_sync(
}
/*
- * Every sync period we need to unpin all items in the AIL and push them to
- * disk. If there is nothing dirty, then we might need to cover the log to
- * indicate that the filesystem is idle and not frozen.
+ * Every sync period we need to push dirty metadata and try to cover the log
+ * to indicate the filesystem is idle and not frozen.
*/
void
xfs_sync_worker(
@@ -391,17 +396,15 @@ xfs_sync_worker(
struct xfs_mount, m_sync_work);
int error;
- if (!(mp->m_flags & XFS_MOUNT_RDONLY)) {
- /* dgc: errors ignored here */
- if (mp->m_super->s_writers.frozen == SB_UNFROZEN &&
- xfs_log_need_covered(mp))
- error = xfs_fs_log_dummy(mp);
- else
- xfs_log_force(mp, 0);
+ /* dgc: errors ignored here */
+ if (mp->m_super->s_writers.frozen == SB_UNFROZEN &&
+ xfs_log_need_covered(mp))
+ error = xfs_fs_log_dummy(mp);
+ else
+ xfs_log_force(mp, 0);
- /* start pushing all the metadata that is currently dirty */
- xfs_ail_push_all(mp->m_ail);
- }
+ /* start pushing all the metadata that is currently dirty */
+ xfs_ail_push_all(mp->m_ail);
/* queue us up again */
xfs_syncd_queue_sync(mp);
--
1.7.10
_______________________________________________
xfs mailing list
xfs@oss.sgi.com
http://oss.sgi.com/mailman/listinfo/xfs
_______________________________________________
xfs mailing list
xfs@oss.sgi.com
http://oss.sgi.com/mailman/listinfo/xfs
next prev parent reply other threads:[~2012-10-05 17:18 UTC|newest]
Thread overview: 24+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-10-05 17:18 [patch v4 00/13] xfs: remove the xfssyncd mess Ben Myers
2012-10-05 17:18 ` [patch v4 01/13] [PATCH 01/13] xfs: xfs_syncd_stop must die Ben Myers
2012-10-05 17:18 ` [patch v4 02/13] [PATCH 02/13] xfs: rationalise xfs_mount_wq users Ben Myers
2012-10-05 17:18 ` Ben Myers [this message]
2012-10-05 17:18 ` [patch v4 04/13] [PATCH 04/13] xfs: sync work is now only periodic log work Ben Myers
2012-10-05 18:16 ` Christoph Hellwig
2012-10-05 18:31 ` Mark Tinguely
2012-10-05 17:18 ` [patch v4 05/13] [PATCH 05/13] xfs: Bring some sanity to log unmounting Ben Myers
2012-10-05 17:18 ` [patch v4 06/13] [PATCH 06/13] xfs: xfs_sync_data is redundant Ben Myers
2012-10-05 17:55 ` Mark Tinguely
2012-10-05 18:04 ` Ben Myers
2012-10-05 18:15 ` Christoph Hellwig
2012-10-05 18:15 ` Mark Tinguely
2012-10-05 17:19 ` [patch v4 07/13] [PATCH 07/13] xfs: syncd workqueue is no more Ben Myers
2012-10-05 17:59 ` Mark Tinguely
2012-10-05 17:19 ` [patch v4 08/13] [PATCH 08/13] xfs: xfs_sync_fsdata is redundant Ben Myers
2012-10-05 17:19 ` [patch v4 09/13] [PATCH 09/13] xfs: move xfs_quiesce_attr() into xfs_super.c Ben Myers
2012-10-05 17:19 ` [patch v4 10/13] [PATCH 10/13] xfs: xfs_quiesce_attr() should quiesce the log like Ben Myers
2012-10-05 17:19 ` [patch v4 11/13] [PATCH 11/13] xfs: rename xfs_sync.[ch] to xfs_icache.[ch] Ben Myers
2012-10-05 17:19 ` [patch v4 12/13] [PATCH 12/13] xfs: move inode locking functions to xfs_inode.c Ben Myers
2012-10-05 17:19 ` [patch v4 13/13] [PATCH 13/13] xfs: remove xfs_iget.c Ben Myers
2012-10-06 1:31 ` [patch v4 00/13] xfs: remove the xfssyncd mess Dave Chinner
2012-10-06 17:37 ` Ben Myers
2012-10-08 0:33 ` Dave Chinner
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=20121005171945.678198252@sgi.com \
--to=bpm@sgi.com \
--cc=david@fromorbit.com \
--cc=dchinner@redhat.com \
--cc=xfs@oss.sgi.com \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox