All of lore.kernel.org
 help / color / mirror / Atom feed
From: Eric Sandeen <sandeen@sandeen.net>
To: Christoph Hellwig <hch@infradead.org>
Cc: xfs@oss.sgi.com
Subject: Re: [PATCH 6/7] xfs: use generic inode iterator in xfs_qm_dqrele_all_inodes
Date: Fri, 05 Jun 2009 15:11:55 -0500	[thread overview]
Message-ID: <4A297C0B.8060302@sandeen.net> (raw)
In-Reply-To: <20090605191744.GA17489@infradead.org>

Christoph Hellwig wrote:
> On Fri, Jun 05, 2009 at 02:15:38PM -0500, Eric Sandeen wrote:
>> Does this need the same error propagation treatment as 5/7 ?
> 
> Yes, I've already fixed this up in my local copy:
> 
> Subject: xfs: use generic inode iterator in xfs_qm_dqrele_all_inodes
> From: Christoph Hellwig <hch@lst.de>
> 
> Use xfs_inode_ag_iterator instead of opencoding the inode walk in the
> quota code.  Mark xfs_inode_ag_iterator and xfs_sync_inode_valid non-static
> to allow using them from the quota code.
> 
> 
> Signed-off-by: Christoph Hellwig <hch@lst.de>
> Reviewed-by: Josef 'Jeff' Sipek <jeffpc@josefsipek.net>

Ok, this looks fine to me.

Reviewed-by: Eric Sandeen <sandeen@redhat.com>

