public inbox for linux-xfs@vger.kernel.org
 help / color / mirror / Atom feed
From: Christoph Hellwig <hch@infradead.org>
To: Niv Sardi <xaiki@sgi.com>
Cc: Christoph Hellwig <hch@infradead.org>, xfs@oss.sgi.com
Subject: Re: [UPDATED RFC] Create with EA initial work
Date: Wed, 23 Jul 2008 03:51:45 -0400	[thread overview]
Message-ID: <20080723075145.GC24031@infradead.org> (raw)
In-Reply-To: <87y73t9n8k.fsf@cxhome.ath.cx>

On Wed, Jul 23, 2008 at 03:35:23PM +1000, Niv Sardi wrote:
> > There are multiple ways to deal with inodes linked to transactions.
> >
> > In all cases it needs to be linked into the transaction by
> > xfs_trans_ijoin, or the opencoded equivalent for a new inode in
> > xfs_trans_iget.
> 
> Shouldn't the inode already be in the transaction ? we just created it
> and added it to the directory ?
> 
> xfs_create()
>   xfs_dir_ialloc(tp, dp, ip)
>     xfs_ialloc(tp, dp, ip)
>       xfs_trans_iget(tp, ip)
> 
> and it has a i_transp after dir_ialloc.
> 
> And is why don't we use ijoin in iget as we copy the exact same code a
> few lines later ? (like in [0])

Yes, it is in the transaction.  I just meant to say xfs_trans_iget
opencodes the transaction linking otherwise done in xfs_trans_ijoin.

> >  Then you can use xfs_trans_ihold to make sure on transaction commit
> > the inode reference count is not dropped and the inode is not
> > unlocked, or simply grab a reference to the inode and let the
> > transaction commit handler unlock it and decrement the reference
> > count.  The latter is what's used by xfs_create and the former is what
> > the attr code does, and as far as I can see the only things what works
> > with xfs_attr_rolltrans.
> 
> hum, that seemed to work on my UML, shall we require callers to do all
> the ihold, ijoin stuff or should we do that (or at least check it) from
> the new attr*_trans code ?

I'm not sure.  What we need to is to make sure we don't have multiple
linked transactions that use the iget + unlock style.  One way to do
that would to alwas use the xfs_trans_ihold style first and then
add a helper that just clears XFS_ILI_HOLD for the final transaction
in create.

> diff --git a/fs/xfs/xfs_trans_inode.c b/fs/xfs/xfs_trans_inode.c
> index 2a1c0f0..1dbcbe9 100644
> --- a/fs/xfs/xfs_trans_inode.c
> +++ b/fs/xfs/xfs_trans_inode.c
> @@ -138,35 +138,7 @@ xfs_trans_iget(
>  	}
>  	ASSERT(ip != NULL);
>  
> -	/*
> -	 * Get a log_item_desc to point at the new item.
> -	 */
> -	if (ip->i_itemp == NULL)
> -		xfs_inode_item_init(ip, mp);
> -	iip = ip->i_itemp;
> -	(void) xfs_trans_add_item(tp, (xfs_log_item_t *)(iip));
> -
> -	xfs_trans_inode_broot_debug(ip);
> -
> -	/*
> -	 * If the IO lock has been acquired, mark that in
> -	 * the inode log item so we'll know to unlock it
> -	 * when the transaction commits.
> -	 */
> -	ASSERT(iip->ili_flags == 0);
> -	if (lock_flags & XFS_IOLOCK_EXCL) {
> -		iip->ili_flags |= XFS_ILI_IOLOCKED_EXCL;
> -	} else if (lock_flags & XFS_IOLOCK_SHARED) {
> -		iip->ili_flags |= XFS_ILI_IOLOCKED_SHARED;
> -	}
> -
> -	/*
> -	 * Initialize i_transp so we can find it with xfs_inode_incore()
> -	 * above.
> -	 */
> -	ip->i_transp = tp;
> -
> -	*ipp = ip;
> +	xfs_trans_ijoin(tp, ip, lock_flags);

Did you test this?  For one the *ipp assignment seems to be missing now,
and second I'd think we'd have to audit the ASSERTs in xfs_trans_ijoin
if they are correct for the iget case.  But I think this is a good idea,
and if the asserts are not okay just create an _xfs_trans_ijoin without
them that's used by xfs_trans_ijoin.

      reply	other threads:[~2008-07-23  7:50 UTC|newest]

Thread overview: 36+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-06-23  4:42 [RFC] Create with EA initial work Niv Sardi
2008-06-23  4:42 ` [PATCH] Move attr log alloc size calculator to another function Niv Sardi
2008-06-23  4:42   ` [PATCH] Move xfs_attr_rolltrans to xfs_trans_roll Niv Sardi
2008-06-23  4:42     ` [PATCH] Introduce xfs_trans_bmap_add_attrfork Niv Sardi
2008-06-23  4:42       ` [PATCH] Give a transaction to xfs_attr_set_int Niv Sardi
2008-06-29 22:08         ` Dave Chinner
2008-07-01 15:49           ` Josef 'Jeff' Sipek
2008-06-26  9:28       ` [PATCH] Introduce xfs_trans_bmap_add_attrfork Christoph Hellwig
2008-06-27  4:42         ` Niv Sardi
2008-07-02  8:25           ` Timothy Shimmin
2008-07-02 23:39             ` Niv Sardi
2008-06-29 22:02       ` Dave Chinner
2008-06-26  8:28     ` [PATCH] Move xfs_attr_rolltrans to xfs_trans_roll Christoph Hellwig
2008-06-27  4:44       ` Niv Sardi
2008-06-27 13:03         ` Christoph Hellwig
2008-06-27 13:03           ` Christoph Hellwig
2008-07-02  7:14     ` Timothy Shimmin
2008-06-26  8:24   ` [PATCH] Move attr log alloc size calculator to another function Christoph Hellwig
2008-06-27  4:49     ` Niv Sardi
2008-07-02  6:38       ` Timothy Shimmin
2008-07-10  7:39 ` [UPDATED RFC] Create with EA initial work Niv Sardi
2008-07-10  7:39   ` [PATCH] Move attr log alloc size calculator to another function Niv Sardi
2008-07-10  7:39     ` [PATCH] Move xfs_attr_rolltrans to xfs_trans_roll Niv Sardi
2008-07-10  7:39       ` [PATCH] Introduce xfs_bmap_add_attrfork_trans Niv Sardi
2008-07-10  7:39         ` [PATCH] Give a transaction to xfs_attr_set_int Niv Sardi
2008-07-11  5:38           ` [PATCH] Export xfs_attr_set_int_trans Niv Sardi
2008-07-11  5:38             ` [PATCH] hack to test create + ea Niv Sardi
2008-07-22  4:43             ` [PATCH] Export xfs_attr_set_int_trans Christoph Hellwig
2008-07-22  6:06               ` Niv Sardi
2008-07-23  7:46                 ` Christoph Hellwig
2008-07-11  5:44           ` [PATCH] Give a transaction to xfs_attr_set_int Niv Sardi
2008-07-11  5:59             ` Christoph Hellwig
2008-07-23  7:58         ` [PATCH] Introduce xfs_bmap_add_attrfork_trans Christoph Hellwig
2008-07-22  4:38   ` [UPDATED RFC] Create with EA initial work Christoph Hellwig
2008-07-23  5:35     ` Niv Sardi
2008-07-23  7:51       ` Christoph Hellwig [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=20080723075145.GC24031@infradead.org \
    --to=hch@infradead.org \
    --cc=xaiki@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