[Ocfs2-tools-devel] Patch for journal truncate of ocfs2-tools.

tao.ma tao.ma at oracle.com
Thu Apr 26 18:27:48 PDT 2007


Sunil Mushran wrote:
> +       } else if (clusters < di->i_clusters) {
> +               uint64_t new_size = clusters <<
> +                          
> OCFS2_RAW_SB(fs->fs_super)->s_clustersize_bits;
> +               ret = ocfs2_truncate(fs, blkno, new_size);
> +               if (ret)
> +                       goto out;
> +
> +               ocfs2_free_cached_inode(fs, ci);
> +               ret = ocfs2_read_cached_inode(fs, blkno, &ci);
> +               if (ret) {
> +                       ci = NULL;
> +                       goto out;
> +               }
>
> ocfs2_truncate() is capable of extending and truncating. Why not just
> call that directly.
In the furture implementation of ocfs2_truncate for sparse_files, 
ocfs2_truncate will only increase the size when the user do the 
extending and I preserve the function of ocfs2_extend_allocation which 
will allocate the clusters when extending. So I don't want to modify 
this function then to fit this need.
>
>
> -                       if (!opts.num_slots) {
> -                               com_err(opts.progname, 0, "Journal 
> size %"PRIu64" "
> -                                       "has to be larger " "than 
> %"PRIu64"",
> -                                       opts.jrnl_size, def_jrnl_size);
> -                               goto unlock;
> -                       }
> +                       com_err(opts.progname, 0, "Journal size 
> %"PRIu64" "
> +                               "has to be different from %"PRIu64"",
> +                               opts.jrnl_size, def_jrnl_size);
> +                       goto unlock;
>
> This is incorrect. Read the num_slots code above this block
> to see why we have the "if (!opts.num_slots)" condition.
 From the code it seems that we used to make the journal size smaller 
only under the condition that we change the numbers of slots, so here we 
have the check of "if (!opts.num_slots)". But now we can decrease the 
journal size without touching the number of slots, so we shouldn't care 
whether we change num_slots or not. Am I wrong? Please point it out.
>
> Also, I would prefer not erroring out if the user specifies the same
> journal size. Instead, write a comment indicating that "No Journal resize
> as it is already at x bytes" and continue with the remaining tasks.
OK, I will remove the error output.
>
> tao.ma wrote:
>> Now ocfs2_truncate can truncate a file to a specified size.
>> So add the mechanism of journal truncate to save the disk space.
>> <http://www.oracle.com/cdc/>
>> ------------------------------------------------------------------------
>>
>> _______________________________________________
>> Ocfs2-tools-devel mailing list
>> Ocfs2-tools-devel at oss.oracle.com
>> http://oss.oracle.com/mailman/listinfo/ocfs2-tools-devel


-- 
* **     Tao Ma
*     Member of Techincal Staff *

Oracle Asia Research & Development Center
Open Source Technologies Development
*
Tel:        +86 10 8278 6026
Mobile:   +86 13701237602         
URL:       OARDC Intranet <http://cdc.oraclecorp.com/>, Oracle.com/cdc 
<http://www.oracle.com/cdc/>



More information about the Ocfs2-tools-devel mailing list