diff mbox

xfs: Remove dead code from inode recover function

Message ID 1519197744-8339-1-git-send-email-nborisov@suse.com (mailing list archive)
State Accepted, archived
Headers show

Commit Message

Nikolay Borisov Feb. 21, 2018, 7:22 a.m. UTC
The memcpy is guarded by a check which is performed a right before we
call xfs_log_dinode_to_disk. At this point we are sure this check will
always be false otherwise we would have errored out. So let's remove
this dead weight.

Signed-off-by: Nikolay Borisov <nborisov@suse.com>
---
 fs/xfs/xfs_log_recover.c | 7 -------
 1 file changed, 7 deletions(-)

Comments

Carlos Maiolino Feb. 21, 2018, 11:55 a.m. UTC | #1
On Wed, Feb 21, 2018 at 09:22:24AM +0200, Nikolay Borisov wrote:
> The memcpy is guarded by a check which is performed a right before we
> call xfs_log_dinode_to_disk. At this point we are sure this check will
> always be false otherwise we would have errored out. So let's remove
> this dead weight.
> 
> Signed-off-by: Nikolay Borisov <nborisov@suse.com>
> ---

Looks good, memcpy will never be executed here, -EFSCORRUPTED will be returned
if this condition is true right before this memcpy call.

Reviewed-by: Carlos Maiolino <cmaiolino@redhat.com>


>  fs/xfs/xfs_log_recover.c | 7 -------
>  1 file changed, 7 deletions(-)
> 
> diff --git a/fs/xfs/xfs_log_recover.c b/fs/xfs/xfs_log_recover.c
> index 00240c9ee72e..cb20f2e83412 100644
> --- a/fs/xfs/xfs_log_recover.c
> +++ b/fs/xfs/xfs_log_recover.c
> @@ -3173,13 +3173,6 @@ xlog_recover_inode_pass2(
>  	/* recover the log dinode inode into the on disk inode */
>  	xfs_log_dinode_to_disk(ldip, dip);
>  
> -	/* the rest is in on-disk format */
> -	if (item->ri_buf[1].i_len > isize) {
> -		memcpy((char *)dip + isize,
> -			item->ri_buf[1].i_addr + isize,
> -			item->ri_buf[1].i_len - isize);
> -	}
> -
>  	fields = in_f->ilf_fields;
>  	if (fields & XFS_ILOG_DEV)
>  		xfs_dinode_put_rdev(dip, in_f->ilf_u.ilfu_rdev);
> -- 
> 2.7.4
> 
> --
> To unsubscribe from this list: send the line "unsubscribe linux-xfs" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff --git a/fs/xfs/xfs_log_recover.c b/fs/xfs/xfs_log_recover.c
index 00240c9ee72e..cb20f2e83412 100644
--- a/fs/xfs/xfs_log_recover.c
+++ b/fs/xfs/xfs_log_recover.c
@@ -3173,13 +3173,6 @@  xlog_recover_inode_pass2(
 	/* recover the log dinode inode into the on disk inode */
 	xfs_log_dinode_to_disk(ldip, dip);
 
-	/* the rest is in on-disk format */
-	if (item->ri_buf[1].i_len > isize) {
-		memcpy((char *)dip + isize,
-			item->ri_buf[1].i_addr + isize,
-			item->ri_buf[1].i_len - isize);
-	}
-
 	fields = in_f->ilf_fields;
 	if (fields & XFS_ILOG_DEV)
 		xfs_dinode_put_rdev(dip, in_f->ilf_u.ilfu_rdev);