[Ocfs2-devel] [PATCH 05/40] ocfs2: move ip_created_trans to struct ocfs2_caching_info

Tao Ma tao.ma at oracle.com
Mon Feb 16 21:46:27 PST 2009



Joel Becker wrote:
> On Mon, Feb 16, 2009 at 09:09:35AM +0800, Tao Ma wrote:
>> Joel Becker wrote:
>>> Similar ip_last_trans, ip_created_trans tracks the creation of a journal
>>> managed inode.  This specifically tracks what transaction created the
>>> inode.  This is so the code can know if the inode has ever been written
>>> to disk.
>>>
>>> This behavior is desirable for any journal managed object.  We move it
>>> to struct ocfs2_caching_info as ci_created_trans so that any object
>>> using ocfs2_caching_info can rely on this behavior.
>>>
>>> Signed-off-by: Joel Becker <joel.becker at oracle.com>
>> <snip>
>>> index ef75dbb..ff4b526 100644
>>> --- a/fs/ocfs2/journal.h
>>> +++ b/fs/ocfs2/journal.h
>>> @@ -118,9 +118,9 @@ static inline int ocfs2_inode_is_new(struct inode *inode)
>>>  		return 0;
>>>  	spin_lock(&trans_inc_lock);
>>>  	ret = !(time_after(OCFS2_SB(inode->i_sb)->journal->j_trans_id,
>>> -			   OCFS2_I(inode)->ip_created_trans));
>>> +			   INODE_CACHE(inode)->ci_created_trans));
>>>  	if (!ret)
>>> -		OCFS2_I(inode)->ip_created_trans = 0;
>>> +		INODE_CACHE(inode)->ci_created_trans = 0;
>>>  	spin_unlock(&trans_inc_lock);
>>>  	return ret;
>>>  }
>> A question unrelated to your modification. Why we use "!time_after" and  
>> then check "!ret". I guess a "time_after" and "ret" is ok.
> 
> 	I presume because we're returning ret to the caller.  We want
> ret to be 1 if the time_after() is false.
aha, yes. Thanks.

Regards,
Tao



More information about the Ocfs2-devel mailing list