[Ocfs2-tools-devel] [PATCH 4/7] libocfs2: add two types of trees operation of xattr
Tiger Yang
tiger.yang at oracle.com
Thu Nov 5 18:25:24 PST 2009
Joel Becker wrote:
> On Tue, Oct 20, 2009 at 04:41:48PM +0800, Tiger Yang wrote:
>> -errcode_t ocfs2_cached_inode_extend_allocation(ocfs2_cached_inode *ci,
>> - uint32_t new_clusters)
>> +errcode_t ocfs2_tree_extend_allocation(ocfs2_filesys *fs,
>> + uint32_t new_clusters,
>> + struct ocfs2_extent_tree *et)
>> {
>> errcode_t ret = 0;
>> uint32_t n_clusters = 0, cpos;
>> - uint64_t blkno, file_size;
>> - ocfs2_filesys *fs = ci->ci_fs;
>> + uint64_t blkno;
>>
>> - file_size = ci->ci_inode->i_size;
>> - cpos = (file_size + fs->fs_clustersize - 1) / fs->fs_clustersize;
>> + cpos = et->et_ops->eo_get_clusters(et);
>
> This will break for sparse files. If i_clusters is less than
> the actual file size due to holes, you'll get the wrong cpos.
>
> Joel
>
Thanks to point it out. I will fix it in the next version.
tiger
More information about the Ocfs2-tools-devel
mailing list