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

Sunil Mushran Sunil.Mushran at oracle.com
Thu Apr 26 11:21:11 PDT 2007


+       } 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.


-                       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.

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.

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



More information about the Ocfs2-tools-devel mailing list