From: Dave Chinner <david@fromorbit.com>
To: Christoph Hellwig <hch@infradead.org>
Cc: xfs@oss.sgi.com
Subject: Re: [patch 05/22] cleanup the inode reclaim path
Date: Wed, 3 Dec 2008 13:29:50 +1100 [thread overview]
Message-ID: <20081203022950.GD18236@disturbed> (raw)
In-Reply-To: <20081202160650.198364000@bombadil.infradead.org>
On Tue, Dec 02, 2008 at 11:04:35AM -0500, Christoph Hellwig wrote:
> Merge xfs_iextract and xfs_idestory into xfs_ireclaim as they are never
xfs_idestroy
> called individually. Also rewrite most comments in this area as they
> were serverly out of date.
severely
>
> Signed-off-by: Christoph Hellwig <hch@lst.de>
>
> Index: xfs-master/fs/xfs/xfs_iget.c
> ===================================================================
> --- xfs-master.orig/fs/xfs/xfs_iget.c 2008-12-01 19:26:04.000000000 +0100
> +++ xfs-master/fs/xfs/xfs_iget.c 2008-12-01 19:27:15.000000000 +0100
> @@ -450,65 +450,109 @@ xfs_iput_new(
> IRELE(ip);
> }
>
> -
> /*
> - * This routine embodies the part of the reclaim code that pulls
> - * the inode from the inode hash table and the mount structure's
> - * inode list.
> - * This should only be called from xfs_reclaim().
> + * This is called free all the memory associated with an inode.
* xfs_ireclaim is called to free....
> + * It must free the inode itself and any buffers allocated for
> + * if_extents/if_data and if_broot. It must also free the lock
> + * associated with the inode.
> + *
> + * Note: because we don't initialise everything on reallocation out
> + * of the zone, we must ensure we nullify everything correctly before
> + * freeing the structure.
> */
> void
> -xfs_ireclaim(xfs_inode_t *ip)
> +xfs_ireclaim(
> + struct xfs_inode *ip)
> {
> - /*
> - * Remove from old hash list and mount list.
> - */
> - XFS_STATS_INC(xs_ig_reclaims);
> + struct xfs_mount *mp = ip->i_mount;
> + struct xfs_perag *pag;
>
> - xfs_iextract(ip);
> + XFS_STATS_INC(xs_ig_reclaims);
>
> /*
> - * Here we do a spurious inode lock in order to coordinate with inode
> - * cache radix tree lookups. This is because the lookup can reference
> - * the inodes in the cache without taking references. We make that OK
> - * here by ensuring that we wait until the inode is unlocked after the
> - * lookup before we go ahead and free it. We get both the ilock and
> - * the iolock because the code may need to drop the ilock one but will
> - * still hold the iolock.
> + * Remove the inode from the per-AG radix tree. It doesn't matter
> + * if it was never added to it because radix_tree_delete can deal
> + * with that case just fine.
> */
> - xfs_ilock(ip, XFS_ILOCK_EXCL | XFS_IOLOCK_EXCL);
> + pag = xfs_get_perag(mp, ip->i_ino);
> + write_lock(&pag->pag_ici_lock);
> + radix_tree_delete(&pag->pag_ici_root, XFS_INO_TO_AGINO(mp, ip->i_ino));
> + write_unlock(&pag->pag_ici_lock);
> + xfs_put_perag(mp, pag);
>
> /*
> - * Release dquots (and their references) if any. An inode may escape
> - * xfs_inactive and get here via vn_alloc->vn_reclaim path.
> + * Here we do an (almost) spurious inode lock in order to coordinate
> + * with inode cache radix tree lookups. This is because the lookup
> + * can reference the inodes in the cache without taking references.
> + *
> + * We make that OK here by ensuring that we wait until the inode is
> + * unlocked after the lookup before we go ahead and free it. We get
> + * both the ilock and the iolock because the code may need to drop the
> + * ilock one but will still hold the iolock.
> */
Hmmm - I need to check if this is still true. We now use igrab() to
get a reference on all lookups except the reclaim lookup. In the
case of a racing reclaim lookup, we check for the reclaim
flags on the inode after the lookup but before we try to lock the
inode. Hence this lock check probably doesn't do anything anymore,
but I need to look a bit closer....
Other than the typos, the code looks ok, so:
Reviewed-by: Dave Chinner <david@fromorbit.com>
Cheers,
Dave.
--
Dave Chinner
david@fromorbit.com
_______________________________________________
xfs mailing list
xfs@oss.sgi.com
http://oss.sgi.com/mailman/listinfo/xfs
next prev parent reply other threads:[~2008-12-03 2:34 UTC|newest]
Thread overview: 61+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-12-02 16:04 [patch 00/22] 2.6.29 queue Christoph Hellwig
2008-12-02 16:04 ` [patch 01/22] fix compile on 32 bit systems Christoph Hellwig
2008-12-02 16:43 ` Eric Sandeen
2008-12-03 2:20 ` Eric Sandeen
2008-12-04 1:03 ` Niv Sardi
2008-12-04 12:34 ` Christoph Hellwig
2008-12-04 13:03 ` Niv Sardi
2008-12-04 13:11 ` Christoph Hellwig
2008-12-04 13:40 ` Niv Sardi
2008-12-02 16:04 ` [patch 02/22] remove useless mnt_want_write call in xfs_write Christoph Hellwig
2008-12-03 2:11 ` Dave Chinner
2008-12-02 16:04 ` [patch 03/22] remove unused behvavior cruft in xfs_super.h Christoph Hellwig
2008-12-03 2:12 ` Dave Chinner
2008-12-02 16:04 ` [patch 04/22] remove unused prototypes for xfs_ihash_init / xfs_ihash_free Christoph Hellwig
2008-12-03 2:13 ` Dave Chinner
2008-12-03 2:22 ` Eric Sandeen
2008-12-02 16:04 ` [patch 05/22] cleanup the inode reclaim path Christoph Hellwig
2008-12-03 2:29 ` Dave Chinner [this message]
2008-12-03 10:53 ` Christoph Hellwig
2008-12-02 16:04 ` [patch 06/22] kill xfs_buf_iostart Christoph Hellwig
2008-12-03 2:37 ` Dave Chinner
2008-12-02 16:04 ` [patch 07/22] stop using igrab in xfs_vn_link Christoph Hellwig
2008-12-03 2:39 ` Dave Chinner
2008-12-02 16:04 ` [patch 08/22] reduce l_icloglock roundtrips Christoph Hellwig
2008-12-03 2:56 ` Dave Chinner
2008-12-03 10:51 ` Christoph Hellwig
2008-12-02 16:04 ` [patch 09/22] remove dead code from sv_t implementation Christoph Hellwig
2008-12-03 2:56 ` Dave Chinner
2008-12-02 16:04 ` [patch 10/22] kill dead quota flags Christoph Hellwig
2008-12-03 2:57 ` Dave Chinner
2008-12-02 16:04 ` [patch 11/22] cleanup xfs_sb.h feature flag helpers Christoph Hellwig
2008-12-03 6:26 ` Donald Douwsma
2008-12-03 10:52 ` Christoph Hellwig
2008-12-02 16:04 ` [patch 12/22] kill dead inode flags Christoph Hellwig
2008-12-03 2:59 ` Dave Chinner
2008-12-04 2:24 ` Niv Sardi
2008-12-04 12:35 ` Christoph Hellwig
2008-12-02 16:04 ` [patch 13/22] remove unused m_inode_quiesce member from struct xfs_mount Christoph Hellwig
2008-12-03 2:59 ` Dave Chinner
2008-12-02 16:04 ` [patch 14/22] remove leftovers of shared read-only support Christoph Hellwig
2008-12-03 3:01 ` Dave Chinner
2008-12-03 10:57 ` Christoph Hellwig
2008-12-02 16:04 ` [patch 15/22] replace b_fspriv with b_mount Christoph Hellwig
2008-12-03 14:03 ` Christoph Hellwig
2008-12-03 21:54 ` Dave Chinner
2008-12-02 16:04 ` [patch 16/22] use xfs_trans_ijoin in xfs_trans_iget Christoph Hellwig
2008-12-03 3:03 ` Dave Chinner
2008-12-02 16:04 ` [patch 17/22] no explicit xfs_iflush for special inodes during unmount Christoph Hellwig
2008-12-03 3:06 ` Dave Chinner
2008-12-02 16:04 ` [patch 18/22] kill xfs_unmount_flush Christoph Hellwig
2008-12-03 3:08 ` Dave Chinner
2008-12-02 16:04 ` [patch 19/22] kill vn_ioerror Christoph Hellwig
2008-12-03 3:13 ` Dave Chinner
2008-12-02 16:04 ` [patch 20/22] move vn_iowait / vn_iowake into xfs_aops.c Christoph Hellwig
2008-12-03 3:17 ` Dave Chinner
2008-12-03 10:58 ` Christoph Hellwig
2008-12-03 21:48 ` Dave Chinner
2008-12-02 16:04 ` [patch 21/22] move inode tracing out of xfs_vnode Christoph Hellwig
2008-12-03 3:18 ` Dave Chinner
2008-12-02 16:04 ` [patch 22/22] use inode_change_ok for setattr permission checking Christoph Hellwig
2008-12-03 17:13 ` [patch 00/22] 2.6.29 queue Christoph Hellwig
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=20081203022950.GD18236@disturbed \
--to=david@fromorbit.com \
--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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox