[Ocfs2-tools-devel] [PATCH 05/10] libocfs2: read/write now know inline data.

Tao Ma tao.ma at oracle.com
Fri Jul 11 18:58:53 PDT 2008



Joel Becker wrote:
> [Patches 1-4 look good]
> 

>> +	written = 1;
>> +out:
>> +	return written ? written : ret;
> 
> 	This isn't pretty.  Why do it this way?
Copied from kernel. I think the reason is that this function returns 3 
values: 0 means "can't write inline, but no error", 1 means "write 
inline" succ, <0 means error. So we have to tell from 1 and 0 by the caller.
> 
>> +errcode_t ocfs2_file_write(ocfs2_cached_inode *ci,
>> +			   void *buf, uint32_t count,
>> +			   uint64_t offset, uint32_t *wrote)
>> +{
>> +	errcode_t ret;
>> +	ocfs2_filesys *fs = ci->ci_fs;
>> +	struct ocfs2_dinode *di = ci->ci_inode;
>> +
>> +	if (ocfs2_support_inline_data(OCFS2_RAW_SB(fs->fs_super))) {
>> +		ret = ocfs2_try_to_write_inline_data(ci, buf, count, offset);
>> +		if (ret == 1) {
>> +			ret = ocfs2_write_cached_inode(fs, ci);
> 
> 	Why not lift this call to ocfs2_write_cached_inode back up into
> ocfs2_try_to_write_inline_data()?  It's coupled with that anyway.
Yeah. thx.

Regards,
Tao



More information about the Ocfs2-tools-devel mailing list