xfs
[Top] [All Lists]

Re: [PATCH] Introduce xfs_trans_bmap_add_attrfork.

To: Niv Sardi <xaiki@xxxxxxx>
Subject: Re: [PATCH] Introduce xfs_trans_bmap_add_attrfork.
From: Timothy Shimmin <tes@xxxxxxx>
Date: Wed, 02 Jul 2008 18:25:26 +1000
Cc: Christoph Hellwig <hch@xxxxxxxxxxxxx>, xfs@xxxxxxxxxxx
In-reply-to: <nccy74r1oba.fsf@xxxxxxx>
References: <1214196150-5427-1-git-send-email-xaiki@xxxxxxx> <1214196150-5427-2-git-send-email-xaiki@xxxxxxx> <1214196150-5427-3-git-send-email-xaiki@xxxxxxx> <1214196150-5427-4-git-send-email-xaiki@xxxxxxx> <20080626092856.GA27069@xxxxxxxxxxxxx> <nccy74r1oba.fsf@xxxxxxx>
Sender: xfs-bounce@xxxxxxxxxxx
User-agent: Thunderbird 2.0.0.14 (Macintosh/20080421)
Niv Sardi wrote:
> Updated patch attached,
> Moved case where there is no transaction back into
> xfs_bmap_add_attrfork() and rely on caller to call xfs_trans_roll(),
> 
> Christoph Hellwig <hch@xxxxxxxxxxxxx> writes:
>>> +xfs_bmap_add_attrfork(
> [...]
>> Care to add this below xfs_trans_bmap_add_attrfork?  Also please
>> us struct xfs_inode instead of the typedef.
> 
> Done,
> 
>>> +   if (tpp) {
>>> +           ASSERT(*tpp);
>>> +           tp = *tpp;
>>> +   } else {
> [...]
>> I think it would be much cleaner if all the transaction setup, joining
>> etc was done in xfs_bmap_add_attrfork, and xfs_trans_bmap_add_attrfork
>> just gets an always non-NULL xfs_trans pointer.  That would mean
>> the common code would become just a helper, and
>> xfs_trans_bmap_add_attrfork would be a small wrapper including the 
>> xfs_trans_roll.  Alternatively the caller could always do the roll.
> 
> I think I got it right, but error handeling is a bit weird this way,
> looks logically identical.
> 
> 
> 
> ------------------------------------------------------------------------
> 
> 
> Thanks for this extensive review =)
>
> +     if (error)
> +             goto error1;
> +
> +     if (XFS_IFORK_Q(ip))
> +             goto error1;
> +
> +     ASSERT(ip->i_d.di_anextents == 0);
> +     VN_HOLD(XFS_ITOV(ip));
> +     xfs_trans_ijoin(tp, ip, XFS_ILOCK_EXCL);
> +     xfs_trans_log_inode(tp, ip, XFS_ILOG_CORE);
> +
> +     error = xfs_trans_bmap_add_attrfork(NULL, ip, size, rsvd);
> +     if (error)
> +             return error;
> +     return xfs_trans_commit(tp, XFS_TRANS_PERM_LOG_RES);

I was kind of expecting the transaction, &tp, to be passed into
xfs_trans_bmap_add_attrfork().
(And then xfs_trans_bmap_add_attrfork() which calls
xfs_bmap_finish() which calls xfs_trans_dup() and so from that
point on we would then have to update tp if we were to use it.)

So how come we pass in NULL?
I'm tired so I'm probably missing something obvious.

--Tim


<Prev in Thread] Current Thread [Next in Thread>