[Ocfs2-devel] [PATCH 02/15] ocfs2: Add clusters free in dealloc_ctxt.
Tao Ma
tao.ma at oracle.com
Mon Nov 3 19:07:16 PST 2008
Joel Becker wrote:
> On Tue, Nov 04, 2008 at 09:34:40AM +0800, Tao Ma wrote:
>> Joel Becker wrote:
>>>> +{
>>>> + struct ocfs2_cached_block_free *tmp;
>>>> + struct inode *tl_inode = osb->osb_tl_inode;
>>>> + handle_t *handle;
>>>> + int ret = 0;
>>>> +
>>>> + mutex_lock(&tl_inode->i_mutex);
>>>> +
>>>> + handle = ocfs2_start_trans(osb, OCFS2_TRUNCATE_LOG_UPDATE);
>>>> + if (IS_ERR(handle)) {
>>>> + ret = PTR_ERR(handle);
>>>> + mlog_errno(ret);
>>>> + goto out_mutex;
>>>> + }
>>>> +
>>>> + while (head) {
>>>> + ret = ocfs2_truncate_log_append(osb, handle, head->free_blk,
>>>> + head->free_bit);
>>>> + if (ret) {
>>>> + mlog_errno(ret);
>>>> + break;
>>>> + }
>>> What happens if the truncate log fills up?
>> currently, it is only used in one xattr set. So the total size is only
>> 64K bytes and I don't think the chance is very high. I have also gone
>> through ocfs2_commit_truncate, no error handler there, and even if it is
>> filled up and error out, fsck should be able to find them. But you are
>> probably right, if in future we use it in truncating file, it may be a
>> very high risk. But it could be in another separate patch, agree?
>
> ocfs2_commit_truncate() is a loop from start: to bail:. It
> calls ocfs2_do_truncate() for each extent it removes. Before each call
> to ocfs2_do_truncate(), it checks ocfs2_truncate_log_needs_flush().
> That is, it never adds more than one record to the truncate log at a
> time, and it checks for a full log before adding each record.
> Your 64K can be 16 clusters at a 4K cluster size. That's 16
> records. What if the truncate log had only space for three records from
> a previous operation? Your fourth call to ocfs2_truncate_log_append()
> will mlog_bug_on_msg() like so:
>
> 5319 mlog_bug_on_msg(tl_count > ocfs2_truncate_recs_per_inode(osb->sb) ||
>
> That is not acceptable. We don't introduce known bugs and say
> they are OK if they are rare.
Fair enough. I will try to find a way for it. thanks.
Regards,
Tao
More information about the Ocfs2-devel
mailing list