> 
> Index: xfs/fs/xfs/quota/xfs_qm_syscalls.c
> ===================================================================
> --- xfs.orig/fs/xfs/quota/xfs_qm_syscalls.c	2009-06-04 12:47:30.742821242 +0200
> +++ xfs/fs/xfs/quota/xfs_qm_syscalls.c	2009-06-04 13:03:51.039832673 +0200
> @@ -847,105 +847,55 @@ xfs_qm_export_flags(
>  }
>  
>  
> -/*
> - * Release all the dquots on the inodes in an AG.
> - */
> -STATIC void
> -xfs_qm_dqrele_inodes_ag(
> -	xfs_mount_t	*mp,
> -	int		ag,
> -	uint		flags)
> +STATIC int
> +xfs_dqrele_inode(
> +	struct xfs_inode	*ip,
> +	struct xfs_perag	*pag,
> +	int			flags)
>  {
> -	xfs_inode_t	*ip = NULL;
> -	xfs_perag_t	*pag = &mp->m_perag[ag];
> -	int		first_index = 0;
> -	int		nr_found;
> -
> -	do {
> -		/*
> -		 * use a gang lookup to find the next inode in the tree
> -		 * as the tree is sparse and a gang lookup walks to find
> -		 * the number of objects requested.
> -		 */
> -		read_lock(&pag->pag_ici_lock);
> -		nr_found = radix_tree_gang_lookup(&pag->pag_ici_root,
> -				(void**)&ip, first_index, 1);
> -
> -		if (!nr_found) {
> -			read_unlock(&pag->pag_ici_lock);
> -			break;
> -		}
> -
> -		/*
> -		 * Update the index for the next lookup. Catch overflows
> -		 * into the next AG range which can occur if we have inodes
> -		 * in the last block of the AG and we are currently
> -		 * pointing to the last inode.
> -		 */
> -		first_index = XFS_INO_TO_AGINO(mp, ip->i_ino + 1);
> -		if (first_index < XFS_INO_TO_AGINO(mp, ip->i_ino)) {
> -			read_unlock(&pag->pag_ici_lock);
> -			break;
> -		}
> -
> -		/* skip quota inodes */
> -		if (ip == XFS_QI_UQIP(mp) || ip == XFS_QI_GQIP(mp)) {
> -			ASSERT(ip->i_udquot == NULL);
> -			ASSERT(ip->i_gdquot == NULL);
> -			read_unlock(&pag->pag_ici_lock);
> -			continue;
> -		}
> +	int			error;
>  
> -		/*
> -		 * If we can't get a reference on the inode, it must be
> -		 * in reclaim. Leave it for the reclaim code to flush.
> -		 */
> -		if (!igrab(VFS_I(ip))) {
> -			read_unlock(&pag->pag_ici_lock);
> -			continue;
> -		}
> +	/* skip quota inodes */
> +	if (ip == XFS_QI_UQIP(ip->i_mount) || ip == XFS_QI_GQIP(ip->i_mount)) {
> +		ASSERT(ip->i_udquot == NULL);
> +		ASSERT(ip->i_gdquot == NULL);
>  		read_unlock(&pag->pag_ici_lock);
> +		return 0;
> +	}
>  
> -		/* avoid new inodes though we shouldn't find any here */
> -		if (xfs_iflags_test(ip, XFS_INEW)) {
> -			IRELE(ip);
> -			continue;
> -		}
> +	error = xfs_sync_inode_valid(ip, pag);
> +	if (error)
> +		return error;
>  
> -		xfs_ilock(ip, XFS_ILOCK_EXCL);
> -		if ((flags & XFS_UQUOTA_ACCT) && ip->i_udquot) {
> -			xfs_qm_dqrele(ip->i_udquot);
> -			ip->i_udquot = NULL;
> -		}
> -		if (flags & (XFS_PQUOTA_ACCT|XFS_GQUOTA_ACCT) &&
> -		    ip->i_gdquot) {
> -			xfs_qm_dqrele(ip->i_gdquot);
> -			ip->i_gdquot = NULL;
> -		}
> -		xfs_iput(ip, XFS_ILOCK_EXCL);
> +	xfs_ilock(ip, XFS_ILOCK_EXCL);
> +	if ((flags & XFS_UQUOTA_ACCT) && ip->i_udquot) {
> +		xfs_qm_dqrele(ip->i_udquot);
> +		ip->i_udquot = NULL;
> +	}
> +	if (flags & (XFS_PQUOTA_ACCT|XFS_GQUOTA_ACCT) && ip->i_gdquot) {
> +		xfs_qm_dqrele(ip->i_gdquot);
> +		ip->i_gdquot = NULL;
> +	}
> +	xfs_iput(ip, XFS_ILOCK_EXCL);
> +	IRELE(ip);
>  
> -	} while (nr_found);
> +	return 0;
>  }
>  
> +
>  /*
>   * Go thru all the inodes in the file system, releasing their dquots.
> + *
>   * Note that the mount structure gets modified to indicate that quotas are off
> - * AFTER this, in the case of quotaoff. This also gets called from
> - * xfs_rootumount.
> + * AFTER this, in the case of quotaoff.
>   */
>  void
>  xfs_qm_dqrele_all_inodes(
>  	struct xfs_mount *mp,
>  	uint		 flags)
>  {
> -	int		i;
> -
>  	ASSERT(mp->m_quotainfo);
> -	for (i = 0; i < mp->m_sb.sb_agcount; i++) {
> -		if (!mp->m_perag[i].pag_ici_init)
> -			continue;
> -		xfs_qm_dqrele_inodes_ag(mp, i, flags);
> -	}
> +	xfs_inode_ag_iterator(mp, xfs_dqrele_inode, flags, -1);
>  }
>  
>  /*------------------------------------------------------------------------*/
> Index: xfs/fs/xfs/linux-2.6/xfs_sync.c
> ===================================================================
> --- xfs.orig/fs/xfs/linux-2.6/xfs_sync.c	2009-06-04 13:01:29.388941822 +0200
> +++ xfs/fs/xfs/linux-2.6/xfs_sync.c	2009-06-04 13:02:26.249965001 +0200
> @@ -141,7 +141,7 @@ restart:
>  	return last_error;
>  }
>  
> -STATIC int
> +int
>  xfs_inode_ag_iterator(
>  	struct xfs_mount	*mp,
>  	int			(*execute)(struct xfs_inode *ip,
> @@ -167,7 +167,7 @@ xfs_inode_ag_iterator(
>  }
>  
>  /* must be called with pag_ici_lock held and releases it */
> -STATIC int
> +int
>  xfs_sync_inode_valid(
>  	struct xfs_inode	*ip,
>  	struct xfs_perag	*pag)
> Index: xfs/fs/xfs/linux-2.6/xfs_sync.h
> ===================================================================
> --- xfs.orig/fs/xfs/linux-2.6/xfs_sync.h	2009-06-04 12:47:30.804939977 +0200
> +++ xfs/fs/xfs/linux-2.6/xfs_sync.h	2009-06-04 13:02:26.249965001 +0200
> @@ -54,4 +54,10 @@ void xfs_inode_set_reclaim_tag(struct xf
>  void xfs_inode_clear_reclaim_tag(struct xfs_inode *ip);
>  void __xfs_inode_clear_reclaim_tag(struct xfs_mount *mp, struct xfs_perag *pag,
>  				struct xfs_inode *ip);
> +
> +int xfs_sync_inode_valid(struct xfs_inode *ip, struct xfs_perag *pag);
> +int xfs_inode_ag_iterator(struct xfs_mount *mp,
> +	int (*execute)(struct xfs_inode *ip, struct xfs_perag *pag, int flags),
> +	int flags, int tag);
> +
>  #endif
> 
> _______________________________________________
> 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

  reply	other threads:[~2009-06-05 20:11 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 [this message]
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

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=4A297C0B.8060302@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.