[Ocfs2-tools-devel] [PATCH 1/1] Add truncate for "clear
sparse" function in tunefs.
Mark Fasheh
mark.fasheh at oracle.com
Tue Nov 13 00:08:25 PST 2007
On Tue, Nov 13, 2007 at 02:59:08PM +0800, tao.ma wrote:
> When we remove "sparse" flag from the OCFS2 volume, we need to truncate
> all the blocks that exceed i_size. They are illegal in a non-sparse
> OCFS2 system.
Great, thanks for fixing this. I have one comment below.
> @@ -763,7 +798,23 @@ errcode_t clear_sparse_file_flag(ocfs2_filesys *fs, char *progname)
> if (clear_ctxt.unwritten_only)
> goto fill_unwritten;
>
> + /* Iterate all the files and truncate them if needed. */
> + while (file) {
> + if (file->truncate) {
> + ret = ocfs2_read_inode(fs, file->blkno, buf);
> + if (ret)
> + goto bail;
> +
> + di = (struct ocfs2_dinode *)buf;
> + ret = truncate_file(fs, di);
> + if (ret)
> + goto bail;
> + }
> + file = file->next;
> + }
I think this block should be before the 'goto fill_unwritten', otherwise we
won't unwritten extents past i_size from files...
--Mark
--
Mark Fasheh
Senior Software Developer, Oracle
mark.fasheh at oracle.com
More information about the Ocfs2-tools-devel
mailing list