[Ocfs2-devel] [PATCH 3/3] Implement "GROUP_ADD" for online resize,
take 2
tao.ma
tao.ma at oracle.com
Wed Dec 12 23:04:24 PST 2007
Mark Fasheh wrote:
>
>> + le32_add_cpu(&cr->c_total, input->clusters * cl_bpc);
>> + le32_add_cpu(&cr->c_free, input->frees * cl_bpc);
>> +
>> + le32_add_cpu(&fe->id1.bitmap1.i_total, input->clusters *cl_bpc);
>> + le32_add_cpu(&fe->id1.bitmap1.i_used,
>> + (input->clusters - input->frees) * cl_bpc);
>> + le32_add_cpu(&fe->i_clusters, input->clusters);
>> + le64_add_cpu(&fe->i_size, input->clusters << osb->s_clustersize_bits);
>> +
>> + ret = ocfs2_journal_dirty(handle, main_bm_bh);
>> + if (ret < 0) {
>> + mlog_errno(ret);
>> + goto out_unlock;
>> + }
>> +
>> + ret = ocfs2_commit_trans(osb, handle);
>> + if (ret < 0) {
>> + mlog_errno(ret);
>> + goto out_unlock;
>> + }
>> +
>> + spin_lock(&OCFS2_I(main_bm_inode)->ip_lock);
>> + OCFS2_I(main_bm_inode)->ip_clusters = le32_to_cpu(fe->i_clusters);
>> + spin_unlock(&OCFS2_I(main_bm_inode)->ip_lock);
>>
>
> Need to also update i_size. I think the other patch was missing
> that too...
> --Mark
>
Sorry for the late response. I have been in leave for some days.
Do you mean "fe->i_size" which I have updated above?
If it is, do I need to spin_lock and update "fe->i_size" and
"ip_clusters" in the same time before commit_trans?
I saw some similar codes in suballoc.c.
More information about the Ocfs2-devel
mailing list