From: Eric Sandeen <sandeen@sandeen.net>
To: Christoph Hellwig <hch@infradead.org>
Cc: xfs@oss.sgi.com
Subject: Re: [PATCH 9/7] xfs: remove SYNC_BDFLUSH
Date: Fri, 05 Jun 2009 15:45:15 -0500 [thread overview]
Message-ID: <4A2983DB.90300@sandeen.net> (raw)
In-Reply-To: <20090528121947.GB30037@infradead.org>
Christoph Hellwig wrote:
> SYNC_BDFLUSH is a leftover from IRIX and rather misnamed for todays
> code. Make xfs_sync_fsdata and xfs_dq_sync use the SYNC_TRYLOCK flag
> for not blocking on logs just as the inode sync code already does.
>
> For xfs_sync_fsdata it's a trivial 1:1 replacement, but for xfs_qm_sync
> I use the opportunity to decouple the non-blocking lock case from the
> different flushing modes, similar to the inode sync code.
>
>
> Signed-off-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Eric Sandeen <sandeen@sandeen.net>
> Index: xfs/fs/xfs/linux-2.6/xfs_sync.c
> ===================================================================
> --- xfs.orig/fs/xfs/linux-2.6/xfs_sync.c 2009-05-27 13:02:57.426938830 +0200
> +++ xfs/fs/xfs/linux-2.6/xfs_sync.c 2009-05-27 13:07:53.227939055 +0200
> @@ -350,7 +350,7 @@ xfs_sync_fsdata(
> * If this is xfssyncd() then only sync the superblock if we can
> * lock it without sleeping and it is not pinned.
> */
> - if (flags & SYNC_BDFLUSH) {
> + if (flags & SYNC_TRYLOCK) {
> ASSERT(!(flags & SYNC_WAIT));
>
> bp = xfs_getsb(mp, XFS_BUF_TRYLOCK);
> @@ -415,7 +415,7 @@ xfs_quiesce_data(
>
> /* push non-blocking */
> xfs_sync_data(mp, 0);
> - xfs_qm_sync(mp, SYNC_BDFLUSH);
> + xfs_qm_sync(mp, SYNC_TRYLOCK);
> xfs_filestream_flush(mp);
>
> /* push and block */
> @@ -565,8 +565,8 @@ xfs_sync_worker(
> xfs_log_force(mp, (xfs_lsn_t)0, XFS_LOG_FORCE);
> xfs_reclaim_inodes(mp, XFS_IFLUSH_DELWRI_ELSE_ASYNC);
> /* dgc: errors ignored here */
> - error = xfs_qm_sync(mp, SYNC_BDFLUSH);
> - error = xfs_sync_fsdata(mp, SYNC_BDFLUSH);
> + error = xfs_qm_sync(mp, SYNC_TRYLOCK);
> + error = xfs_sync_fsdata(mp, SYNC_TRYLOCK);
> if (xfs_log_need_covered(mp))
> error = xfs_commit_dummy_trans(mp, XFS_LOG_FORCE);
> }
> Index: xfs/fs/xfs/quota/xfs_qm.c
> ===================================================================
> --- xfs.orig/fs/xfs/quota/xfs_qm.c 2009-05-27 13:04:00.607842293 +0200
> +++ xfs/fs/xfs/quota/xfs_qm.c 2009-05-27 13:10:21.688940102 +0200
> @@ -905,11 +905,6 @@ xfs_qm_dqdetach(
> }
> }
>
> -/*
> - * This is called to sync quotas. We can be told to use non-blocking
> - * semantics by either the SYNC_BDFLUSH flag or the absence of the
> - * SYNC_WAIT flag.
> - */
> int
> xfs_qm_sync(
> xfs_mount_t *mp,
> @@ -918,17 +913,13 @@ xfs_qm_sync(
> int recl, restarts;
> xfs_dquot_t *dqp;
> uint flush_flags;
> - boolean_t nowait;
> int error;
>
> if (!XFS_IS_QUOTA_RUNNING(mp) || !XFS_IS_QUOTA_ON(mp))
> return 0;
>
> + flush_flags = (flags & SYNC_WAIT) ? XFS_QMOPT_SYNC : XFS_QMOPT_DELWRI;
> restarts = 0;
> - /*
> - * We won't block unless we are asked to.
> - */
> - nowait = (boolean_t)(flags & SYNC_BDFLUSH || (flags & SYNC_WAIT) == 0);
>
> again:
> xfs_qm_mplist_lock(mp);
> @@ -948,18 +939,10 @@ xfs_qm_sync(
> * don't 'seem' to be dirty. ie. don't acquire dqlock.
> * This is very similar to what xfs_sync does with inodes.
> */
> - if (flags & SYNC_BDFLUSH) {
> - if (! XFS_DQ_IS_DIRTY(dqp))
> + if (flags & SYNC_TRYLOCK) {
> + if (!XFS_DQ_IS_DIRTY(dqp))
> continue;
> - }
> -
> - if (nowait) {
> - /*
> - * Try to acquire the dquot lock. We are NOT out of
> - * lock order, but we just don't want to wait for this
> - * lock, unless somebody wanted us to.
> - */
> - if (! xfs_qm_dqlock_nowait(dqp))
> + if (!xfs_qm_dqlock_nowait(dqp))
> continue;
> } else {
> xfs_dqlock(dqp);
> @@ -976,7 +959,7 @@ xfs_qm_sync(
> /* XXX a sentinel would be better */
> recl = XFS_QI_MPLRECLAIMS(mp);
> if (!xfs_dqflock_nowait(dqp)) {
> - if (nowait) {
> + if (flags & SYNC_TRYLOCK) {
> xfs_dqunlock(dqp);
> continue;
> }
> @@ -994,7 +977,6 @@ xfs_qm_sync(
> * Let go of the mplist lock. We don't want to hold it
> * across a disk write
> */
> - flush_flags = (nowait) ? XFS_QMOPT_DELWRI : XFS_QMOPT_SYNC;
> xfs_qm_mplist_unlock(mp);
> xfs_dqtrace_entry(dqp, "XQM_SYNC: DQFLUSH");
> error = xfs_qm_dqflush(dqp, flush_flags);
> Index: xfs/fs/xfs/linux-2.6/xfs_sync.h
> ===================================================================
> --- xfs.orig/fs/xfs/linux-2.6/xfs_sync.h 2009-05-27 13:07:58.997814418 +0200
> +++ xfs/fs/xfs/linux-2.6/xfs_sync.h 2009-05-27 13:08:19.922972203 +0200
> @@ -29,9 +29,8 @@ typedef struct xfs_sync_work {
> struct completion *w_completion;
> } xfs_sync_work_t;
>
> -#define SYNC_WAIT 0x0004 /* wait for i/o to complete */
> -#define SYNC_BDFLUSH 0x0008 /* BDFLUSH is calling -- don't block */
> -#define SYNC_TRYLOCK 0x0020 /* only try to lock inodes */
> +#define SYNC_WAIT 0x0001 /* wait for i/o to complete */
> +#define SYNC_TRYLOCK 0x0002 /* only try to lock inodes */
>
> int xfs_syncd_init(struct xfs_mount *mp);
> void xfs_syncd_stop(struct xfs_mount *mp);
>
> _______________________________________________
> 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
prev parent reply other threads:[~2009-06-05 20:45 UTC|newest]
Thread overview: 40+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-05-14 17:12 [PATCH 0/7] inode sync refactoring Christoph Hellwig
2009-05-14 17:12 ` [PATCH 1/7] xfs: split inode data writeback from xfs_sync_inodes_ag Christoph Hellwig
2009-05-15 4:49 ` Sujit Karataparambil
2009-05-15 17:21 ` Christoph Hellwig
2009-05-18 6:58 ` Dave Chinner
2009-05-26 20:14 ` Eric Sandeen
2009-05-14 17:12 ` [PATCH 2/7] xfs: split inode flushing " Christoph Hellwig
2009-05-15 4:52 ` Sujit Karataparambil
2009-05-15 17:22 ` Christoph Hellwig
2009-05-26 20:45 ` Eric Sandeen
2009-05-27 10:58 ` Christoph Hellwig
2009-05-27 20:11 ` Eric Sandeen
2009-05-14 17:12 ` [PATCH 3/7] xfs: factor out inode validation for sync Christoph Hellwig
2009-05-27 20:38 ` Eric Sandeen
2009-05-14 17:12 ` [PATCH 4/7] xfs: remove unused parameter from xfs_reclaim_inodes Christoph Hellwig
2009-05-27 20:44 ` Eric Sandeen
2009-05-14 17:12 ` [PATCH 5/7] xfs: introduce a per-ag inode iterator Christoph Hellwig
2009-06-03 22:01 ` Eric Sandeen
2009-06-04 11:00 ` Christoph Hellwig
2009-06-03 22:18 ` Eric Sandeen
2009-06-04 17:17 ` Christoph Hellwig
2009-06-05 18:18 ` Eric Sandeen
2009-05-14 17:12 ` [PATCH 6/7] xfs: use generic inode iterator in xfs_qm_dqrele_all_inodes Christoph Hellwig
2009-06-03 23:29 ` Josef 'Jeff' Sipek
2009-06-05 19:15 ` Eric Sandeen
2009-06-05 19:17 ` Christoph Hellwig
2009-06-05 20:11 ` Eric Sandeen
2009-05-14 17:12 ` [PATCH 7/7] xfs: split xfs_sync_inodes Christoph Hellwig
2009-06-03 23:26 ` Josef 'Jeff' Sipek
2009-06-04 10:45 ` Christoph Hellwig
2009-06-05 20:32 ` Eric Sandeen
2009-05-28 12:19 ` [PATCH 8/7] xfs: remove SYNC_IOWAIT Christoph Hellwig
2009-06-03 23:30 ` Josef 'Jeff' Sipek
2009-06-04 10:46 ` Christoph Hellwig
2009-06-05 20:37 ` Eric Sandeen
2009-05-28 12:19 ` [PATCH 9/7] xfs: remove SYNC_BDFLUSH Christoph Hellwig
2009-05-29 13:19 ` Sujit Karataparambil
2009-05-29 20:10 ` Christoph Hellwig
2009-05-30 8:27 ` Sujit Karataparambil
2009-06-05 20:45 ` Eric Sandeen [this message]
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=4A2983DB.90300@sandeen.net \
--to=sandeen@sandeen.net \
--cc=hch@infradead.org \
--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 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.