[Ocfs2-tools-devel] [PATCH 1/1] libocfs2: Truncate should handle fast symlinks

Joel Becker Joel.Becker at oracle.com
Mon Mar 22 18:27:38 PDT 2010


On Mon, Mar 22, 2010 at 05:19:38PM -0700, Sunil Mushran wrote:
> Fast symlinks have no extents. This patch teaches ocfs2_truncate() to
> skip such inodes.
> 
> Signed-off-by: Sunil Mushran <sunil.mushran at oracle.com>
> ---
>  libocfs2/truncate.c |    4 ++++
>  1 files changed, 4 insertions(+), 0 deletions(-)
> 
> diff --git a/libocfs2/truncate.c b/libocfs2/truncate.c
> index d4f198c..be48ad3 100644
> --- a/libocfs2/truncate.c
> +++ b/libocfs2/truncate.c
> @@ -304,6 +304,10 @@ errcode_t ocfs2_truncate_full(ocfs2_filesys *fs, uint64_t ino,
>  	if (ci->ci_inode->i_size == new_i_size)
>  		goto out;
>  
> +	/* Skip for fast symlinks */
> +	if (S_ISLNK(ci->ci_inode->i_mode) && !ci->ci_inode->i_clusters)
> +		goto out;
> +
>  	if (ci->ci_inode->i_size < new_i_size)
>  		ret = ocfs2_extend_file(fs, ino, new_i_size);
>  	else {

	What about setting i_size?  With this change, a fast symlink
will be left unmodified (i_size stays the same as before) but a non-fast
symlink has its storage removed and its i_size changed.
	Given that we use ocfs2_truncate_full() to delete the storage of
all types of inodes, I think it should be setting i_size for fast
symlinks to 0.

Joel

-- 

"In the room the women come and go
 Talking of Michaelangelo."

Joel Becker
Principal Software Developer
Oracle
E-mail: joel.becker at oracle.com
Phone: (650) 506-8127



More information about the Ocfs2-tools-devel mailing list