From: Christoph Hellwig <hch@infradead.org>
To: David Chinner <dgc@sgi.com>
Cc: xfs-dev@sgi.com, xfs@oss.sgi.com
Subject: Re: Review: freezing sometimes leaves the log dirty
Date: Fri, 2 Feb 2007 11:46:23 +0000 [thread overview]
Message-ID: <20070202114623.GA23187@infradead.org> (raw)
In-Reply-To: <20070130220326.GM33919298@melbourne.sgi.com>
On Wed, Jan 31, 2007 at 09:03:26AM +1100, David Chinner wrote:
> - if (unlikely(sb->s_frozen == SB_FREEZE_WRITE))
> - flags = SYNC_QUIESCE;
> - else
> + if (unlikely(sb->s_frozen == SB_FREEZE_WRITE)) {
> + /*
> + * First stage of freeze - no more writers will make progress
> + * now we are here, so we flush delwri and delalloc buffers
> + * here, then wait for all I/O to complete. Data is frozen at
> + * that point. Metadata is not frozen, transactions can still
> + * occur here so don't bother flushing the buftarg (i.e
> + * SYNC_QUIESCE) because it'll just get dirty again.
> + */
> + flags = SYNC_FSDATA | SYNC_DELWRI | SYNC_WAIT | SYNC_DIO_WAIT;
> + } else
You remove all uses of SYNC_QUIESCE in this patch, so please kill the
definition aswell.
> + * SYNC_DIO_WAIT - The caller wants us to wait for all direct I/Os
> + * as well to ensure all data I/O completes before we
> + * return. Forms the drain side of the write barrier needed
> + * to safely quiesce the filesystem.
> *
> */
> /*ARGSUSED*/
> @@ -892,10 +896,7 @@ xfs_sync(
> {
> xfs_mount_t *mp = XFS_BHVTOM(bdp);
>
> - if (unlikely(flags == SYNC_QUIESCE))
> - return xfs_quiesce_fs(mp);
> - else
> - return xfs_syncsub(mp, flags, NULL);
> + return xfs_syncsub(mp, flags, NULL);
> }
>
> /*
> @@ -1181,6 +1182,12 @@ xfs_sync_inodes(
> }
>
> }
> + /*
> + * When freezing, we need to wait ensure direct I/O is complete
> + * as well to ensure all data modification is complete here
> + */
> + if (flags & SYNC_DIO_WAIT)
> + vn_iowait(vp);
vn_iowait waits for v_iocount decrementing to zero. We use v_iocount
for tracking ioend structures that are used both for buffered and direct
I/O. Because of that the flag should probably be SYNC_IOWAIT and the comment
updated to reflect this.
> +/*
> + * Second stage of a freeze. The data is already frozen, 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 proceding.
> + */
> STATIC void
> xfs_freeze(
> bhv_desc_t *bdp)
> {
> xfs_mount_t *mp = XFS_BHVTOM(bdp);
>
> + /* wait for all modifications to complete */
> while (atomic_read(&mp->m_active_trans) > 0)
> delay(100);
>
> + /* flush inodes and push all remaining buffers out to disk */
> + xfs_quiesce_fs(mp);
> +
> + BUG_ON(atomic_read(&mp->m_active_trans) > 0);
> +
xfs_vfsops.c is considered common code, so you should probably use
ASSERT here, not BUG_ON.
next prev parent reply other threads:[~2007-02-02 12:24 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-01-30 22:03 Review: freezing sometimes leaves the log dirty David Chinner
2007-02-01 6:52 ` Donald Douwsma
2007-02-02 11:46 ` Christoph Hellwig [this message]
2007-02-02 14:07 ` David Chinner
2007-02-05 21:02 ` David Chinner
2007-02-05 21:09 ` Christoph Hellwig
2007-02-04 21:56 ` Nathan Scott
2007-02-04 23:45 ` David 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=20070202114623.GA23187@infradead.org \
--to=hch@infradead.org \
--cc=dgc@sgi.com \
--cc=xfs-dev@sgi.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