From: Dave Chinner Date: Wed, 13 Nov 2013 06:40:36 +0000 (+0000) Subject: xfs: fix the wrong new_size/rnew_size at xfs_iext_realloc_direct() X-Git-Tag: v3.2.0-alpha2~30 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=3e23516ae60421652fd41354307a6a5181d401eb;p=thirdparty%2Fxfsprogs-dev.git xfs: fix the wrong new_size/rnew_size at xfs_iext_realloc_direct() At xfs_iext_realloc_direct(), the new_size is changed by adding if_bytes if originally the extent records are stored at the inline extent buffer, and we have to switch from it to a direct extent list for those new allocated extents, this is wrong. This patch fix above problem and revise the new_size comments at xfs_iext_realloc_direct() to make it more readable. Also, fix the comments while switching from the inline extent buffer to a direct extent list to reflect this change. Ported from kernel commit 17ec81c1. Signed-off-by: Dave Chinner Reviewed-by: Christoph Hellwig Signed-off-by: Rich Johnston --- diff --git a/libxfs/xfs_inode_fork.c b/libxfs/xfs_inode_fork.c index 190690c0c..dfa86aece 100644 --- a/libxfs/xfs_inode_fork.c +++ b/libxfs/xfs_inode_fork.c @@ -1330,7 +1330,7 @@ xfs_iext_remove_indirect( void xfs_iext_realloc_direct( xfs_ifork_t *ifp, /* inode fork pointer */ - int new_size) /* new size of extents */ + int new_size) /* new size of extents after adding */ { int rnew_size; /* real new size of extents */ @@ -1368,13 +1368,8 @@ xfs_iext_realloc_direct( rnew_size - ifp->if_real_bytes); } } - /* - * Switch from the inline extent buffer to a direct - * extent list. Be sure to include the inline extent - * bytes in new_size. - */ + /* Switch from the inline extent buffer to a direct extent list */ else { - new_size += ifp->if_bytes; if (!is_power_of_2(new_size)) { rnew_size = roundup_pow_of_two(new_size); }